summaryrefslogtreecommitdiffstats
path: root/src/vnet/bonding
AgeCommit message (Collapse)AuthorFilesLines
2021-06-22bonding: api cleanupFilip Tehlar1-58/+16
Use autogenerated code. Does not change API definitions. Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I1de45c4db57444d2d2c9fb91b8a66a4f01be699b
2021-05-13tests: move test source to vpp/testDave Wallace2-373/+0
- Generate copyright year and version instead of using hard-coded data Type: refactor Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I6058f5025323b3aa483f5df4a2c4371e27b5914e
2021-05-01vlib: refactor trajectory trace debug featureBenoît Ganne2-14/+0
trajectory trace has been broken for a while because we used to save the buffer trajectory in a vector pointed to in opaque2. This does not work well when opaque2 is copied (eg. because of a clone) as 2 buffers end up sharing the same vector. This dedicates a full cacheline in the buffer metadata instead when trajectory is compiled in. No dynamic allocation, no sharing, no tears. Type: refactor Change-Id: I6a028ca1b48d38f393a36979e5e452c2dd48ad3f Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-03-19interface: add capabilities flagsMohsin Kazmi1-3/+4
Type: improvement This patch adds flags to represent the modern NICs capabilities. Change-Id: I96d38d9ab7eac55974d72795cd100d8337168e1e Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2021-03-04bonding: coverity woe in bond_dev_class fuctionSteven Luong1-5/+14
Coverity complans the line h = hashes; uses uninitialized variable if the prior ASSERT statement is hit. ASSERT is compiled out coverity as well as in release image. So the complain is legitimate. Change the ASSERT to drop the frame and log an error instead. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ibf0c204fe3626afca69ea84484e606566cf3244c
2021-01-08tests: move bond tests to src/vnet/bonding/testDave Wallace2-0/+373
- Refactor make test code to be co-located with the vpp feature source code. Type: test Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I056717261553f6449f5fcd3611b6ae3895a00ba6
2020-12-14misc: move to new pool_foreach macrosDamjan Marion1-8/+8
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-11-20ip-neighbor: Use ip_address_t rather than ip46_address_tNeale Ranns1-1/+4
Type: improvement Change-Id: Ica5f395075677bda5f38d28e704f65350af88610 Signed-off-by: Neale Ranns <nranns@cisco.com>
2020-11-13ethernet: mac must support 64-bits loadsBenoît Ganne1-2/+2
ethernet dataplane loads MAC addresses as 64-bits loads for efficiency. We must make sure it is valid, especially for the vector of secondary MACs. Type: fix Change-Id: I851e319b8a973c154e85ff9f05f3b8e385939788 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-11-09vlib: fix trace number accountingBenoît Ganne1-18/+21
When using classifier to filter traces, not all packets will be traced. In that case, we should only count traced packets. Type: fix Change-Id: I87d1e217b580ebff8c6ade7860eb43950420ae78 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-09-02bonding: add bond_create2 API to include gso optionSteven Luong2-4/+75
gso option is available for the debug CLI version of bond create. This patch is to create a new API to have the corresponding option in the binary API. The old binary API bond_create is marked deprecated. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Id9501b8e6d267ae09e2b411957f181343da459c0
2020-08-24bonding: enhance binary api handlingSteven Luong1-0/+9
- check input sw_if_index to make sure it is sane. Coverity actually complains about it. - return rv. Some of the APIs handlers were not passing back the rv. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I8378ea948af561ba2bd9b02fb10bf4f9df2a2cd2
2020-07-28bonding: toggle bond admin state may cause hw link state to downSteven Luong1-1/+1
For bond interface, we set hardware link state to up initially when admin state is set to up. Thereafter, if we toggle the admin state to down and up, we require at least one active member in the bond prior to bringing up the hardware state which is inconsistent. The fix is to remove the unnecessary condition. This is a rework of the original proposed patch which is more complex and could be tricky to get it right https://gerrit.fd.io/r/c/vpp/+/27141 Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I65f4fee55299b5b4d5645f6e05e1be15b46b73cd
2020-07-28bonding lacp: replace slave string with memberSteven Luong6-417/+684
- Replace textual string slave with member except APIs. - For APIs, mark the existing APIs as deprecated and introduce new APIs - While introducing sw_bond_interface_dump, add the optional filter by sw_if_index and enhance the testcases to make use of it. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ib6626c514e45350308aeeda0decb70f3aba2f63e
2020-05-29bonding: Revert adjust link stateMatthew Smith1-20/+3
This reverts commit 9121c415a91904be50071ec55143d9c89b2f1b91. Reason for revert: causes deadlock with multiple worker threads Type: fix Change-Id: Icf3d6d343d99d887abacbaa03acbf04d4628514e Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2020-05-27bonding: adjust link state based on active slavesMatthew Smith1-3/+20
Type: improvement Bond link state is being maintained inconsistently. It is initially set to up. If the bond interface admin state is set to down, the link state is set to down. If the bond interface admin state is set to up, the link state is only set to up if there are active slave interfaces at that point. If slaves become active at some later time, it does not get updated. Its next chance to be updated is the next time the bond interface is set to admin up. To address this, do not set the link state to up after creating a bond. Adjust the link state as slave interfaces are attached or detached based on whether the bond is getting its first active slave or losing its last one. Unit test added to verify correct maintenance of link state. Change-Id: I31f17321f7f0e727e1ab1e01713423af6566dad9 Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2020-05-16l2: L2/L3 mode swicth cleanup and l2-patch fixJohn Lo2-12/+7
Cleanup L2/L3 mode switch to not redirect to/from ethernet-input node as it is no longer necessary. L2 patch should use sw_if_index for device feature enable/disable. Type: fix Signed-off-by: John Lo <loj@cisco.com> Change-Id: I0f24161d027b07c188fd1e05276146f94c075710
2020-05-13bonding: fix the GSO flagsMohsin Kazmi1-2/+8
Type: fix Only add GSO and Checksum offload flags when gso is enabled. Change-Id: I58945a4ffbb9a0e6a8640fc01424c63feef16306 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2020-04-28tests: move defaults from defaultmapping to .api filesPaul Vinciguerra1-2/+2
facilitates use of papi beyond the tests. Type: improvement Change-Id: I3d502d9130b81a7fb65ee69bb06fe55802b28a27 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-04-06bonding: Add GSO supportSteven Luong2-2/+21
Add GSO support, configurable from the CLI. Type: feature Ticket: VPP-1820 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I65885a071b24c74437e6cfe5eff237b01bc1744b (cherry picked from commit a06f68556e506a6ff7f31a617a036614c84f71c0)
2020-02-18misc: fix coverity warningsDave Barach2-4/+4
Type: fix Ticket: VPP-1837 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I402b1b06db736b2a7a242ce70ffd409c7c0a4fc2
2020-01-09bonding: process lacp when bond is admin downMatthew Smith1-1/+0
Type: fix Fixes: 6dfd3785e4 When a bond interface is administratively down but the slaves are up, process inbound LACP packets received over the slaves. This was the old behavior with bond interfaces in LACP mode and was altered unintentionally by another change. Restore the old behavior. Change-Id: I61b0b700211dea4859b6ee447ab83b33197d9d11 Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2020-01-07bonding: fix feature.yaml errorOle Troan1-1/+1
Type: fix Fixes: 6b32b4aad Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I8bd6bb95135dc280565f357aa5850292f66979a1 Signed-off-by: Ole Troan <ot@cisco.com>
2020-01-07bonding: Add FEATURE.yamlSteven Luong1-0/+16
Type: docs Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I53522a60122014741d1c6533a0456bf31445529a
2019-12-17bonding: drop traffic on backup interface for active-backup modeSteven Luong1-1/+12
For active-backup mode, we transmit on one and only one interface. However, we might still receive traffic on the backup interface. We should drop them and strictly process incoming traffic on only the active interface. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Idb6b798b30033e84044b151c616be3c157329731
2019-12-17ip: Protocol Independent IP NeighborsNeale Ranns1-3/+2
Type: feature - ip-neighbour: generic neighbour handling; APIs, DBs, event handling, aging - arp: ARP protocol implementation - ip6-nd; IPv6 neighbor discovery implementation; separate ND, MLD, RA - ip6-link; manage link-local addresses - l2-arp-term; events separated from IP neighbours, since they are not the same. vnet retains just enough education to perform ND/ARP packet construction. arp and ip6-nd to be moved to plugins soon. Change-Id: I88dedd0006b299344f4c7024a0aa5baa6b9a8bbe Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-12-13bonding: Add /if/lacp/<bond-sw_if_index>/<slave-sw_if_index>/partner-stateSteven Luong2-12/+26
We already had /if/lacp/<bond-sw_if_index>/<slave-sw_if_index>/state in the stats segment. Add also the partner-state to be complete. Change to populate stats segment with the states at startup, after processing an lacp pdu, and after timer expiration. Unit test --------- sudo vpp_get_stats dump | grep /if/lacp 63.00 /if/lacp/3/1/state 61.00 /if/lacp/3/1/partner-state 63.00 /if/lacp/3/2/state 61.00 /if/lacp/3/2/partner-state Type: feature Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ib7b8e1183d572bb6e422a846aaa2b7b3559a0dc7
2019-12-10api: multiple connections per processDave Barach1-1/+1
Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I2272521d6e69edcd385ef684af6dd4eea5eaa953
2019-12-02bonding: add/del secondary mac address callbackMatthew Smith2-0/+77
Type: feature Add a callback to the bond device class which allows a secondary mac address to be added/deleted. The desired operation is performed on all the hardware interfaces which belong to the bond interface. This allows virtual MAC addresses to be used on bond interfaces without requiring the hardware interfaces to have promiscuous mode enabled. When a hardware interface is added or removed from a bond, if there are any secondary MAC addresses configured on the bond, they are added or removed from the hardware interface. Change-Id: If9488078b4d7869ecc56ef6853f3cc9891211860 Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2019-11-12bonding: fix non-null terminated vectorBenoît Ganne1-2/+2
Type: fix Change-Id: Iea7d73a304236b525b95bdad3bfdb41e711f8cdb Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-10-24lacp: add actor steady state check prior to skip processing lacp pduSteven Luong2-26/+26
In a rare event, we may be skipping processing lacp pdu's when the it is not in steady state. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I3595d22dbff8a97dce9fb4d4452d2051bcf6f523
2019-10-17bonding: fix interface deletionBenoît Ganne1-15/+7
Copy sw_if_index value instead of using pointers to original bif->slaves content which could be overriden by eg. vec_del1(). Type: feature Change-Id: I37e458effd6b2367479574f7bd3facd4e93bada4 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-10-16bonding: graph node running after bond-input in feature arc may crashSteven Luong1-3/+35
In bond RX quad loop, when all packets within the frame have the same incoming interface, we cannot skip calling bond_update_next because that function calls vnet_feature_next() to update the b->current_config_index. The next node needs the correct b->current_config_index to work with. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I3d8b3d4e0f95490f406fae7638f0c43c301ce664
2019-10-11bonding: feature arc may not be enabled for the slave interfaceSteven Luong1-2/+2
vnet_feature_enable_disable takes sw_if_index, not hw_if_index. If there is a subinterface created prior to the slave interface is created, sw_if_index and hw_if_index start to diverge and the problem will happen. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I11e1f099378832f83b748526c6cbeb56960fad3c
2019-10-06bonding: traffic traversing the wrong interfaceSteven Luong1-0/+1
Missing an increment in the while loop. Hashes not stored in the array. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I603027f5a7305478f48a102ac8035ffde9102c53 (cherry picked from commit 0471cdbd3fe04a88a8b70b5f0eff0c378e19abf7)
2019-09-30bonding: fix non-null-terminated C-stringBenoît Ganne1-2/+8
Type: fix Change-Id: Ibb7ba878b049b8b18e890c43fdd6324cb88d63b8 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-09-24vlib: add flag to explicitelly mark nodes which can init per-node packet traceDamjan Marion1-0/+1
Type: feature Change-Id: I913f08383ee1c24d610c3d2aac07cef402570e2c Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-09-11bonding: API cleanupJakub Grajciar2-31/+54
Use consistent API types. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Idbba4ab6a412b75338e3149e51476693f0862f16 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-09-06bonding: add weight support for active-backup modeSteven Luong4-82/+258
Not all interfaces have the same characteristics within the bonding group. For active-backup mode, we should do our best to select the slave that performs the best as the primary slave. We already did that by preferring the slave that is local numa. Sometimes, this is not enough. For example, when all are local numas, the selection is arbitrary. Some slave interfaces may have higher speed or better qos than the others. But this is hard to infer. One rule does not fit all. So we let the operator to optionally specify the weight for each slave interface. Our primary slave selection rule is now 1. biggest weight 2. is local numa 3. current primary slave (to avoid churn) 4. lowest sw_if_index (for deterministic behavior) This selection rule only applies to active-backup mode which only one slave is used for forwarding traffic until it becomes unreachable. At that time, the next "best" slave candidate is automatically promoted. The slaves are sorted according to the preference rule when they are up. So there is no need to find the next best candidate when the primary slave goes down. Another good thing about this rule is when the down slave comes back up, it is selected as the primary slave again unless there is indeed a "better" slave than this down slave that were added during that period. To set the weight for the slave interface, do this after the interface is enslaved set interface bond <interface-name> weight <value> Type: feature Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I59ced6d20ce1dec532e667dbe1afd1b4243e04f9
2019-09-04stats: add /if/<n>/<n>/state for lacp interface stateSteven Luong2-2/+31
Add /if/lacp/<bond-sw_if_index>/<slave-sw_if_index>/state <bond-sw_if_index> is a vector of the bond sw_if_index <slave-sw_if_index> is a vector of the slave sw_if_index Content is the integer value of the lacp actor state. The state is actually a bitfield as described in the lacp protocol spec. Type: feature Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ic6eca8ce2a1acd2d858e4e50b7eac1d000ea08e5 Signed-off-by: Ole Troan <ot@cisco.com>
2019-08-17bonding lacp: deleting virtual interface which was enslaved may cause crashSteven Luong3-26/+39
Virtual interfaces may be part of the bonding like physical interfaces. The difference is virtual interfaces may disappear dynamically. As an example, the following CLI sequence may crash the debug image create vhost-user socket /tmp/sock1 create bond mode lacp bond add BondEthernet0 VirtualEthernet0/0/0 delete vhost-user VirtualEhernet0/0/0 Notice the virtual interface is deleted without first doing bond delete. The proper order is to first remove the slave interface from the bond prior to deleting the virtual interface as shown below. But we should handle it anyway. create vhost-user socket /tmp/sock1 create bond mode lacp bond add BondEthernet0 VirtualEthernet0/0/0 bond del VirtualEthernet0/0/0 <----- delete vhost-user VirtualEhernet0/0/0 The fix is to register for VNET_SW_INTERFACE_ADD_DEL_FUNCTION and remove the slave interface from the bond if the to-be-deleted interface is part of the bond. We check the interface that it is actually up before we send the lacp pdu. Up means both hw and sw admin up. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: If4d2da074338b16aab0df54e00d719e55c45221a
2019-07-25bonding: incorrect RX counters for bond interfaceSteven Luong2-44/+36
show interface does not display the RX counters for the bond interfaces. It displays rx-no-buf instead. The problem is VNET_INTERFACE_COUNTER_RX is a combined counter, not a simple counter. Change the code to use vlib_increment_combined_counter passing it with n_rx_packets and n_rx_bytes. Type: fix Change-Id: I8121ad7e546447049fa13da62481b6c8f5575bec Signed-off-by: Steven Luong <sluong@cisco.com>
2019-07-24bonding: print the name on the cli when createdMohsin Kazmi1-0/+6
Type: feature Change-Id: Icd718c98ba2fa900cafaf1a59dfb100ee9914ec9 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2019-07-22bonding: fix create bond CLIZhiyong Yang1-1/+1
1. "numa-only" is optional and is disabled by default for lacp mode. 2. update lacp doc. Type: fix Change-Id: I6a3a8423ef31ad9980353a796957693cd6205d73 Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
2019-07-19bonding: add support for numa-only in lacp modeZhiyong Yang5-3/+56
If numa-only is set, Only slaves on local numa node transmit pkts if have at least one, otherwise the bond interface works as usual. CLI change: create bond mode lacp [load-balance { l2 | l23 | l34 } {numa-only}] [hw-addr <mac-address>] [id <if-id>] The new member "u8 numa_only;" is also added to bond_create_if_args_t. Type: feature Change-Id: Icdccedafb0738d8c9d4a5acce909ce562428c071 Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
2019-06-26bonding: fix comment typoZhiyong Yang1-1/+1
Type: style Change-Id: I28908756019f8ca54c50334c470d8eded5621ade Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
2019-05-31bonding: add support for numa awarenessZhiyong Yang2-12/+85
This patch enables bonding numa awareness on multi-socket server working in active-backeup mode. The VPP adds capability for automatically preferring slave with local numa node in order to reduces the load on the QPI-bus and improve system overall performance in multi-socket use cases. Users doesn't need to add any extra operation as usual. Change-Id: Iec267375fc399a9a0c0a7dca649fadb994d36671 Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
2019-05-20bonding: clean up redundant codeZhiyong Yang1-55/+44
1. remove unnecessary cast for void * pointer. 2. remove the unused input parameter. Change-Id: Ic0324364fc0c772200d30fb18a0ba959ed4f7ea4 Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
2019-04-17Revert "Revert "bond: problem switching from l2 to l3""Steven Luong1-0/+11
This reverts commit 5d0d5494db58422eb528c0f8b39a86ea966505e9. The csit crash was actually due to the test image missing the patch https://gerrit.fd.io/r/#/c/17731/ It was a mistake to revert the original patch https://gerrit.fd.io/r/#/c/15577/ Change-Id: I7fc563981aa13d308d55b25194fee21475ebc57d Signed-off-by: Steven Luong <sluong@cisco.com>
2019-04-10API: Fix shared memory only action handlers.Ole Troan1-68/+12
Some API action handlers called vl_msg_ai_send_shmem() directly. That breaks Unix domain socket API transport. A couple (bond / vhost) also tried to send a sw_interface_event directly, but did not send the message to all that had registred interest. That scheme never worked correctly. Refactored and improved the interface event code. Change-Id: Idb90edfd8703c6ae593b36b4eeb4d3ed7da5c808 Signed-off-by: Ole Troan <ot@cisco.com>