aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/af_packet/af_packet.c
AgeCommit message (Collapse)AuthorFilesLines
2022-03-10devices: remove the unused code from af_packetMohsin Kazmi1-3/+0
Type: refactor Change-Id: If180816303909b92c9aa4ff9fd70dc7938a6cfbe Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2022-01-18vnet: distinguish between max_frame_size and MTUDamjan Marion1-4/+6
Type: improvement Change-Id: I3659de6599f402c92e3855e3bf0e5e3388f2bea0 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-01-17interface: improve MTU handlingDamjan Marion1-21/+16
- per hw-interface-class handlers - ethernet set_mtu callback - driver can now refuse MTU change Type: improvement Change-Id: I3d37c9129930ebec7bb70caf4263025413873048 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-01-10interface: refactor interface capabilities code, part 2Damjan Marion1-10/+6
Type: improvement Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: Ie595e69af8657b0ee18a84ac71c5d433108d9ef8
2022-01-07ethernet: new interface registration functionDamjan Marion1-15/+6
Prep for supporting multiple callbacks, optional args, etc. Type: improvement Change-Id: I96244c098712e8213374678623f12527b0e7f387 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-01-05interface: refactor interface capabilities codeDamjan Marion1-5/+3
Make it shorter to type, easier to debug, make adding callbacks in future simpler. Type: improvement Change-Id: I6cdd6375e36da23bd452a7c7273ff42789e94433 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-11-23devices: support build on older kernelsFlorin Coras1-0/+3
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I10af028b5e57b36b8015b02240f1e4e9a42d0898
2021-10-29devices: default mode eth in the apiNathan Skrzypczak1-2/+2
Type: fix https://gerrit.fd.io/r/c/vpp/+/34027 added support for l3 mode, but as the eth_mode constant was set to 1 we did default to l3 mode in the api. This reverts to the original logic. Change-Id: If8b90b300d3868de5233dfa1f33ec975853cba11 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-10-22devices: add support for l3 af_packet interfaceMohsin Kazmi1-26/+43
Type: improvement Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: Ia6b9d4ac55be2216887bfdb99be4021f6a96f166
2021-09-28devices: Add queues params in create_ifNathan Skrzypczak1-37/+40
Type: feature Change-Id: I027ff2c5c905a7ccebd3705a58e35218a94f4880 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-09-07devices: restore regular af-packet tx pathMohammed Hawari1-0/+9
This change restores the af_packet tx path prior in use prior to Change Idf0bdd88990254a614962c2f7bc3e0292ccfd61a but fixes the stalling issue by ensuring that the next tx frame pointer is only incremented when a new tx frame is used. This change also enables the af_packet PACKET_QDISC_BYPASS option, for better performance. Change-Id: I65dde648ed66d21654847a900ceda5a8980ae6ec Type: improvement Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
2021-04-08devices: af_packet - use netlink to get/set mtuAloys Augustin1-12/+6
The /sys filesystem is not always accurate when switching network namespaces. Using netlink should work in more situations. Type: improvement Change-Id: I71611f14319820469ea7794eec5b7c6c70e2be6d Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
2021-03-19interface: add capabilities flagsMohsin Kazmi1-4/+9
Type: improvement This patch adds flags to represent the modern NICs capabilities. Change-Id: I96d38d9ab7eac55974d72795cd100d8337168e1e Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-02-05devices: af-packet gso mtuNathan Skrzypczak1-0/+25
Type: fix Set the GSO flag when buffer length exceeds the linux mtu. Don't listen for mtu changes on linux side for now. This also fixes a TX issue, as we only search for valid frames on tx to the extent of n_left, we might stay stuck. Change-Id: Idf0bdd88990254a614962c2f7bc3e0292ccfd61a Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-01-22devices: adapt af_packet to new rxq frameworkMohammed Hawari1-21/+21
Change-Id: If8077280cef501599f810ad9255efa2a5a451ced Signed-off-by: Mohammed Hawari <mohammed@hawari.fr> Type: improvement
2020-12-14misc: move to new pool_foreach macrosDamjan Marion1-3/+3
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-08interface: shorten vnet_hw_if_rx_modeDamjan Marion1-1/+1
This is part of bigger refactor. Type: refactor Change-Id: I6fc2c0a1e2d217a70952901bcf775b8485bd3c20 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-27ethernet: fix DMAC check and skip unnecessary ones (VPP-1868)John Lo1-1/+1
Fix and optimize DMAC check in ethernet-input node to utilize NIC or driver which support L3 DMAC-filtering mode so that DMAC check can be bypassed safely for interfaces/sub-interfaces in L3 mode. Checking of interface in L3-DMAC-filtering state to avoid DMAC check require the following: a) Fix interface driver init sequence for devices which supports L3 DMAC-filtering to indicate its capability and initialize interface to L3 DMAC-filtering state. b) Fix ethernet_set_flags() function and its associated callback flags_change() functions registered by various drivers in interface infra to provide proper L3 DMAC filtering status. Maintain interface/sub-interface L3 config count so DMAC checks can be bypassed if L3 forwarding is not setup on any main/sub-interfaces. Type: fix Ticket: VPP-1868 Signed-off-by: John Lo <loj@cisco.com> Change-Id: I204d90459c13e9e486cfcba4e64e3d479bc9f2ae
2019-09-12devices: af_packet API cleanupJakub Grajciar1-11/+13
Use consistent API types. - fix af_packet_dump dumping deleted interface Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Ie8d138e30c8c51a2306bb2ad9ac0b7a49d5412bf Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-05-07Fix af_packet issues:jackiechen19851-31/+57
1. Fix af_packet memory leak; 2. Fix close socket twice; 3. Adjust debug log for syscall; 4. Adjust dhcp client output log; Change-Id: I96bfaef16c4fad80c5da0d9ac602f911fee1670d Signed-off-by: jackiechen1985 <xiaobo.chen@tieto.com>
2018-10-23c11 safe string handling supportDave Barach1-3/+3
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
2018-05-29af_packet: Add support for dump interfacesMohsin Kazmi1-0/+25
Change-Id: I8d8ecc80edb7665125ba625a3ce7b30d2dea88f0 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-05-28af-packet: Add support for loggingMohsin Kazmi1-24/+30
Change-Id: I4cc6a20b69cce2aa52768a27c5d455eb098224c8 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-05-28itf: Fix admin up down for AF_PACKET and vhost-userMohsin Kazmi1-4/+41
Change-Id: I84327197d59c72d0d046dd2cb4071bf74af6fc28 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-03-26afpacket: Fix the reply if itf already exitsMohsin Kazmi1-1/+3
Change-Id: I47768ea50140222fec54e97cbaff2049bd3cb599 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-03-14At AF_PACKET socket create, do intf bind before rx ring cfg to avoid ↵Chaoyu Jin1-12/+12
receiving pkts from other interfaces Change-Id: Ie40ee9129edaac717e716b469f4d10f3c29a4932 Signed-off-by: Chaoyu Jin <chjin@cisco.com>
2018-02-06vlib: epoll on worker threadsDamjan Marion1-0/+2
This patch teaches worer threads to sleep and to be waken up by kernel if there is activity on file desctiptors assigned to that thread. It also adds counters to epoll file descriptors and new debug cli 'show unix file'. Change-Id: Iaf67869f4aa88ff5b0a08982e1c08474013107c4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-01-05VPP-1115 Fix a debug log mistake when create AF_PACKET socketzhaoqingling1-1/+1
Change-Id: Id6607adbe5da8ae8472dde8bb442ca5f68f6d84f Signed-off-by: zhaoqingling <zhao.qingling@zte.com.cn>
2017-11-14vnet: af_packet_set_l4_cksum_offload device class checkJakub Grajciar1-0/+3
Change-Id: Ie07b71977c46d2f1e030799a08cc5af0fdc397aa Signed-off-by: Jakub Grajciar <Jakub.Grajciar@pantheon.tech>
2017-10-24Add extern to *_main global variable declarations in header files.Dave Wallace1-0/+2
- Global variables declared in header files without the use of the 'extern' keword will result in multiple instances of the variable to be created by the compiler -- one for each different source file in which the the header file is included. This results in wasted memory allocated in the BSS segments as well as potentially introducing bugs in the application. Change-Id: I6ef1790b60a0bd9dd3994f8510723decf258b0cc Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2017-10-23af_packet: invalid TCP/UDP offload checksum on RX node recalculationJakub Grajciar1-0/+16
Change-Id: I1075e5d2a1b6dfe3a443b40b41b8458a30505680 Signed-off-by: Jakub Grajciar <Jakub.Grajciar@pantheon.tech> Signed-off-by: Jakub.Grajciar@pantheon.tech <Jakub.Grajciar@pantheon.tech>
2017-10-11Revert "VPP-1001 - update AF Packet Driver to for modern kernels"Damjan Marion1-28/+2
Issues observed with specific kernel versions, e.g. stock Ubuntu 16.04 kernel. This reverts commit 3eab064e3fadaf2a6a128f167ad04ca0319b4e17. Change-Id: I24241f3b580df749fc686af3a319011ca035fb5e Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-10-04VPP-1001 - update AF Packet Driver to for modern kernelsAnton Ivanov1-2/+28
1. Add VNET headers support for checksumming - required to operate correctly on any recent Linux 2. Bypass QDISC on transmit - improves performance by ~ 5%. Enabled only if the macro is detected - apparently not present on archaic distributions. This still does not solve all issues with TSO - it can be fixed only by going to tpacket v3 and dynamic rx ring as well as significant changes in the TX (sendmmsg?). Change-Id: Iea14ade12586c0a8da49e6dd1012108a08bc85b3 Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
2017-09-15vppinfra: add clib_mem_vm_ext_alloc functionDamjan Marion1-2/+2
Change-Id: Iff33694fc42cc3bcc73cf1372339053a6365039c Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-09move unix_file_* code to vppinfraDamjan Marion1-6/+6
This will allow us to use this code in client libraries without vlib. Change-Id: I8557b752496841ba588aa36b6082cbe2cd1867fe Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-08vlib: move linux-specific code to vlib/linuxDamjan Marion1-0/+1
Change-Id: Id79d2c2be7a98e15416a537c890a8f2dd6d4464d Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-05-15af_packet: support changing the mtu sizeRay Kinsella1-1/+23
Added support to the af_packet device to change the MTU size. Change-Id: I9c9e1e17323721f3efccf70a10b753e12eef94d5 Signed-off-by: Ray Kinsella <ray.kinsella@intel.com>
2017-05-02Add interface rx mode commands, unify rx mode and placement CLIDamjan Marion1-6/+12
Change-Id: Ib506c3e9d66170f29e3266ad6dc4d32b829befba Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-04-28af_packet: reflect admin device state on hostRay Kinsella1-12/+38
Setting the interface state in VPP on an af_packet device, was not being reflected on the host. This implied the user had to set the device state in VPP and then on the host, in order to put the interface into an 'up' state. This changes makes the device state consisent in VPP and the host. Change-Id: I6dc6aee79503e04576683db937b861337a2b375b Signed-off-by: Ray Kinsella <ray.kinsella@intel.com>
2017-04-10Common device-input interrupt infraDamjan Marion1-2/+5
Change-Id: I23b588eb56a3f5690158449a1f9bc8053cd3d251 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-03-30vppinfra: add spinlock inline functionsDamjan Marion1-5/+1
Change-Id: I86089e9bb604adfc260a111685001be1c897ce53 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-03-20vnet: add device-input threadplacement infraDamjan Marion1-48/+6
This change adds two new debug CLI command: - "show interface placmenet" to display which thread (main or worker) is responsible for processing interface rx queue vpp# show interface placement Thread 0 (vpp_main): node af-packet-input: host-vpp1 queue 0 Thread 1 (vpp_wk_0): node af-packet-input: host-virbr0 queue 0 Thread 2 (vpp_wk_1): node af-packet-input: host-vpp2 queue 0 host-lxcbr0 queue 0 - "set interface placmenet" to assign thread (main or worker) which process specific interface rx queue vpp# set interface placement host-vpp1 queue 0 main Change-Id: Id4dd00cf2b05e10fae2125ac7cb4411b446c5e9c Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-01-19af_packet: multithreading supportMohsin KAZMI1-0/+55
This patch adds multithreading support for af_packet interfaces. Change-Id: Ief5d1117e7ffeaa59dbc2831e583d5d8e8d4fa7a Signed-off-by: Mohsin KAZMI <sykazmi@cisco.com>
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+366
Change-Id: I7b51f88292e057c6443b12224486f2d0c9f8ae23 Signed-off-by: Damjan Marion <damarion@cisco.com>