aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/odp_packet_io.c
AgeCommit message (Collapse)Author
2016-01-25linux-generic: packet_io: expose pktio_tbl and is_free()Zoltan Kiss
The table and the accessor would be used by ODP-DPDK, when it scans through all the pktio interfaces to flush out TX completed buffers. Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2016-01-22linux-generic: packet_io: separate locks for RX/TXZoltan Kiss
It's possible that two threads want to use the same packet IO in the same time, but one wants RX while the other wants TX. In this case they would block each other unnecessary on the same lock. This could be seen e.g. with odp_l2fwd. Replace that lock with two new ones for each direction. Most callers need both, but send and receive can work with only one. Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-29linux-generic: classification: implements odp_cls_cos_pool_set() apiBalasubramanian Manoharan
Adds support for configuring packet pool to a class-of-service. linux-generic packet parser is enhanced to parse a packet directly from a memory location rather than from odp_packet_t. packet receive code is modified to run packet classifier directly from the stream so that the packet can be allocated from the pool specified by the CoS. Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-22api: pktio: add odp_pktio_print() APIMatias Elo
Add API function for printing implementation specific pktio debug information. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Conflicts: platform/linux-generic/odp_packet_io.c
2015-12-08linux-generic: pktio: configuration functions check that interface is stoppedNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-08linux-generic: pktio: check for pktio_start when started and pktio_stop when ↵Nicolas Morey-Chaisemartin
stopped Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-12-08linux-generic: pktio: check interface mode is compatible before receiving or ↵Nicolas Morey-Chaisemartin
sending Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-11-09linux-generic: check return codes in odp_pktio_term_globalMaxim Uvarov
According to API odp_pktio_close() can be called only for stopped pktio. So in odp_pktio_term_global try to stop it first then call close. Also check all returns codes. https://bugs.linaro.org/show_bug.cgi?id=1854 Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu>
2015-10-22linux-generic: pktio: implement odp_pktio_param_init() APIBill Fischofer
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-22linux-generic: pktio: check pool type is ODP_POOL_PACKETStuart Haslam
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-20linux-generic: pktio: extend maximum devname lengthStuart Haslam
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-16linux-generic: pktio: close all pktio when term is calledNicolas Morey-Chaisemartin
Right now, pktio_term calls term on all pktio type but some pktio might still be be opened. Although the user should probably close its pktio before termintating the application, it is safer to iterate on all pktio and close them in the pktio_term function. Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-08linux-generic: pktio: use ticket lock in pktio_entryMatias Elo
Use ticket locks in pktio entries to prevent threads from being starved. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-and-tested by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-10-08linux-generic: pktio: optimize pktin_deq_multiNicolas Morey-Chaisemartin
This patch fills the buffer list requested by the user before filling the internal pktio queue. Previous behaviour was: * Fetch from queue * If not enough * Read from pktio and put all buffers to the queue. Now: * Fetch from queue * If not enough * Read from pktio * Fill use request as much as possible * If there are buffer left, push them to the queue. On pktio_perf with loop interface, I see ~10% speedup with this patch Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-and-tested-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-09-30linux-generic: pktio: enable classifier only when neededPetri Savolainen
Packet input does not call packet_classifier function when there are no cos (pmr, default cos or l2/l3 table) set for the pktio interface. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-09-08linux-generic: pktio: factor state management into packet_ioNicolas Morey-Chaisemartin
Actual check/changes of the pktio state is now done by the pktio global interface. Each pktio can still implement a start/stop function to do additional actions. Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-09-01linux-generic: queue: implement ordered queuesBill Fischofer
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-08-27linux-generic: schedule pktin_poll: account pktio stop stateMaxim Uvarov
If pktio in state stop return 0, which means no packets was received but that pktio is good to be sheduled next time. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-08-27linux-generic: add pktio_start and pktio_stopMaxim Uvarov
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-29Merge branch 'master' into api-nextMaxim Uvarov
2015-07-28linux-generic: fix logic for calling pktio init and term functionsMaxim Uvarov
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org>
2015-07-28linux-generic: pktio: add global init and term function for pktiosNicolas Morey-Chaisemartin
Each pktio type can now provide an optional init and term function to set and clean itself up. Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-20Merge branch 'master' into api-nextMaxim Uvarov
2015-07-17linux-generic: pktio: remove unused includeNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16Merge branch 'master' into api-nextMaxim Uvarov
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Conflicts: include/odp/api/packet_io.h platform/linux-generic/include/odp_packet_io_internal.h platform/linux-generic/odp_packet_io.c
2015-07-16linux-generic: pktio: move pktio specific init to the appropriate setup functionNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_io: use generic interface for pktio implementationsNicolas Morey-Chaisemartin
Each packet_io type now implements a pktio_if_ops_t structure which serves as the only interface use by odp_packet_io.c. The type of a device is retrieved by calling the pktio_XX open function in order from the global pktio_if_ops struct and by stopping on the first successful order. As a result odp_pktio_type_t has been removed, and implementation can be extended by just adding a new pktio_if_opts_t structure to pktio_if_opts Signed-off-by: Clément Leger <cleger@kalray.eu> Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_io: packet_sock_* self closes on error during setupNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_io: promisc_mode_get methods for all pktio_socksNicolas Morey-Chaisemartin
Add temporarly function definitions to odp_packet_io_internal.h instead of odp_packet_socket.h to obtain pktio_entry_t definition Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_io: promisc_mode_set methods for all pktio_socksNicolas Morey-Chaisemartin
Add temporarly function definitions to odp_packet_io_internal.h instead of odp_packet_socket.h to obtain pktio_entry_t definition Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_io: add mac_addr_get methods for all pktio_socksNicolas Morey-Chaisemartin
Add temporarly function definitions to odp_packet_io_internal.h instead of odp_packet_socket.h to obtain pktio_entry_t definition Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_io: add mtu_get methods for all pktio_socksNicolas Morey-Chaisemartin
Add temporarly function definitions to odp_packet_io_internal.h instead of odp_packet_socket.h to obtain pktio_entry_t definition Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_pool: add method to get promisc modeNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_loop: add method for setting promisc modeNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_loop: add method to close a loopback pktioNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_loop: add method to get mac addressNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_loop: add function get MTUNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: pktio: use prefix instead of suffix for all pktio specific ↵Nicolas Morey-Chaisemartin
functions Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: packet_io: move loopback to another fileNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-07-16linux-generic: pktio: replace linux/if.h by net/if.hNicolas Morey-Chaisemartin
Both linux/if.h and net/if.h were used but they are not necesseraly compatible and it is not possible to include both in the same file. Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Stuart Haslam <stuart.haslam@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-05-18Merge branch 'master' into api-nextMaxim Uvarov
2015-05-14linux-generic: packet: Add lazy parsing supportBill Fischofer
Lazy parsing defers parsing until the results are actually needed. This allows applications that do their own parsing and never reference ODP parse results to avoid the overhead of SW parsing. Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Zoltan Kiss <zoltan.kiss@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-05-08api: packet_io: added odp_pktio_param_tPetri Savolainen
Packet IO interface level parameters are needed e.g. to select input mode. User must select and use one input mode (sched, poll or recv) per pktio interface. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-04-29linux-generic: packet_io: init l2 and l3 cos table spinlocksNicolas Morey-Chaisemartin
Signed-off-by: Nicolas Morey-Chaisemartin <nmorey@kalray.eu> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-04-03linux-generic: pktio: fix SEGV after odp_pktio_inq_remdef()Stuart Haslam
Calling odp_pktio_inq_remdef() causes the pktio's inq_default to be set to ODP_QUEUE_INVALID, but when the scheduler later polls the pktio it fails to check the validity of inq_default and ends up passing a bogus pointer to queue_enq_multi(). Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> Reviewed-by: Ciprian Barbu <ciprian.barbu@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-04-01linux-generic: scheduler: restructured queue and pktio integrationPetri Savolainen
Scheduler runs by polling scheduler priority queues for schedule commands. There are two types of scheduler commands: queue dequeue and packet input poll. Packet input is polled directly when a poll command is received. From schduler point of view, the default packet input queue is like any other queue. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Mike Holmes <mike.holmes@linaro.org> Reviewed-by: Ciprian Barbu <ciprian.barbu@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-03-27linux-generic: pktio check for NULL entryMaxim Uvarov
CID: 85427 https://bugs.linaro.org/show_bug.cgi?id=1175 get_pktio_entry() can return NULL entry then it can be derefenced inside is_free(entry). Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
2015-02-25api: packet_io: replace ssize_t with intPetri Savolainen
ssize_t is a POSIX type. API definition must be pure C (C99). Int is at least 16 bits and can hold any mac address size. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-02-25linux-generic: packet_io: add term_globalYan Sonming
Signed-off-by: Yan Songming <yan.songming@linaro.org> Signed-off-by: Mike Holmes <mike.holmes@linaro.org> Signed-off-by: Robbie King <robking@cisco.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
2015-02-17linux-generic: setup_pktio_entry() null terminate pkio nameMaxim Uvarov
Pktio code uses snprintf instead of strncpy for name copying. https://bugs.linaro.org/show_bug.cgi?id=1055 CID 85426: Buffer not null terminated (BUFFER_SIZE_WARNING) Calling strncpy with a maximum size argument of 16 bytes on destination array "pktio_entry->s.name" of size 16 bytes might leave the destination string unterminated. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Reviewed-by: Mike Holmes <mike.holmes@linaro.org>