aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYulong Pei <yulong.pei@intel.com>2023-02-24 07:35:58 +0000
committerYulong Pei <yulong.pei@intel.com>2023-02-24 07:57:38 +0000
commit1fbfcbcb15bc51b7b689df44ae338a1c7db6269c (patch)
tree43994918c4111717c4412c6de77dcb13b501bab8
parentafd47c02032712b98e876f0fe2d7e8725b93d516 (diff)
Fix: detaches the attached XDP/BPF program before af_xdp test run
When call create af_xdp interface api, it will load default xdp program (xsk_def_prog.o) on the NIC interface, the program will be unloaded when call delete af_xdp interface api, but current csit config did not call delete api for af_xdp test cases, that will cause af_xdp test case fails to run on Intel E810 NIC when the interface already have xdp program attached, so this patch is to fix this issue by to detach any attached XDP/BPF program on the interface before af_xdp test case run. Signed-off-by: Yulong Pei <yulong.pei@intel.com> Change-Id: I1a557b4c4a7e88c5715cec771a001df29ac4ae6f Signed-off-by: Yulong Pei <yulong.pei@intel.com>
-rw-r--r--resources/libraries/python/InterfaceUtil.py15
-rw-r--r--resources/libraries/robot/shared/interfaces.robot2
2 files changed, 17 insertions, 0 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index 03e0e69d42..2368ee3362 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -295,6 +295,21 @@ class InterfaceUtil:
exec_cmd_no_error(node, cmd, sudo=True)
@staticmethod
+ def set_interface_xdp_off(node, pf_pcis):
+ """Detaches any currently attached XDP/BPF program from the specified
+ interfaces.
+
+ :param node: Topology node.
+ :param pf_pcis: List of node's interfaces PCI addresses.
+ :type nodes: dict
+ :type pf_pcis: list
+ """
+ for pf_pci in pf_pcis:
+ pf_eth = InterfaceUtil.pci_to_eth(node, pf_pci)
+ cmd = f"ip link set dev {pf_eth} xdp off"
+ exec_cmd_no_error(node, cmd, sudo=True)
+
+ @staticmethod
def set_interface_flow_control(node, pf_pcis, rxf=u"off", txf=u"off"):
"""Set Ethernet flow control for specified interfaces.
diff --git a/resources/libraries/robot/shared/interfaces.robot b/resources/libraries/robot/shared/interfaces.robot
index a2e46ef9c2..6279dd0bd2 100644
--- a/resources/libraries/robot/shared/interfaces.robot
+++ b/resources/libraries/robot/shared/interfaces.robot
@@ -169,6 +169,8 @@
| | FOR | ${dut} | IN | @{duts}
| | | Set Interface State PCI
| | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | state=up
+| | | Set Interface XDP off
+| | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci}
| | | Set Interface Channels
| | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | num_queues=${rxq_count_int}
| | | ... | channel=combined
> * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __included_uri_h__ #define __included_uri_h__ #include <vlib/vlib.h> #include <vnet/vnet.h> #include <svm/svm_fifo_segment.h> #include <vnet/session/session.h> #include <vnet/session/application.h> #include <vnet/session/transport.h> typedef enum _session_api_proto { SESSION_PROTO_TCP, SESSION_PROTO_UDP } session_api_proto_t; typedef struct _vnet_bind_args_t { union { char *uri; struct { transport_endpoint_t tep; session_api_proto_t proto; }; }; u32 api_client_index; u64 *options; session_cb_vft_t *session_cb_vft; /* * Results */ char *segment_name; u32 segment_name_length; u64 server_event_queue_address; u64 handle; } vnet_bind_args_t; typedef struct _vnet_unbind_args_t { union { char *uri; u64 handle; }; u32 api_client_index; } vnet_unbind_args_t; typedef struct _vnet_connect_args { union { char *uri; struct { transport_endpoint_t tep; session_api_proto_t proto; }; }; u32 api_client_index; u32 api_context; u64 *options; session_cb_vft_t *session_cb_vft; /* Used for redirects */ void *mp; } vnet_connect_args_t; typedef struct _vnet_disconnect_args_t { u64 handle; u32 api_client_index; } vnet_disconnect_args_t; /* Bind / connect options */ typedef enum { SESSION_OPTIONS_FLAGS, SESSION_OPTIONS_SEGMENT_SIZE, SESSION_OPTIONS_ADD_SEGMENT_SIZE, SESSION_OPTIONS_RX_FIFO_SIZE, SESSION_OPTIONS_TX_FIFO_SIZE, SESSION_OPTIONS_ACCEPT_COOKIE, SESSION_OPTIONS_N_OPTIONS } session_options_index_t; /** Server can handle delegated connect requests from local clients */ #define SESSION_OPTIONS_FLAGS_USE_FIFO (1<<0) /** Server wants vpp to add segments when out of memory for fifos */ #define SESSION_OPTIONS_FLAGS_ADD_SEGMENT (1<<1) #define VNET_CONNECT_REDIRECTED 123 int vnet_bind_uri (vnet_bind_args_t *); int vnet_unbind_uri (char *uri, u32 api_client_index); int vnet_connect_uri (vnet_connect_args_t * a); int vnet_disconnect_session (u32 client_index, u32 session_index, u32 thread_index); int vnet_bind (vnet_bind_args_t * a); int vnet_connect (vnet_connect_args_t * a); int vnet_unbind (vnet_unbind_args_t * a); int vnet_disconnect (vnet_disconnect_args_t * a); int api_parse_session_handle (u64 handle, u32 * session_index, u32 * thread_index); #endif /* __included_uri_h__ */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */