Support VFD and DPDK PF + kernel VF on i40e
PATCH v3 9/29 net/i40e: fix VF reset flow
In reply to Qi ZhangAdd missing step during VF reset: PF should set I40E_VFGEN_RSTAT to ACTIVE at end of the VF reset operation or VF driver may not able to detect that reset is already completed. This patch also remove the unnecessary enum for vfr state.
--- drivers/net/i40e/i40e_pf.c | 6 ++++-- drivers/net/i40e/i40e_pf.h | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/net/i40e/i40e_pf.c +4 -2
@@ -139,7 +139,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset) abs_vf_id = vf_id + hw->func_caps.vf_base_id;/* Notify VF that we are in VFR progress */ -I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_PF_VFR_INPROGRESS ); +I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_VFR_INPROGRESS );/* * If require a SW VF reset, a VFLR interrupt will be generated,
@@ -220,7 +220,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset) }/* Reset done, Set COMPLETE flag and clear reset bit */ -I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_PF_VFR_COMPLETED ); +I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_VFR_COMPLETED ); val =I40E_READ_REG (hw,I40E_VPGEN_VFRTRIG (vf_id)); val &= ~I40E_VPGEN_VFRTRIG_VFSWR_MASK ;I40E_WRITE_REG (hw,I40E_VPGEN_VFRTRIG (vf_id), val);
@@ -248,6 +248,8 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)return -EFAULT ; } +I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_VFR_VFACTIVE ); +return ret; }
drivers/net/i40e/i40e_pf.h +0 -5
@@ -48,11 +48,6 @@#define I40E_DPDK_OFFSET 0x100 -enum i40e_pf_vfr_state { -I40E_PF_VFR_INPROGRESS =0 , -I40E_PF_VFR_COMPLETED =1 , -}; -/* DPDK pf driver specific command to VF */ enum i40e_virtchnl_ops_dpdk {/*
Signature · 1 line
2.7.4
PATCH v3 12/29 net/i40e: fix VF MAC address assignment
In reply to Qi ZhangFrom: Ferruh Yigit <[email protected]>
If PF sets vf->mac_addr, in VF initialization hw->mac.addr will be set to that same value. It is possible to check if PF set a MAC address or not through the hw->mac.addr variable.
hw->mac.addr set by i40e_vf_parse_hw_config(), call stack is:
In PF sidei40e_pf_host_process_cmd_get_vf_resources()
eth_addr_copy(vf->mac_addr, vf_res->vsi_res[0].default_mac_address)
In VF sisei40evf_init_vf()
i40evf_get_vf_resources()
i40e_vf_parse_hw_config()
memcpy(hw->mac.addr, vsi_res->default_mac_addr)Updated code is after i40evf_get_vf_resources() and can benefit from hw->mac.addr variable.
--- drivers/net/i40e/i40e_ethdev_vf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +2 -6
@@ -1193,7 +1193,6 @@ i40evf_init_vf(struct rte_eth_dev *dev)int i, err, bufsz;struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct i40e_vf *vf =I40EVF_DEV_PRIVATE_TO_VF (dev->data->dev_private); -struct ether_addr *p_mac_addr;uint16_t interval =i40e_calc_itr_interval (I40E_QUEUE_ITR_INTERVAL_MAX );
@@ -1270,13 +1269,10 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter =I40E_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private);/* Store the MAC address configured by host, or generate random one */ - p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr); -if (is_valid_assigned_ether_addr (p_mac_addr)) {/* Configured by host */ -ether_addr_copy (p_mac_addr, (struct ether_addr *)hw->mac.addr); +if (is_valid_assigned_ether_addr ((struct ether_addr *)hw->mac.addr)) vf->flags |=I40E_FLAG_VF_MAC_BY_PF ; - }else { +else eth_random_addr (hw->mac.addr);/* Generate a random one */ - }/* If the PF host is not DPDK, set the interval of ITR0 to max*/ if (vf->version_major !=I40E_DPDK_VERSION_MAJOR ) {
Signature · 1 line
2.7.4
v3 cover Support VFD and DPDK PF + kernel VF on i40e
1, VF Daemon (VFD)
VFD is an idea to control all the VFs from PF.
As we need to support the scenario kernel PF + DPDK VF,
DPDK follows the interface between kernel PF + kernel VF.
We don't want to introduce too many new messages between PF and VF.
So this patch set adds some new APIs to control VFs directly from PF.
The new APIs include,
1) set VF MAC anti-spoofing
2) set VF VLAN anti-spoofing
3) set TX loopback
4) set VF unicast promiscuous mode
5) set VF multicast promiscuous mode
6) set VF MTU
7) get/reset VF stats
8) set VF MAC address
9) set VF VLAN stripping
10) VF VLAN insertion
12) set VF broadcast mode
12) set VF VLAN tag
13) set VF VLAN filter
VFD also includes VF to PF mailbox message management by APP.
When PF receives mailbox messages from VF, PF should call the callback provided by APP to know if they're permitted to be processed.
2, Implement VF MAC address setting on VF.
3, Support the scenario DPDK PF + kernel VF.
v3:
- fix issue that VF does not work for i40e
- remove patch for VDMq receive mode init
- move get/reset VF stats API into rte_pmd_i40
v2:
- fix the compile issues.
- fix the checkpatch warning and typo.
- update the commit log of some patches.
- fix the invalid port ID issue of testpmd.
Bernard Iremonger (7):
net/i40e: add set VF VLAN insert function net/i40e: set VF broadcast mode from PF net/i40e: set VF VLAN tag from PF
net/i40e: set VF VLAN filter from PF app/testpmd: add command to test VF broadcast mode on i40e app/testpmd: add command to test VF VLAN tag on i40e app/testpmd: handle i40e in VF VLAN filter command
Chen Jing D(Mark) (6):
net/i40e: add VF VLAN strip func
net/i40e: change version number to support Linux VF net/i40e: return correct vsi_id
net/i40e: parse more VF parameter and configure net/i40e: support Linux VF to configure IRQ link list net/i40e: enhance in sanity check of MAC
Ferruh Yigit (3):
net/i40e: set VF MAC from PF support
net/i40e: set VF MAC from VF support
net/i40e: fix VF MAC address assignment
Qi Zhang (3):
net/i40e: enable VF MTU change
net/i40e: fix VF reset flow
net/i40e: set/clear VF stats from PF
Wenzhuo Lu (10):
net/i40e: support link status notification net/i40e: add callback to user on VF to PF mbox msg net/i40e: set VF MAC anti-spoofing from PF net/i40e: set VF VLAN anti-spoofing from PF net/i40e: set Tx loopback from PF
net/i40e: set VF unicast promisc mode from PF net/i40e: set VF multicast promisc mode from PF app/testpmd: use VFD APIs on i40e app/testpmd: use unicast promiscuous mode on i40e app/testpmd: use multicast promiscuous mode on i40e
app/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 473 +++++++++++++++- app/test-pmd/config.c | 17 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 32 ++ drivers/net/i40e/Makefile | 4 +- drivers/net/i40e/i40e_ethdev.c | 847 +++++++++++++++++++++++++++- drivers/net/i40e/i40e_ethdev.h | 5 +- drivers/net/i40e/i40e_ethdev_vf.c | 82 ++- drivers/net/i40e/i40e_pf.c | 417 ++++++++++++-- drivers/net/i40e/i40e_pf.h | 9 +- drivers/net/i40e/rte_pmd_i40e.h | 328 +++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 20 + 12 files changed, 2129 insertions(+), 107 deletions(-) create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
Signature · 1 line
2.7.4
PATCH v3 1/29 net/i40e: support link status notification
From: Wenzhuo Lu <[email protected]>
Add an API to expose the ability, that PF can notify VF when link status changes, to APP.
So if PF APP doesn't want to enable interruption but check link status by itself, PF APP can let VF know link status changed.
--- drivers/net/i40e/Makefile | 4 ++- drivers/net/i40e/i40e_ethdev.c | 28 +++++++++++++++ drivers/net/i40e/i40e_pf.c | 4 +-- drivers/net/i40e/i40e_pf.h | 4 ++- drivers/net/i40e/rte_pmd_i40e.h | 58 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 ++++ 6 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
drivers/net/i40e/Makefile +3 -1
@@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without
@@ -111,6 +111,8 @@ ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),) CFLAGS_i40e_rxtx_vec_sse.o += -msse4.1 endif +# install this header file +SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
drivers/net/i40e/i40e_ethdev.c +28 -0
@@ -62,6 +62,7 @@#include "i40e_rxtx.h" #include "i40e_pf.h" #include "i40e_regs.h" +#include "rte_pmd_i40e.h" #define ETH_I40E_FLOATING_VEB_ARG "enable_floating_veb"#define ETH_I40E_FLOATING_VEB_LIST_ARG "floating_veb_list"
@@ -9695,3 +9696,30 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)return ret; } + +int +rte_pmd_i40e_ping_vfs (uint8_t port,uint16_t vf) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + +i40e_notify_vf_link_status (dev, &pf->vfs[vf]); + +return 0 ; +}
drivers/net/i40e/i40e_pf.c +2 -2
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -897,7 +897,7 @@ i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,return ret; } -static void +void i40e_notify_vf_link_status (struct rte_eth_dev *dev,struct i40e_pf_vf *vf) {struct i40e_virtchnl_pf_event event;
drivers/net/i40e/i40e_pf.h +3 -1
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -123,5 +123,7 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev, uint8_t *msg, uint16_t msglen);int i40e_pf_host_init (struct rte_eth_dev *dev);int i40e_pf_host_uninit (struct rte_eth_dev *dev); +void i40e_notify_vf_link_status (struct rte_eth_dev *dev, +struct i40e_pf_vf *vf);#endif /* _I40E_PF_H_ */
drivers/net/i40e/rte_pmd_i40e.h new file +58 -0
58 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +6 -0
@@ -2,3 +2,9 @@ DPDK_2.0 { local: *; }; + +DPDK_17.02 { + global: + + rte_pmd_i40e_ping_vfs; +} DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 2/29 net/i40e: add callback to user on VF to PF mbox msg
In reply to Qi ZhangFrom: Wenzhuo Lu <[email protected]>
The callback asks the user application if it is allowed to perform the mailbox messages.
If the return value from user is RTE_PMD_I40E_MB_EVENT_PROCEED then continue. If ACK or NACK, do nothing and send not_supported to VF.
--- drivers/net/i40e/i40e_pf.c | 230 ++++++++++++++++++++++++++++++++++------ drivers/net/i40e/rte_pmd_i40e.h | 21 ++++ 2 files changed, 216 insertions(+), 35 deletions(-)
drivers/net/i40e/i40e_pf.c +195 -35
@@ -55,6 +55,7 @@#include "i40e_ethdev.h" #include "i40e_rxtx.h" #include "i40e_pf.h" +#include "rte_pmd_i40e.h" #define I40E_CFG_CRCSTRIP_DEFAULT 1
@@ -272,14 +273,23 @@ i40e_pf_host_send_msg_to_vf(struct i40e_pf_vf *vf, }static void -i40e_pf_host_process_cmd_version (struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_version (struct i40e_pf_vf *vf,bool b_op) {struct i40e_virtchnl_version_info info; info.major =I40E_DPDK_VERSION_MAJOR ; info.minor =I40E_DPDK_VERSION_MINOR ; -i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_VERSION , -I40E_SUCCESS , (uint8_t *)&info,sizeof (info)); + +if (b_op) +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_VERSION , +I40E_SUCCESS , + (uint8_t *)&info, +sizeof (info)); +else +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_VERSION , +I40E_NOT_SUPPORTED , + (uint8_t *)&info, +sizeof (info)); } static int
@@ -292,13 +302,20 @@ i40e_pf_host_process_cmd_reset_vf(struct i40e_pf_vf *vf) }static int -i40e_pf_host_process_cmd_get_vf_resource (struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_get_vf_resource (struct i40e_pf_vf *vf,bool b_op) {struct i40e_virtchnl_vf_resource *vf_res =NULL ;struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);uint32_t len =0 ;int ret =I40E_SUCCESS ; +if (!b_op) { +i40e_pf_host_send_msg_to_vf (vf, +I40E_VIRTCHNL_OP_GET_VF_RESOURCES , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +/* only have 1 VSI by default */ len =sizeof (struct i40e_virtchnl_vf_resource ) + I40E_DEFAULT_VF_VSI_NUM *
@@ -423,7 +440,8 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,static int i40e_pf_host_process_cmd_config_vsi_queues (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);struct i40e_vsi *vsi = vf->vsi;
@@ -432,6 +450,13 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,struct i40e_virtchnl_queue_pair_info *vc_qpi;int i, ret =I40E_SUCCESS ; +if (!b_op) { +i40e_pf_host_send_msg_to_vf (vf, +I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (!msg || vc_vqci->num_queue_pairs > vsi->nb_qps || vc_vqci->num_queue_pairs >I40E_MAX_VSI_QP || msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqci,
@@ -482,7 +507,8 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_config_vsi_queues_ext (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);struct i40e_vsi *vsi = vf->vsi;
@@ -491,6 +517,14 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,struct i40e_virtchnl_queue_pair_ext_info *vc_qpei;int i, ret =I40E_SUCCESS ; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (!msg || vc_vqcei->num_queue_pairs > vsi->nb_qps || vc_vqcei->num_queue_pairs >I40E_MAX_VSI_QP || msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqcei,
@@ -539,12 +573,21 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_config_irq_map (struct i40e_pf_vf *vf, -uint8_t *msg,uint16_t msglen) +uint8_t *msg,uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ;struct i40e_virtchnl_irq_map_info *irqmap = (struct i40e_virtchnl_irq_map_info *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <sizeof (struct i40e_virtchnl_irq_map_info )) {PMD_DRV_LOG (ERR ,"buffer too short" ); ret =I40E_ERR_PARAM ;
@@ -646,12 +689,21 @@ i40e_pf_host_process_cmd_enable_queues(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_disable_queues (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ;struct i40e_virtchnl_queue_select *q_sel = (struct i40e_virtchnl_queue_select *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_DISABLE_QUEUES , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*q_sel)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -669,7 +721,8 @@ i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_add_ether_address (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -678,6 +731,14 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,int i;struct ether_addr *mac; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +memset (&filter,0 ,sizeof (struct i40e_mac_filter_info ));if (msg ==NULL || msglen <=sizeof (*addr_list)) {
@@ -707,7 +768,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_del_ether_address (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -715,6 +777,14 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,int i;struct ether_addr *mac; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <=sizeof (*addr_list)) {PMD_DRV_LOG (ERR ,"delete_ether_address argument too short" ); ret =I40E_ERR_PARAM ;
@@ -739,7 +809,8 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_add_vlan (struct i40e_pf_vf *vf, -uint8_t *msg,uint16_t msglen) +uint8_t *msg,uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -747,6 +818,14 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,int i;uint16_t *vid; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_ADD_VLAN , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <=sizeof (*vlan_filter_list)) {PMD_DRV_LOG (ERR ,"add_vlan argument too short" ); ret =I40E_ERR_PARAM ;
@@ -771,7 +850,8 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_del_vlan (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -779,6 +859,14 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,int i;uint16_t *vid; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_DEL_VLAN , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <=sizeof (*vlan_filter_list)) {PMD_DRV_LOG (ERR ,"delete_vlan argument too short" ); ret =I40E_ERR_PARAM ;
@@ -803,7 +891,8 @@ static inti40e_pf_host_process_cmd_config_promisc_mode ( struct i40e_pf_vf *vf, uint8_t *msg, - uint16_t msglen) + uint16_t msglen, + bool b_op) { int ret = I40E_SUCCESS; struct i40e_virtchnl_promisc_info *promisc =
@@ -811,6 +900,14 @@ i40e_pf_host_process_cmd_config_promisc_mode(struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);bool unicast = FALSE, multicast = FALSE; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*promisc)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -836,13 +933,20 @@ i40e_pf_host_process_cmd_config_promisc_mode( }static int -i40e_pf_host_process_cmd_get_stats (struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_get_stats (struct i40e_pf_vf *vf,bool b_op) {i40e_update_vsi_stats (vf->vsi); -i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_GET_STATS , -I40E_SUCCESS , (uint8_t *)&vf->vsi->eth_stats, -sizeof (vf->vsi->eth_stats)); +if (b_op) +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_GET_STATS , +I40E_SUCCESS , + (uint8_t *)&vf->vsi->eth_stats, +sizeof (vf->vsi->eth_stats)); +else +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_GET_STATS , +I40E_NOT_SUPPORTED , + (uint8_t *)&vf->vsi->eth_stats, +sizeof (vf->vsi->eth_stats));return I40E_SUCCESS ; }
@@ -851,12 +955,21 @@ static inti40e_pf_host_process_cmd_cfg_vlan_offload ( struct i40e_pf_vf *vf, uint8_t *msg, - uint16_t msglen) + uint16_t msglen, + bool b_op) { int ret = I40E_SUCCESS;struct i40e_virtchnl_vlan_offload_info *offload = (struct i40e_virtchnl_vlan_offload_info *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*offload)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -877,12 +990,21 @@ i40e_pf_host_process_cmd_cfg_vlan_offload(static int i40e_pf_host_process_cmd_cfg_pvid (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ;struct i40e_virtchnl_pvid_info *tpid_info = (struct i40e_virtchnl_pvid_info *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CFG_VLAN_PVID , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*tpid_info)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -923,6 +1045,8 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,struct i40e_pf_vf *vf;/* AdminQ will pass absolute VF id, transfer to internal vf id */ uint16_t vf_id = abs_vf_id - hw->func_caps.vf_base_id; +struct rte_pmd_i40e_mb_event_param cb_param; +bool b_op = TRUE;if (vf_id > pf->vf_num -1 || !pf->vfs) {PMD_DRV_LOG (ERR ,"invalid argument" );
@@ -937,10 +1061,35 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,return ; } +/** +* initialise structure to send to user application +* will return response from user in retval field +*/ + cb_param.retval =RTE_PMD_I40E_MB_EVENT_PROCEED ; + cb_param.vfid = vf_id; + cb_param.msg_type = opcode; + cb_param.msg = (void *)msg; + cb_param.msglen = msglen; + +/** +* Ask user application if we're allowed to perform those functions. +* If we get cb_param.retval == RTE_PMD_I40E_MB_EVENT_PROCEED, +* then business as usual. +* If RTE_PMD_I40E_MB_EVENT_NOOP_ACK or RTE_PMD_I40E_MB_EVENT_NOOP_NACK, +* do nothing and send not_supported to VF. As PF must send a response +* to VF and ACK/NACK is not defined. +*/ +_rte_eth_dev_callback_process (dev,RTE_ETH_EVENT_VF_MBOX , &cb_param); +if (cb_param.retval !=RTE_PMD_I40E_MB_EVENT_PROCEED ) { +PMD_DRV_LOG (WARNING ,"VF to PF message(%d) is not permitted!" , + opcode); + b_op = FALSE; + } +switch (opcode) {case I40E_VIRTCHNL_OP_VERSION :PMD_DRV_LOG (INFO ,"OP_VERSION received" ); -i40e_pf_host_process_cmd_version (vf); +i40e_pf_host_process_cmd_version (vf, b_op);break ;case I40E_VIRTCHNL_OP_RESET_VF :PMD_DRV_LOG (INFO ,"OP_RESET_VF received" );
@@ -948,61 +1097,72 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,break ;case I40E_VIRTCHNL_OP_GET_VF_RESOURCES :PMD_DRV_LOG (INFO ,"OP_GET_VF_RESOURCES received" ); -i40e_pf_host_process_cmd_get_vf_resource (vf); +i40e_pf_host_process_cmd_get_vf_resource (vf, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES :PMD_DRV_LOG (INFO ,"OP_CONFIG_VSI_QUEUES received" ); -i40e_pf_host_process_cmd_config_vsi_queues (vf, msg, msglen); +i40e_pf_host_process_cmd_config_vsi_queues (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT :PMD_DRV_LOG (INFO ,"OP_CONFIG_VSI_QUEUES_EXT received" );i40e_pf_host_process_cmd_config_vsi_queues_ext (vf, msg, - msglen); + msglen, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP :PMD_DRV_LOG (INFO ,"OP_CONFIG_IRQ_MAP received" ); -i40e_pf_host_process_cmd_config_irq_map (vf, msg, msglen); +i40e_pf_host_process_cmd_config_irq_map (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_ENABLE_QUEUES :PMD_DRV_LOG (INFO ,"OP_ENABLE_QUEUES received" ); -i40e_pf_host_process_cmd_enable_queues (vf, msg, msglen); -i40e_notify_vf_link_status (dev, vf); +if (b_op) { +i40e_pf_host_process_cmd_enable_queues (vf, msg, msglen); +i40e_notify_vf_link_status (dev, vf); + }else { +i40e_pf_host_send_msg_to_vf ( + vf,I40E_VIRTCHNL_OP_ENABLE_QUEUES , +I40E_NOT_SUPPORTED ,NULL ,0 ); + }break ;case I40E_VIRTCHNL_OP_DISABLE_QUEUES :PMD_DRV_LOG (INFO ,"OP_DISABLE_QUEUE received" ); -i40e_pf_host_process_cmd_disable_queues (vf, msg, msglen); +i40e_pf_host_process_cmd_disable_queues (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS :PMD_DRV_LOG (INFO ,"OP_ADD_ETHER_ADDRESS received" ); -i40e_pf_host_process_cmd_add_ether_address (vf, msg, msglen); +i40e_pf_host_process_cmd_add_ether_address (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS :PMD_DRV_LOG (INFO ,"OP_DEL_ETHER_ADDRESS received" ); -i40e_pf_host_process_cmd_del_ether_address (vf, msg, msglen); +i40e_pf_host_process_cmd_del_ether_address (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_ADD_VLAN :PMD_DRV_LOG (INFO ,"OP_ADD_VLAN received" ); -i40e_pf_host_process_cmd_add_vlan (vf, msg, msglen); +i40e_pf_host_process_cmd_add_vlan (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_DEL_VLAN :PMD_DRV_LOG (INFO ,"OP_DEL_VLAN received" ); -i40e_pf_host_process_cmd_del_vlan (vf, msg, msglen); +i40e_pf_host_process_cmd_del_vlan (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE :PMD_DRV_LOG (INFO ,"OP_CONFIG_PROMISCUOUS_MODE received" ); -i40e_pf_host_process_cmd_config_promisc_mode (vf, msg, msglen); +i40e_pf_host_process_cmd_config_promisc_mode (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_GET_STATS :PMD_DRV_LOG (INFO ,"OP_GET_STATS received" ); -i40e_pf_host_process_cmd_get_stats (vf); +i40e_pf_host_process_cmd_get_stats (vf, b_op);break ;case I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD :PMD_DRV_LOG (INFO ,"OP_CFG_VLAN_OFFLOAD received" ); -i40e_pf_host_process_cmd_cfg_vlan_offload (vf, msg, msglen); +i40e_pf_host_process_cmd_cfg_vlan_offload (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_CFG_VLAN_PVID :PMD_DRV_LOG (INFO ,"OP_CFG_VLAN_PVID received" ); -i40e_pf_host_process_cmd_cfg_pvid (vf, msg, msglen); +i40e_pf_host_process_cmd_cfg_pvid (vf, msg, msglen, b_op);break ;/* Don't add command supported below, which will * return an error code.
drivers/net/i40e/rte_pmd_i40e.h +21 -0
@@ -42,6 +42,27 @@#include <rte_ethdev.h> /** +* Response sent back to i40e driver from user app after callback +*/ +enum rte_pmd_i40e_mb_event_rsp { +RTE_PMD_I40E_MB_EVENT_NOOP_ACK ,/**< skip mbox request and ACK */ +RTE_PMD_I40E_MB_EVENT_NOOP_NACK ,/**< skip mbox request and NACK */ +RTE_PMD_I40E_MB_EVENT_PROCEED ,/**< proceed with mbox request */ +RTE_PMD_I40E_MB_EVENT_MAX /**< max value of this enum */ +}; + +/** +* Data sent to the user application when the callback is executed. +*/ +struct rte_pmd_i40e_mb_event_param { +uint16_t vfid;/**< Virtual Function number */ +uint16_t msg_type;/**< VF to PF message type, see i40e_virtchnl_ops */ +uint16_t retval;/**< return value */ +void *msg;/**< pointer to message */ +uint16_t msglen;/**< length of the message */ +}; + +/** * Notify VF when PF link status changes. * * @param port
Signature · 1 line
2.7.4
PATCH v3 3/29 net/i40e: set VF MAC anti-spoofing from PF
In reply to Qi ZhangFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF MAC anti-spoofing from PF.
User can call the API on PF to enable/disable a specific VF's MAC anti-spoofing.
--- drivers/net/i40e/i40e_ethdev.c | 63 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 83 insertions(+)
drivers/net/i40e/i40e_ethdev.c +63 -0
@@ -9723,3 +9723,66 @@ rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)return 0 ; } + +int +rte_pmd_i40e_set_vf_mac_anti_spoof (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +struct i40e_hw *hw; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + +/* Check if it has been already on or off */ +if (vsi->info.valid_sections & +rte_cpu_to_le_16 (I40E_AQ_VSI_PROP_SECURITY_VALID )) { +if (on) { +if ((vsi->info.sec_flags & +I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ) == +I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ) +return 0 ;/* already on */ + }else { +if ((vsi->info.sec_flags & +I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ) ==0 ) +return 0 ;/* already off */ + } + } + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_SECURITY_VALID ); +if (on) + vsi->info.sec_flags |=I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ; +else + vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -76,4 +76,23 @@ struct rte_pmd_i40e_mb_event_param {*/ int rte_pmd_i40e_ping_vfs (uint8_t port,uint16_t vf); +/** +* Enable/Disable VF MAC anti spoofing. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set MAC anti spoofing. +* @param on +* 1 - Enable VFs MAC anti spoofing. +* 0 - Disable VFs MAC anti spoofing. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_mac_anti_spoof (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -7,4 +7,5 @@ DPDK_17.02 { global: rte_pmd_i40e_ping_vfs; + rte_pmd_i40e_set_vf_mac_anti_spoof; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 4/29 net/i40e: set VF VLAN anti-spoofing from PF
In reply to Qi ZhangFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF VLAN anti-spoofing from PF.
User can call the API on PF to enable/disable a specific VF's VLAN anti-spoofing.
--- drivers/net/i40e/i40e_ethdev.c | 116 +++++++++++++++++++++++++++++- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/rte_pmd_i40e.h | 19 +++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 4 files changed, 135 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +114 -2
@@ -4418,6 +4418,7 @@ i40e_vsi_setup(struct i40e_pf *pf, vsi->max_macaddrs =I40E_NUM_MACADDR_MAX ; vsi->parent_vsi = uplink_vsi ? uplink_vsi : pf->main_vsi; vsi->user_param = user_param; + vsi->vlan_anti_spoof_on =0 ;/* Allocate queues */ switch (vsi->type) {case I40E_VSI_MAIN :
@@ -5761,17 +5762,35 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, uint16_t vlan_id, bool on) { uint32_t vid_idx, vid_bit; +struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0 }; +int ret;if (vlan_id >ETH_VLAN_ID_MAX )return ; vid_idx =I40E_VFTA_IDX (vlan_id); vid_bit =I40E_VFTA_BIT (vlan_id); + vlan_data.vlan_tag =rte_cpu_to_le_16 (vlan_id); -if (on) +if (on) { +if (vsi->vlan_anti_spoof_on) { + ret =i40e_aq_add_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to add vlan filter" ); + } vsi->vfta[vid_idx] |= vid_bit; -else + }else { +if (vsi->vlan_anti_spoof_on) { + ret =i40e_aq_remove_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR , +"Failed to remove vlan filter" ); + } vsi->vfta[vid_idx] &= ~vid_bit; + } }/**
@@ -9786,3 +9805,96 @@ rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +static int +i40e_add_rm_all_vlan_filter (struct i40e_vsi *vsi,uint8_t add) +{ +uint32_t j, k; +uint16_t vlan_id; +struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0 }; +int ret; + +for (j =0 ; j <I40E_VFTA_SIZE ; j++) { +if (!vsi->vfta[j]) +continue ; + +for (k =0 ; k <I40E_UINT32_BIT_SIZE ; k++) { +if (!(vsi->vfta[j] & (1 << k))) +continue ; + + vlan_id = j *I40E_UINT32_BIT_SIZE + k; + vlan_data.vlan_tag =rte_cpu_to_le_16 (vlan_id); +if (add) + ret =i40e_aq_add_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +else + ret =i40e_aq_remove_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +if (ret !=I40E_SUCCESS ) { +PMD_DRV_LOG (ERR , +"Failed to add/rm vlan filter" ); +return ret; + } + } + } + +return I40E_SUCCESS ; +} + +int +rte_pmd_i40e_set_vf_vlan_anti_spoof (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +struct i40e_hw *hw; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + +/* Check if it has been already on or off */ +if (vsi->vlan_anti_spoof_on == on) +return 0 ;/* already on or off */ + + vsi->vlan_anti_spoof_on = on; + ret =i40e_add_rm_all_vlan_filter (vsi, on); +if (ret) +return ret; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_SECURITY_VALID ); +if (on) + vsi->info.sec_flags |=I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK ; +else + vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK ; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -300,6 +300,7 @@ struct i40e_vsi {uint16_t msix_intr;/* The MSIX interrupt binds to VSI */ uint16_t nb_msix;/* The max number of msix vector */ uint8_t enabled_tc;/* The traffic class enabled */ +uint8_t vlan_anti_spoof_on;/* The VLAN anti-spoofing enabled */ struct i40e_bw_info bw_info;/* VSI bandwidth information */ };
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -95,4 +95,23 @@ int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Enable/Disable VF VLAN anti spoofing. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set VLAN anti spoofing. +* @param on +* 1 - Enable VFs VLAN anti spoofing. +* 0 - Disable VFs VLAN anti spoofing. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_vlan_anti_spoof (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -8,4 +8,5 @@ DPDK_17.02 { rte_pmd_i40e_ping_vfs; rte_pmd_i40e_set_vf_mac_anti_spoof; + rte_pmd_i40e_set_vf_vlan_anti_spoof; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 5/29 net/i40e: set Tx loopback from PF
In reply to Qi ZhangFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling TX loopback from PF. User can call the API on PF to enable/disable TX loopback for all the PF and VFs.
--- drivers/net/i40e/i40e_ethdev.c | 219 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 16 +++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 236 insertions(+)
drivers/net/i40e/i40e_ethdev.c +219 -0
@@ -9898,3 +9898,222 @@ rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +static int +i40e_vsi_rm_mac_filter (struct i40e_vsi *vsi) +{ +struct i40e_mac_filter *f; +struct i40e_macvlan_filter *mv_f; +int i, vlan_num; +enum rte_mac_filter_type filter_type; +int ret =I40E_SUCCESS ; + +/* remove all the MACs */ + TAILQ_FOREACH(f, &vsi->mac_list, next) { + vlan_num = vsi->vlan_num; + filter_type = f->mac_info.filter_type; +if (filter_type ==RTE_MACVLAN_PERFECT_MATCH || + filter_type ==RTE_MACVLAN_HASH_MATCH ) { +if (vlan_num ==0 ) { +PMD_DRV_LOG (ERR , +"VLAN number shouldn't be 0\n" ); +return I40E_ERR_PARAM ; + } + }else if (filter_type ==RTE_MAC_PERFECT_MATCH || + filter_type ==RTE_MAC_HASH_MATCH ) + vlan_num =1 ; + + mv_f =rte_zmalloc ("macvlan_data" , vlan_num *sizeof (*mv_f),0 ); +if (!mv_f) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return I40E_ERR_NO_MEMORY ; + } + +for (i =0 ; i < vlan_num; i++) { + mv_f[i].filter_type = filter_type; + (void )rte_memcpy (&mv_f[i].macaddr, + &f->mac_info.mac_addr, +ETH_ADDR_LEN ); + } +if (filter_type ==RTE_MACVLAN_PERFECT_MATCH || + filter_type ==RTE_MACVLAN_HASH_MATCH ) { + ret =i40e_find_all_vlan_for_mac (vsi, mv_f, vlan_num, + &f->mac_info.mac_addr); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + } + + ret =i40e_remove_macvlan_filters (vsi, mv_f, vlan_num); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + +rte_free (mv_f); + ret =I40E_SUCCESS ; + } + +return ret; +} + +static int +i40e_vsi_restore_mac_filter (struct i40e_vsi *vsi) +{ +struct i40e_mac_filter *f; +struct i40e_macvlan_filter *mv_f; +int i, vlan_num =0 ; +int ret =I40E_SUCCESS ; + +/* restore all the MACs */ + TAILQ_FOREACH(f, &vsi->mac_list, next) { +if ((f->mac_info.filter_type ==RTE_MACVLAN_PERFECT_MATCH ) || + (f->mac_info.filter_type ==RTE_MACVLAN_HASH_MATCH )) { +/** +* If vlan_num is 0, that's the first time to add mac, +* set mask for vlan_id 0. +*/ +if (vsi->vlan_num ==0 ) { +i40e_set_vlan_filter (vsi,0 ,1 ); + vsi->vlan_num =1 ; + } + vlan_num = vsi->vlan_num; + }else if ((f->mac_info.filter_type ==RTE_MAC_PERFECT_MATCH ) || + (f->mac_info.filter_type ==RTE_MAC_HASH_MATCH )) + vlan_num =1 ; + + mv_f =rte_zmalloc ("macvlan_data" , vlan_num *sizeof (*mv_f),0 ); +if (!mv_f) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return I40E_ERR_NO_MEMORY ; + } + +for (i =0 ; i < vlan_num; i++) { + mv_f[i].filter_type = f->mac_info.filter_type; + (void )rte_memcpy (&mv_f[i].macaddr, + &f->mac_info.mac_addr, +ETH_ADDR_LEN ); + } + +if (f->mac_info.filter_type ==RTE_MACVLAN_PERFECT_MATCH || + f->mac_info.filter_type ==RTE_MACVLAN_HASH_MATCH ) { + ret =i40e_find_all_vlan_for_mac (vsi, mv_f, vlan_num, + &f->mac_info.mac_addr); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + } + + ret =i40e_add_macvlan_filters (vsi, mv_f, vlan_num); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + +rte_free (mv_f); + ret =I40E_SUCCESS ; + } + +return ret; +} + +static int +i40e_vsi_set_tx_loopback (struct i40e_vsi *vsi,uint8_t on) +{ +struct i40e_vsi_context ctxt; +struct i40e_hw *hw; +int ret; + + hw =I40E_VSI_TO_HW (vsi); + +/* Use the FW API if FW >= v5.0 */ +if (hw->aq.fw_maj_ver <5 ) { +PMD_INIT_LOG (ERR ,"FW < v5.0, cannot enable loopback" ); +return -ENOTSUP ; + } + +/* Check if it has been already on or off */ +if (vsi->info.valid_sections & +rte_cpu_to_le_16 (I40E_AQ_VSI_PROP_SWITCH_VALID )) { +if (on) { +if ((vsi->info.switch_id & +I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ) == +I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ) +return 0 ;/* already on */ + }else { +if ((vsi->info.switch_id & +I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ) ==0 ) +return 0 ;/* already off */ + } + } + +/* remove all the MACs first */ + ret =i40e_vsi_rm_mac_filter (vsi); +if (ret) +return ret; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_SWITCH_VALID ); +if (on) + vsi->info.switch_id |=I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ; +else + vsi->info.switch_id &= ~I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) { +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); +return ret; + } + +/* add all the MACs back */ + ret =i40e_vsi_restore_mac_filter (vsi); +if (ret) +return ret; + +return ret; +} + +int +rte_pmd_i40e_set_tx_loopback (uint8_t port,uint8_t on) +{ +struct rte_eth_dev *dev; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +uint16_t vf_id; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +/* setup PF TX loopback */ + vsi = pf->main_vsi; + ret =i40e_vsi_set_tx_loopback (vsi, on); +if (ret) +return ret; + +/* setup TX loopback for all the VFs */ +if (!pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + +for (vf_id =0 ; vf_id < pf->vf_num; vf_id++) { + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + + ret =i40e_vsi_set_tx_loopback (vsi, on); +if (ret) +return ret; + } + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +16 -0
@@ -114,4 +114,20 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Enable/Disable TX loopback on all the PF and VFs. +* +* @param port +* The port identifier of the Ethernet device. +* @param on +* 1 - Enable TX loopback. +* 0 - Disable TX loopback. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_tx_loopback (uint8_t port, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -9,4 +9,5 @@ DPDK_17.02 { rte_pmd_i40e_ping_vfs; rte_pmd_i40e_set_vf_mac_anti_spoof; rte_pmd_i40e_set_vf_vlan_anti_spoof; + rte_pmd_i40e_set_tx_loopback; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 6/29 net/i40e: set VF unicast promisc mode from PF
In reply to Qi ZhangFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF unicast promiscuous mode from PF.
User can call the API on PF to enable/disable a specific VF's unicast promiscuous mode.
--- drivers/net/i40e/i40e_ethdev.c | 36 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 56 insertions(+)
drivers/net/i40e/i40e_ethdev.c +36 -0
@@ -10117,3 +10117,39 @@ rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)return ret; } + +int +rte_pmd_i40e_set_vf_unicast_promisc (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + hw =I40E_VSI_TO_HW (vf->vsi); + + ret =i40e_aq_set_vsi_unicast_promiscuous (hw, vf->vsi->seid, + on,NULL , true); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set unicast promiscuous mode" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -130,4 +130,23 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,int rte_pmd_i40e_set_tx_loopback (uint8_t port,uint8_t on); +/** +* Enable/Disable VF unicast promiscuous mode. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set. +* @param on +* 1 - Enable. +* 0 - Disable. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_unicast_promisc (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -10,4 +10,5 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_mac_anti_spoof; rte_pmd_i40e_set_vf_vlan_anti_spoof; rte_pmd_i40e_set_tx_loopback; + rte_pmd_i40e_set_vf_unicast_promisc; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 7/29 net/i40e: set VF multicast promisc mode from PF
In reply to Qi ZhangFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF multicast promiscuous mode from PF.
User can call the API on PF to enable/disable a specific VF's multicast promiscuous mode.
--- drivers/net/i40e/i40e_ethdev.c | 36 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 56 insertions(+)
drivers/net/i40e/i40e_ethdev.c +36 -0
@@ -10153,3 +10153,39 @@ rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +int +rte_pmd_i40e_set_vf_multicast_promisc (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + hw =I40E_VSI_TO_HW (vf->vsi); + + ret =i40e_aq_set_vsi_multicast_promiscuous (hw, vf->vsi->seid, + on,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set multicast promiscuous mode" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -149,4 +149,23 @@ int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Enable/Disable VF multicast promiscuous mode. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set. +* @param on +* 1 - Enable. +* 0 - Disable. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_multicast_promisc (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -11,4 +11,5 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_anti_spoof; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_unicast_promisc; + rte_pmd_i40e_set_vf_multicast_promisc; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 8/29 net/i40e: enable VF MTU change
In reply to Qi ZhangThis patch implement mtu_set ops for i40e VF.
--- drivers/net/i40e/i40e_ethdev_vf.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/net/i40e/i40e_ethdev_vf.c +33 -0
@@ -151,6 +151,7 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf);static int i40evf_dev_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf); +static int i40evf_dev_mtu_set (struct rte_eth_dev *dev,uint16_t mtu);static int i40evf_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); static int
@@ -225,6 +226,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .reta_query = i40evf_dev_rss_reta_query, .rss_hash_update = i40evf_dev_rss_hash_update, .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, + .mtu_set = i40evf_dev_mtu_set, };/*
@@ -2641,3 +2643,34 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,return 0 ; } + +static int +i40evf_dev_mtu_set (struct rte_eth_dev *dev,uint16_t mtu) +{ +struct i40e_vf *vf =I40EVF_DEV_PRIVATE_TO_VF (dev->data->dev_private); +struct rte_eth_dev_data *dev_data = vf->dev_data; +uint32_t frame_size = mtu +ETHER_HDR_LEN + +ETHER_CRC_LEN +I40E_VLAN_TAG_SIZE ; +int ret =0 ; + +/* check if mtu is within the allowed range */ +if ((mtu <ETHER_MIN_MTU ) || (frame_size >I40E_FRAME_SIZE_MAX )) +return -EINVAL ; + +/* mtu setting is forbidden if port is start */ +if (dev_data->dev_started) { +PMD_DRV_LOG (ERR , +"port %d must be stopped before configuration\n" , + dev_data->port_id); +return -EBUSY ; + } + +if (frame_size >ETHER_MAX_LEN ) + dev_data->dev_conf.rxmode.jumbo_frame =1 ; +else + dev_data->dev_conf.rxmode.jumbo_frame =0 ; + + dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size; + +return ret; +}
Signature · 1 line
2.7.4
PATCH v3 10/29 net/i40e: set VF MAC from PF support
In reply to Qi ZhangFrom: Ferruh Yigit <[email protected]>
Support setting VF MAC address from PF.
User can call the API on PF to set a specific
VF's MAC address.
This will remove all existing MAC filters.
--- app/test-pmd/cmdline.c | 18 ++++++++++++-- drivers/net/i40e/i40e_ethdev.c | 40 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 2 ++ 4 files changed, 77 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c +16 -2
@@ -90,6 +90,9 @@#ifdef RTE_LIBRTE_IXGBE_PMD #include <rte_pmd_ixgbe.h> #endif +#ifdef RTE_LIBRTE_I40E_PMD +#include <rte_pmd_i40e.h> +#endif #include "testpmd.h" static struct cmdline *testpmd_cl;
@@ -11453,13 +11456,24 @@ cmd_set_vf_mac_addr_parsed( __attribute__((unused)) void *data) {struct cmd_set_vf_mac_addr_result *res = parsed_result; +struct rte_eth_dev_info dev_info;int ret;if (port_id_is_invalid (res->port_id,ENABLED_WARN ))return ; - ret =rte_pmd_ixgbe_set_vf_mac_addr (res->port_id, res->vf_id, - &res->mac_addr); +memset (&dev_info,0 ,sizeof (dev_info)); +rte_eth_dev_info_get (res->port_id, &dev_info); + +if (strstr (dev_info.driver_name,"ixgbe" ) !=NULL ) + ret =rte_pmd_ixgbe_set_vf_mac_addr (res->port_id, res->vf_id, + &res->mac_addr); +else if (strstr (dev_info.driver_name,"i40e" ) !=NULL ) + ret =rte_pmd_i40e_set_vf_mac_addr (res->port_id, res->vf_id, + &res->mac_addr); +else +return ; +switch (ret) {case 0 :break ;
drivers/net/i40e/i40e_ethdev.c +40 -0
@@ -10189,3 +10189,43 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +int +rte_pmd_i40e_set_vf_mac_addr (uint8_t port,uint16_t vf_id, +struct ether_addr *mac_addr) +{ +struct rte_eth_dev_info dev_info; +struct i40e_mac_filter *f; +struct rte_eth_dev *dev; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +struct i40e_pf *pf; +void *temp; + +if (i40e_validate_mac_addr ((u8 *)mac_addr) !=I40E_SUCCESS ) +return -EINVAL ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) +return -EINVAL ; + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + +ether_addr_copy (mac_addr, &vf->mac_addr); + +/* Remove all existing mac */ + TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) +i40e_vsi_delete_mac (vsi, &f->mac_info.mac_addr); + +return 0 ; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -168,4 +168,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Set the VF MAC address. +* +* This will remove all existing MAC filters. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf_id +* VF id. +* @param mac_addr +* VF MAC address. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if *vf* or *mac_addr* is invalid. +*/ +int rte_pmd_i40e_set_vf_mac_addr (uint8_t port,uint16_t vf_id, +struct ether_addr *mac_addr); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +2 -0
@@ -12,4 +12,6 @@ DPDK_17.02 { rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_unicast_promisc; rte_pmd_i40e_set_vf_multicast_promisc; + rte_pmd_i40e_set_vf_mac_addr; + } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 11/29 net/i40e: set VF MAC from VF support
In reply to Qi ZhangFrom: Ferruh Yigit <[email protected]>
Support changing VF default MAC address.
This function is not supported if PF set the MAC
address for the PF.
--- drivers/net/i40e/i40e_ethdev.h | 4 +++- drivers/net/i40e/i40e_ethdev_vf.c | 49 +++++++++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 8 deletions(-)
drivers/net/i40e/i40e_ethdev.h +3 -1
@@ -126,6 +126,7 @@ enum i40e_flxpld_layer_idx {#define I40E_FLAG_FDIR (1ULL << 6)#define I40E_FLAG_VXLAN (1ULL << 7)#define I40E_FLAG_RSS_AQ_CAPABLE (1ULL << 8) +#define I40E_FLAG_VF_MAC_BY_PF (1ULL << 9)#define I40E_FLAG_ALL (I40E_FLAG_RSS | \ I40E_FLAG_DCB | \ I40E_FLAG_VMDQ | \
@@ -134,7 +135,8 @@ enum i40e_flxpld_layer_idx { I40E_FLAG_HEADER_SPLIT_ENABLED | \ I40E_FLAG_FDIR | \ I40E_FLAG_VXLAN | \ - I40E_FLAG_RSS_AQ_CAPABLE) + I40E_FLAG_RSS_AQ_CAPABLE | \ + I40E_FLAG_VF_MAC_BY_PF)#define I40E_RSS_OFFLOAD_ALL ( \ ETH_RSS_FRAG_IPV4 | \
drivers/net/i40e/i40e_ethdev_vf.c +42 -7
92 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 13/29 net/i40e: add VF VLAN strip func
In reply to Qi ZhangFrom: "Chen Jing D(Mark)" <[email protected]>
Add a function to configure vlan strip enable/disable for specific SRIOV VF device.
--- drivers/net/i40e/i40e_ethdev.c | 26 ++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 46 insertions(+)
drivers/net/i40e/i40e_ethdev.c +26 -0
@@ -10229,3 +10229,29 @@ rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,return 0 ; } + +/* Set vlan strip on/off for specific VF from host */ +int +rte_pmd_i40e_set_vf_vlan_stripq (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct i40e_pf *pf; +struct i40e_vsi *vsi; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vsi = pf->vfs[vf_id].vsi; + +if (vsi) +return i40e_vsi_config_vlan_stripping (vsi, !!on); +else +return -EINVAL ; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -187,4 +187,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,int rte_pmd_i40e_set_vf_mac_addr (uint8_t port,uint16_t vf_id,struct ether_addr *mac_addr); +/** +* Enable/Disable vf vlan strip for all queues in a pool +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param on +* 1 - Enable VF's vlan strip on RX queues. +* 0 - Disable VF's vlan strip on RX queues. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int +rte_pmd_i40e_set_vf_vlan_stripq (uint8_t port,uint16_t vf,uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -13,5 +13,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_unicast_promisc; rte_pmd_i40e_set_vf_multicast_promisc; rte_pmd_i40e_set_vf_mac_addr; + rte_pmd_i40e_set_vf_vlan_stripq; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 14/29 net/i40e: add set VF VLAN insert function
In reply to Qi ZhangFrom: Bernard Iremonger <[email protected]>
Support inserting VF VLAN id from PF.
User can call the API on PF to insert a VLAN id to a specific VF.
--- drivers/net/i40e/i40e_ethdev.c | 53 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 73 insertions(+)
drivers/net/i40e/i40e_ethdev.c +53 -0
@@ -10255,3 +10255,56 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)else return -EINVAL ; } + +int rte_pmd_i40e_set_vf_vlan_insert (uint8_t port,uint16_t vf_id, +uint16_t vlan_id) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +struct i40e_vsi *vsi; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =I40E_PF_TO_HW (pf); + +/** +* return -ENODEV if SRIOV not enabled, VF number not configured +* or no queue assigned. +*/ +if (!hw->func_caps.sr_iov_1_1 || pf->vf_num ==0 || + pf->vf_nb_qps ==0 ) +return -ENODEV ; + +if (vf_id >= pf->vf_num || !pf->vfs) +return -EINVAL ; + +if (vlan_id >ETHER_MAX_VLAN_ID ) +return -EINVAL ; + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_VLAN_VALID ); + vsi->info.port_vlan_flags |=I40E_AQ_VSI_PVLAN_INSERT_PVID ; + vsi->info.pvid = vlan_id; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -206,4 +206,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,int rte_pmd_i40e_set_vf_vlan_stripq (uint8_t port,uint16_t vf,uint8_t on); +/** +* Enable/Disable vf vlan insert +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param vlan_id +* 0 - Disable VF's vlan insert. +* n - Enable; n is inserted as the vlan id. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_vlan_insert (uint8_t port,uint16_t vf_id, +uint16_t vlan_id); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -14,5 +14,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_multicast_promisc; rte_pmd_i40e_set_vf_mac_addr; rte_pmd_i40e_set_vf_vlan_stripq; + rte_pmd_i40e_set_vf_vlan_insert; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 15/29 net/i40e: set VF broadcast mode from PF
In reply to Qi ZhangFrom: Bernard Iremonger <[email protected]>
Support enabling/disabling VF broadcast mode from PF. User can call the API on PF to enable/disable a specific VF's broadcast mode.
--- drivers/net/i40e/i40e_ethdev.c | 43 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 63 insertions(+)
drivers/net/i40e/i40e_ethdev.c +43 -0
@@ -10308,3 +10308,46 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,return ret; } + +int rte_pmd_i40e_set_vf_broadcast (uint8_t port,uint16_t vf_id, +uint8_t on) { +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =I40E_PF_TO_HW (pf); + +if (vf_id >= pf->vf_num || !pf->vfs) +return -EINVAL ; + +/** +* return -ENODEV if SRIOV not enabled, VF number not configured +* or no queue assigned. +*/ +if (!hw->func_caps.sr_iov_1_1 || pf->vf_num ==0 || pf->vf_nb_qps ==0 ) +return -ENODEV ; + + vf = &pf->vfs[vf_id]; + hw =I40E_VSI_TO_HW (vf->vsi); + + ret =i40e_aq_set_vsi_broadcast (hw, vf->vsi->seid, on,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set VSI broadcast" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -225,4 +225,23 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);int rte_pmd_i40e_set_vf_vlan_insert (uint8_t port,uint16_t vf_id,uint16_t vlan_id); +/** +* Enable/Disable vf broadcast mode +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param on +* 0 - Disable broadcast. +* 1 - Enable broadcast. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_broadcast (uint8_t port,uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -15,5 +15,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_mac_addr; rte_pmd_i40e_set_vf_vlan_stripq; rte_pmd_i40e_set_vf_vlan_insert; + rte_pmd_i40e_set_vf_broadcast; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 16/29 net/i40e: set VF VLAN tag from PF
In reply to Qi ZhangFrom: Bernard Iremonger <[email protected]>
Add rte_pmd_i40e_set_vf_vlan_tag API.
User can call the API on PF to enable/disable a specific VF's VLAN tag.
--- drivers/net/i40e/i40e_ethdev.c | 59 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 18 ++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 78 insertions(+)
drivers/net/i40e/i40e_ethdev.c +59 -0
@@ -10351,3 +10351,62 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,return ret; } + +int rte_pmd_i40e_set_vf_vlan_tag (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +struct i40e_vsi *vsi; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =I40E_PF_TO_HW (pf); + +/** +* return -ENODEV if SRIOV not enabled, VF number not configured +* or no queue assigned. +*/ +if (!hw->func_caps.sr_iov_1_1 || pf->vf_num ==0 || pf->vf_nb_qps ==0 ) +return -ENODEV ; + +if (vf_id >= pf->vf_num) +return -EINVAL ; + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_VLAN_VALID ); +if (on) { + vsi->info.port_vlan_flags |=I40E_AQ_VSI_PVLAN_MODE_TAGGED ; + vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_UNTAGGED ; + }else { + vsi->info.port_vlan_flags |=I40E_AQ_VSI_PVLAN_MODE_UNTAGGED ; + vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_TAGGED ; + } + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +18 -0
@@ -244,4 +244,22 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,int rte_pmd_i40e_set_vf_broadcast (uint8_t port,uint16_t vf_id,uint8_t on); +/** +* Enable/Disable vf vlan tag +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param vlan_id +* 0 - Disable VF's vlan tag. +* n - Enable VF's vlan tag. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_vlan_tag (uint8_t port,uint16_t vf_id,uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -16,5 +16,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_stripq; rte_pmd_i40e_set_vf_vlan_insert; rte_pmd_i40e_set_vf_broadcast; + rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 17/29 net/i40e: set VF VLAN filter from PF
In reply to Qi ZhangFrom: Bernard Iremonger <[email protected]>
add rte_pmd_i40e_set_vf_vlan_filter API.
User can call the API on PF to enable/disable
a set of VF's VLAN filters.
--- drivers/net/i40e/i40e_ethdev.c | 52 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 22 +++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 75 insertions(+)
drivers/net/i40e/i40e_ethdev.c +52 -0
@@ -10410,3 +10410,55 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +int rte_pmd_i40e_set_vf_vlan_filter (uint8_t port,uint16_t vlan_id, +uint64_t vf_mask,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +uint16_t pool_idx; +int ret =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vlan_id >ETHER_MAX_VLAN_ID ) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); +if ((pf->flags &I40E_FLAG_VMDQ ) ==0 ) { +PMD_INIT_LOG (ERR ,"Firmware doesn't support VMDQ" ); +return -ENOTSUP ; + } + +if (!pf->vmdq) { +PMD_INIT_LOG (INFO ,"VMDQ not configured" ); +return -ENOTSUP ; + } + +for (pool_idx =0 ; + pool_idx <ETH_64_POOLS && + pool_idx < pf->nb_cfg_vmdq_vsi && + ret ==I40E_SUCCESS ; + pool_idx++) { +if (vf_mask & ((uint64_t )(1ULL << pool_idx))) { +if (on) + ret =i40e_vsi_add_vlan (pf->vmdq[pool_idx].vsi, + vlan_id); +else + ret =i40e_vsi_delete_vlan ( + pf->vmdq[pool_idx].vsi, vlan_id); + } + } + +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set VF VLAN filter, on = %d" , on); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +22 -0
@@ -262,4 +262,26 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,*/ int rte_pmd_i40e_set_vf_vlan_tag (uint8_t port,uint16_t vf_id,uint8_t on); +/** +* Enable/Disable VF VLAN filter +* +* @param port +* The port identifier of the Ethernet device. +* @param vlan_id +* ID specifying VLAN +* @param vf_mask +* Mask to filter VF's +* @param on +* 0 - Disable VF's VLAN filter. +* 1 - Enable VF's VLAN filter. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (-ENOTSUP) VMDq not configured of not supported by firmware. +*/ +int rte_pmd_i40e_set_vf_vlan_filter (uint8_t port,uint16_t vlan_id, +uint64_t vf_mask,uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -17,5 +17,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_insert; rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_vlan_tag; + rte_pmd_i40e_set_vf_vlan_filter; } DPDK_2.0;
Signature · 1 line
2.7.4
PATCH v3 18/29 app/testpmd: use VFD APIs on i40e
In reply to Qi ZhangFrom: Wenzhuo Lu <[email protected]>
The new VF Daemon (VFD) APIs is implemented on i40e. Change testpmd code to use them, including VF MAC anti-spoofing, VF VLAN anti-spoofing, TX loopback, VF VLAN strip, VF VLAN insert.
--- app/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 107 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 84 insertions(+), 25 deletions(-)
app/test-pmd/Makefile +2 -0
@@ -58,7 +58,9 @@ SRCS-y += csumonly.c SRCS-y += icmpecho.c SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c +_LDLIBS-y += --whole-archive _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e CFLAGS_cmdline.o := -D_GNU_SOURCE
app/test-pmd/cmdline.c +82 -25
286 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 19/29 app/testpmd: use unicast promiscuous mode on i40e
In reply to Qi ZhangFrom: Wenzhuo Lu <[email protected]>
Add testpmd CLI to set VF unicast promiscuous mode on i40e.
--- app/test-pmd/cmdline.c | 86 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++ 2 files changed, 95 insertions(+)
app/test-pmd/cmdline.c +86 -0
@@ -398,6 +398,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set allmulti (port_id|all) (on|off)\n" " Set the allmulti mode on port_id, or all.\n\n" +"set vf promisc (port_id) (vf_id) (on|off)\n" +" Set unicast promiscuous mode for a VF from the PF.\n\n" +"set flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n"
@@ -11564,6 +11567,88 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = { }, }; +/* VF unicast promiscuous mode configuration */ + +/* Common result structure for VF unicast promiscuous mode */ +struct cmd_vf_promisc_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t promisc; +uint8_t port_id; +uint32_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for VF unicast promiscuous mode enable disable */ +cmdline_parse_token_string_t cmd_vf_promisc_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_promisc_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_promisc_promisc = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + promisc,"promisc" ); +cmdline_parse_token_num_t cmd_vf_promisc_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_promisc_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_promisc_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_promisc_result, + vf_id,UINT32 ); +cmdline_parse_token_string_t cmd_vf_promisc_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + on_off,"on#off" ); + +static void +cmd_set_vf_promisc_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_promisc_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + + ret =rte_pmd_i40e_set_vf_unicast_promisc (res->port_id, + res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d\n" , res->vf_id); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_promisc = { + .f = cmd_set_vf_promisc_parsed, + .data =NULL , + .help_str ="set vf unicast promiscuous mode for a VF from PF" , + .tokens = { + (void *)&cmd_vf_promisc_set, + (void *)&cmd_vf_promisc_vf, + (void *)&cmd_vf_promisc_promisc, + (void *)&cmd_vf_promisc_port_id, + (void *)&cmd_vf_promisc_vf_id, + (void *)&cmd_vf_promisc_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11728,6 +11813,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_traffic, (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, (cmdline_parse_inst_t *)&cmd_vf_rate_limit, + (cmdline_parse_inst_t *)&cmd_set_vf_promisc, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -0
@@ -820,6 +820,15 @@ Set the allmulti mode for a port or for all ports:: Same as the ifconfig (8) option. Controls how multicast packets are handled. +set promisc (for VF) +~~~~~~~~~~~~~~~~~~~~ + +Set the unicast promiscuous mode for a VF from PF. +It's supported by Intel i40e NICs now. +In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: + + testpmd> set vf promisc (port_id) (vf_id) (on|off) + set flow_ctrl rx ~~~~~~~~~~~~~~~~
Signature · 1 line
2.7.4
PATCH v3 20/29 app/testpmd: use multicast promiscuous mode on i40e
In reply to Qi ZhangFrom: Wenzhuo Lu <[email protected]>
Add testpmd CLI to set VF multicast promiscuous mode on i40e.
--- app/test-pmd/cmdline.c | 86 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++ 2 files changed, 95 insertions(+)
app/test-pmd/cmdline.c +86 -0
@@ -401,6 +401,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf promisc (port_id) (vf_id) (on|off)\n" " Set unicast promiscuous mode for a VF from the PF.\n\n" +"set vf allmulti (port_id) (vf_id) (on|off)\n" +" Set multicast promiscuous mode for a VF from the PF.\n\n" +"set flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n"
@@ -11649,6 +11652,88 @@ cmdline_parse_inst_t cmd_set_vf_promisc = { }, }; +/* VF multicast promiscuous mode configuration */ + +/* Common result structure for VF multicast promiscuous mode */ +struct cmd_vf_allmulti_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t allmulti; +uint8_t port_id; +uint32_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for VF multicast promiscuous mode enable disable */ +cmdline_parse_token_string_t cmd_vf_allmulti_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_allmulti_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_allmulti_allmulti = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + allmulti,"allmulti" ); +cmdline_parse_token_num_t cmd_vf_allmulti_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_allmulti_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_allmulti_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_allmulti_result, + vf_id,UINT32 ); +cmdline_parse_token_string_t cmd_vf_allmulti_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + on_off,"on#off" ); + +static void +cmd_set_vf_allmulti_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_allmulti_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + + ret =rte_pmd_i40e_set_vf_multicast_promisc (res->port_id, + res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d\n" , res->vf_id); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_allmulti = { + .f = cmd_set_vf_allmulti_parsed, + .data =NULL , + .help_str ="set vf multicast promiscuous for a VF from PF" , + .tokens = { + (void *)&cmd_vf_allmulti_set, + (void *)&cmd_vf_allmulti_vf, + (void *)&cmd_vf_allmulti_allmulti, + (void *)&cmd_vf_allmulti_port_id, + (void *)&cmd_vf_allmulti_vf_id, + (void *)&cmd_vf_allmulti_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11814,6 +11899,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, (cmdline_parse_inst_t *)&cmd_vf_rate_limit, (cmdline_parse_inst_t *)&cmd_set_vf_promisc, + (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -0
@@ -829,6 +829,15 @@ In promiscuous mode packets are not dropped if they aren't for the specified MAC testpmd> set vf promisc (port_id) (vf_id) (on|off) +set allmulticast (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set the multicast promiscuous mode for a VF from PF. +It's supported by Intel i40e NICs now. +In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: + + testpmd> set vf allmulti (port_id) (vf_id) (on|off) + set flow_ctrl rx ~~~~~~~~~~~~~~~~
Signature · 1 line
2.7.4
PATCH v3 21/29 app/testpmd: add command to test VF broadcast mode on i40e
In reply to Qi ZhangFrom: Bernard Iremonger <[email protected]>
Add command to call rte_pmd_i40e_set_vf_broadcast. Add set vf broadcast in testpmd_funcs.rst file.
--- app/test-pmd/cmdline.c | 85 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 92 insertions(+)
app/test-pmd/cmdline.c +85 -0
@@ -277,6 +277,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf mac antispoof (port_id) (vf_id) (on|off).\n" " Set MAC antispoof for a VF from the PF.\n\n" +"set vf broadcast (port_id) (vf_id) (on|off)\n" +" Set VF broadcast for a VF from the PF.\n\n" +"vlan set strip (on|off) (port_id)\n" " Set the VLAN strip on a port.\n\n"
@@ -11734,6 +11737,87 @@ cmdline_parse_inst_t cmd_set_vf_allmulti = { }, }; +/* vf broadcast mode configuration */ + +/* Common result structure for vf broadcast */ +struct cmd_set_vf_broadcast_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t broadcast; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf broadcast enable disable */ +cmdline_parse_token_string_t cmd_set_vf_broadcast_set = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + set,"set" ); +cmdline_parse_token_string_t cmd_set_vf_broadcast_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_set_vf_broadcast_broadcast = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + broadcast,"broadcast" ); +cmdline_parse_token_num_t cmd_set_vf_broadcast_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_broadcast_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_set_vf_broadcast_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_broadcast_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_set_vf_broadcast_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + on_off,"on#off" ); + +static void +cmd_set_vf_broadcast_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_set_vf_broadcast_result *res = parsed_result; +int ret; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + + ret =rte_pmd_i40e_set_vf_broadcast (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_broadcast = { + .f = cmd_set_vf_broadcast_parsed, + .data =NULL , + .help_str ="set vf broadcast port_id vf_id on|off" , + .tokens = { + (void *)&cmd_set_vf_broadcast_set, + (void *)&cmd_set_vf_broadcast_vf, + (void *)&cmd_set_vf_broadcast_broadcast, + (void *)&cmd_set_vf_broadcast_port_id, + (void *)&cmd_set_vf_broadcast_vf_id, + (void *)&cmd_set_vf_broadcast_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11900,6 +11984,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_rate_limit, (cmdline_parse_inst_t *)&cmd_set_vf_promisc, (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, + (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -507,6 +507,13 @@ Set mac antispoof for a VF from the PF:: testpmd> set vf mac antispoof (port_id) (vf_id) (on|off) +set broadcast mode (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set broadcast mode for a VF from the PF:: + + testpmd> set vf broadcast (port_id) (vf_id) (on|off) + vlan set strip ~~~~~~~~~~~~~~
Signature · 1 line
2.7.4
PATCH v3 22/29 app/testpmd: add command to test VF VLAN tag on i40e
In reply to Qi ZhangFrom: Bernard Iremonger <[email protected]>
command is: set vf vlan tag port_id vf_id on|off
--- app/test-pmd/cmdline.c | 91 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 98 insertions(+)
app/test-pmd/cmdline.c +91 -0
@@ -295,6 +295,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf vlan antispoof (port_id) (vf_id) (on|off)\n" " Set VLAN antispoof for a VF from the PF.\n\n" +"set vf vlan tag (port_id) (vf_id) (on|off)\n" +" Set VLAN tag for a VF from the PF.\n\n" +"vlan set filter (on|off) (port_id)\n" " Set the VLAN filter on a port.\n\n"
@@ -11818,6 +11821,93 @@ cmdline_parse_inst_t cmd_set_vf_broadcast = { }, }; +/* vf vlan tag configuration */ + +/* Common result structure for vf vlan tag */ +struct cmd_set_vf_vlan_tag_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t vlan; +cmdline_fixed_string_t tag; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf vlan tag enable disable */ +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_set = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + set,"set" ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vlan = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + vlan,"vlan" ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_tag = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + tag,"tag" ); +cmdline_parse_token_num_t cmd_set_vf_vlan_tag_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_set_vf_vlan_tag_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + on_off,"on#off" ); + +static void +cmd_set_vf_vlan_tag_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_set_vf_vlan_tag_result *res = parsed_result; +int ret; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + + ret =rte_pmd_i40e_set_vf_vlan_tag (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_vlan_tag = { + .f = cmd_set_vf_vlan_tag_parsed, + .data =NULL , + .help_str ="set vf vlan tag port_id vf_id on|off" , + .tokens = { + (void *)&cmd_set_vf_vlan_tag_set, + (void *)&cmd_set_vf_vlan_tag_vf, + (void *)&cmd_set_vf_vlan_tag_vlan, + (void *)&cmd_set_vf_vlan_tag_tag, + (void *)&cmd_set_vf_vlan_tag_port_id, + (void *)&cmd_set_vf_vlan_tag_vf_id, + (void *)&cmd_set_vf_vlan_tag_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11985,6 +12075,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_promisc, (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, + (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -542,6 +542,13 @@ Set VLAN insert for a VF from the PF:: testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id) +vlan set tag (for VF) +~~~~~~~~~~~~~~~~~~~~~ + +Set VLAN tag for a VF from the PF:: + + testpmd> set vf vlan tag (port_id) (vf_id) (on|off) + vlan set antispoof (for VF) ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.7.4
PATCH v3 23/29 app/testpmd: handle i40e in VF VLAN filter command
In reply to Qi ZhangFrom: Bernard Iremonger <[email protected]>
modify set_vf_rx_vlan function to handle the i40e PMD.
--- app/test-pmd/config.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
app/test-pmd/config.c +15 -2
@@ -92,6 +92,9 @@#include <rte_ethdev.h> #include <rte_string_fns.h> #include <rte_cycles.h> +#ifdef RTE_LIBRTE_I40E_PMD +#include <rte_pmd_i40e.h> +#endif #ifdef RTE_LIBRTE_IXGBE_PMD #include <rte_pmd_ixgbe.h> #endif
@@ -2353,12 +2356,22 @@ void set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on) { int diag; +struct rte_eth_dev_info dev_info; + +rte_eth_dev_info_get (port_id, &dev_info); - diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on); +#ifdef RTE_LIBRTE_I40E_PMD +if (strstr (dev_info.driver_name,"i40e" ) !=NULL ) + diag =rte_pmd_i40e_set_vf_vlan_filter (port_id, vlan_id, + vf_mask, on); + else +#endif + diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, + vf_mask, on);if (diag ==0 )return ; -printf ("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed " +printf ("rte_pmd_xxx_set_vf_vlan_filter for port_id=%d failed " "diag=%d\n" , port_id, diag); }#endif
Signature · 1 line
2.7.4
PATCH v3 24/29 net/i40e: change version number to support Linux VF
In reply to Qi ZhangFrom: "Chen Jing D(Mark)" <[email protected]>
i40e PF host only support to work with DPDK VF driver, Linux VF driver is not supported. This change will enhance in version number returned.
Current version info returned won't be able to be recognized by Linux VF driver, change to values that both DPDK VF and Linux driver can recognize.
The expense is original DPDK host specific feature like CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available.
DPDK VF also can't identify host driver by version number returned. It always assume talking with Linux PF.
--- drivers/net/i40e/i40e_pf.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +13 -2
@@ -279,8 +279,19 @@ i40e_pf_host_process_cmd_version(struct i40e_pf_vf *vf, bool b_op) {struct i40e_virtchnl_version_info info; - info.major =I40E_DPDK_VERSION_MAJOR ; - info.minor =I40E_DPDK_VERSION_MINOR ; +/* Respond like a Linux PF host in order to support both DPDK VF and +* Linux VF driver. The expense is original DPDK host specific feature +* like CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available. +* +* DPDK VF also can't identify host driver by version number returned. +* It always assume talking with Linux PF. +* +* TODO: +* Discuss with Linux driver maintainer if possible to carry more info +* in this function to identify it's Linux or DPDK host. +*/ + info.major =I40E_VIRTCHNL_VERSION_MAJOR ; + info.minor =I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS ;if (b_op) i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
Signature · 1 line
2.7.4
PATCH v3 25/29 net/i40e: return correct VSI id
In reply to Qi ZhangFrom: "Chen Jing D(Mark)" <[email protected]>
PF host didn't return correct VSI id to VF.
This change fix it.
--- drivers/net/i40e/i40e_pf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +1 -2
@@ -351,8 +351,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, bool b_op)/* Change below setting if PF host can support more VSIs for VF */ vf_res->vsi_res[0 ].vsi_type =I40E_VSI_SRIOV ; -/* As assume Vf only has single VSI now, always return 0 */ - vf_res->vsi_res[0 ].vsi_id =0 ; + vf_res->vsi_res[0 ].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0 ].num_queue_pairs = vf->vsi->nb_qps;ether_addr_copy (&vf->mac_addr, (struct ether_addr *)vf_res->vsi_res[0 ].default_mac_addr);
Signature · 1 line
2.7.4
PATCH v3 26/29 net/i40e: parse more VF parameter and configure
In reply to Qi ZhangFrom: "Chen Jing D(Mark)" <[email protected]>
When VF requested to configure TX queue, a few parameters are missed to be configured in PF host. This change have more fields parsed and configured for TX context.
--- drivers/net/i40e/i40e_pf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_pf.c +3 -1
@@ -422,10 +422,12 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,/* clear the context structure first */ memset (&tx_ctx,0 ,sizeof (tx_ctx)); - tx_ctx.new_context =1 ; tx_ctx.base = txq->dma_ring_addr /I40E_QUEUE_BASE_ADDR_UNIT ; tx_ctx.qlen = txq->ring_len; tx_ctx.rdylist =rte_le_to_cpu_16 (vf->vsi->info.qs_handle[0 ]); + tx_ctx.head_wb_ena = txq->headwb_enabled; + tx_ctx.head_wb_addr = txq->dma_headwb_addr; + err =i40e_clear_lan_tx_queue_context (hw, abs_queue_id);if (err !=I40E_SUCCESS )return err;
Signature · 1 line
2.7.4
PATCH v3 27/29 net/i40e: support Linux VF to configure IRQ link list
In reply to Qi ZhangFrom: "Chen Jing D(Mark)" <[email protected]>
i40e PF host only support to work with DPDK VF driver, Linux VF driver is not supported. This change will enhance in configuring IRQ link list.
This Change will identify VF client by number of vector requested. DPDK VF will ask only single one while Linux VF will request at least 2. It will have different configuration for different clients. DPDK VF will be configured to link all queue together, while Linux VF will be configured per request.
--- drivers/net/i40e/i40e_pf.c | 151 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 138 insertions(+), 13 deletions(-)
drivers/net/i40e/i40e_pf.c +138 -13
@@ -585,14 +585,116 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,return ret; } +static void +i40e_pf_config_irq_link_list (struct i40e_pf_vf *vf, +struct i40e_virtchnl_vector_map *vvm) +{ +uint64_t linklistmap =0 , tempmap; +struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf); +uint16_t qid; +bool b_first_q = true; +enum i40e_queue_type qtype; +uint16_t vector_id; +uint32_t reg, reg_idx; +uint16_t itr_idx =0 , i; + + vector_id = vvm->vector_id; +/* setup the head */ +if (!vector_id) + reg_idx =I40E_VPINT_LNKLST0 (vf->vf_idx); +else + reg_idx =I40E_VPINT_LNKLSTN ( + ((hw->func_caps.num_msix_vectors_vf -1 ) * vf->vf_idx) + + (vector_id -1 )); + +if (vvm->rxq_map ==0 && vvm->txq_map ==0 ) { +I40E_WRITE_REG (hw, reg_idx, +I40E_VPINT_LNKLST0_FIRSTQ_INDX_MASK ); + goto cfg_irq_done; + } + +/* sort all rx and tx queues */ + tempmap = vvm->rxq_map; +for (i =0 ; i <sizeof (vvm->rxq_map) *8 ; i++) { +if (tempmap &0x1 ) + linklistmap |= (1 << (2 * i)); + tempmap >>=1 ; + } + + tempmap = vvm->txq_map; +for (i =0 ; i <sizeof (vvm->txq_map) *8 ; i++) { +if (tempmap &0x1 ) + linklistmap |= (1 << (2 * i +1 )); + tempmap >>=1 ; + } + +/* Link all rx and tx queues into a chained list */ + tempmap = linklistmap; + i =0 ; + b_first_q = true; +do { +if (tempmap &0x1 ) { + qtype = (enum i40e_queue_type )(i %2 ); + qid = vf->vsi->base_queue + i /2 ; +if (b_first_q) { +/* This is header */ + b_first_q = false; + reg = ((qtype << +I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT ) + | qid); + }else { +/* element in the link list */ + reg = (vector_id) | + (qtype <<I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT ) | + (qid <<I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | +BIT (I40E_QINT_RQCTL_CAUSE_ENA_SHIFT ) | + (itr_idx <<I40E_QINT_RQCTL_ITR_INDX_SHIFT ); + } +I40E_WRITE_REG (hw, reg_idx, reg); +/* find next register to program */ +switch (qtype) { +case I40E_QUEUE_TYPE_RX : + reg_idx =I40E_QINT_RQCTL (qid); + itr_idx = vvm->rxitr_idx; +break ; +case I40E_QUEUE_TYPE_TX : + reg_idx =I40E_QINT_TQCTL (qid); + itr_idx = vvm->txitr_idx; +break ; +default : +break ; + } + } + i++; + tempmap >>=1 ; + }while (tempmap); + +/* Terminate the link list */ + reg = (vector_id) | + (0 <<I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT ) | + (0x7FF <<I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | +BIT (I40E_QINT_RQCTL_CAUSE_ENA_SHIFT ) | + (itr_idx <<I40E_QINT_RQCTL_ITR_INDX_SHIFT ); +I40E_WRITE_REG (hw, reg_idx, reg); + +cfg_irq_done: +I40E_WRITE_FLUSH (hw); +} +static int i40e_pf_host_process_cmd_config_irq_map (struct i40e_pf_vf *vf,uint8_t *msg,uint16_t msglen,bool b_op) {int ret =I40E_SUCCESS ; +struct i40e_pf *pf = vf->pf; +struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);struct i40e_virtchnl_irq_map_info *irqmap = (struct i40e_virtchnl_irq_map_info *)msg; +struct i40e_virtchnl_vector_map *map; +int i; +uint16_t vector_id; +unsigned long qbit_max;if (!b_op) { i40e_pf_host_send_msg_to_vf(
@@ -608,23 +710,46 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, goto send_msg; } -/* Assume VF only have 1 vector to bind all queues */ -if (irqmap->num_vectors !=1 ) { -PMD_DRV_LOG (ERR ,"DKDK host only support 1 vector" ); - ret =I40E_ERR_PARAM ; +/* PF host will support both DPDK VF or Linux VF driver, identify by +* number of vectors requested. +*/ + +/* DPDK VF only requires single vector */ +if (irqmap->num_vectors ==1 ) { +/* This MSIX intr store the intr in VF range */ + vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; + vf->vsi->nb_msix = irqmap->num_vectors; + vf->vsi->nb_used_qps = vf->vsi->nb_qps; + +/* Don't care how the TX/RX queue mapping with this vector. +* Link all VF RX queues together. Only did mapping work. +* VF can disable/enable the intr by itself. +*/ +i40e_vsi_queues_bind_intr (vf->vsi); goto send_msg; } -/* This MSIX intr store the intr in VF range */ - vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; - vf->vsi->nb_msix = irqmap->num_vectors; - vf->vsi->nb_used_qps = vf->vsi->nb_qps; +/* Then, it's Linux VF driver */ + qbit_max =1 << pf->vf_nb_qp_max; +for (i =0 ; i < irqmap->num_vectors; i++) { + map = &irqmap->vecmap[i]; + + vector_id = map->vector_id; +/* validate msg params */ +if (vector_id >= hw->func_caps.num_msix_vectors_vf) { + ret =I40E_ERR_PARAM ; + goto send_msg; + } + +if ((map->rxq_map < qbit_max) && (map->txq_map < qbit_max)) { +i40e_pf_config_irq_link_list (vf, map); + }else { +/* configured queue size excceed limit */ + ret =I40E_ERR_PARAM ; + goto send_msg; + } + } -/* Don't care how the TX/RX queue mapping with this vector. -* Link all VF RX queues together. Only did mapping work. -* VF can disable/enable the intr by itself. -*/ -i40e_vsi_queues_bind_intr (vf->vsi); send_msg:i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP , ret,NULL ,0 );
Signature · 1 line
2.7.4
PATCH v3 28/29 net/i40e: enhance in sanity check of MAC
In reply to Qi ZhangFrom: "Chen Jing D(Mark)" <[email protected]>
When VF sends request to add a new MAC address, PF host will check if it's a non-zero or unicast address, or it will return with error. In fact, VF still can set multicast address. This change remove to check if it's a unicast address.
--- drivers/net/i40e/i40e_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +2 -2
@@ -890,8 +890,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, mac = (struct ether_addr *)(addr_list->list[i].addr); (void )rte_memcpy (&filter.mac_addr, mac,ETHER_ADDR_LEN ); filter.filter_type =RTE_MACVLAN_PERFECT_MATCH ; -if (!is_valid_assigned_ether_addr (mac) || -i40e_vsi_add_mac (vf->vsi, &filter)) { +if (is_zero_ether_addr (mac) || +i40e_vsi_add_mac (vf->vsi, &filter)) { ret =I40E_ERR_INVALID_MAC_ADDR ; goto send_msg; }
Signature · 1 line
2.7.4
PATCH v3 29/29 net/i40e: set/clear VF stats from PF
In reply to Qi ZhangThis patch add support to get/clear VF statistics
from PF side.
Two APIs are added:rte_pmd_i40e_get_vf_stats.rte_pmd_i40e_reset_vf_stats.
--- drivers/net/i40e/i40e_ethdev.c | 76 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 41 +++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 2 + 3 files changed, 119 insertions(+)
drivers/net/i40e/i40e_ethdev.c +76 -0
@@ -10462,3 +10462,79 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,return ret; } + +int +rte_pmd_i40e_get_vf_stats (uint8_t port, +uint16_t vf_id, +struct rte_eth_stats *stats) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_vsi *vsi; +int ret =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vsi = pf->vfs[vf_id].vsi; +i40e_update_vsi_stats (vsi); + + stats->ipackets = vsi->eth_stats.rx_unicast + + vsi->eth_stats.rx_multicast + + vsi->eth_stats.rx_broadcast; + stats->opackets = vsi->eth_stats.tx_unicast + + vsi->eth_stats.tx_multicast + + vsi->eth_stats.tx_broadcast; + stats->ibytes = vsi->eth_stats.rx_bytes; + stats->obytes = vsi->eth_stats.tx_bytes; + stats->ierrors = vsi->eth_stats.rx_discards; + stats->oerrors = vsi->eth_stats.tx_errors + vsi->eth_stats.tx_discards; + +return ret; +} + +int +rte_pmd_i40e_reset_vf_stats (uint8_t port, +uint16_t vf_id) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_vsi *vsi; +int ret =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vsi = pf->vfs[vf_id].vsi; + + vsi->offset_loaded = false; +i40e_update_vsi_stats (vsi); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +41 -0
45 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +2 -0
@@ -18,5 +18,7 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_vlan_tag; rte_pmd_i40e_set_vf_vlan_filter; + rte_pmd_i40e_get_vf_stats; + rte_pmd_i40e_reset_vf_stats; } DPDK_2.0;
Signature · 1 line
2.7.4
Quoted 65 lines · Qi Zhang
1, VF Daemon (VFD)
VFD is an idea to control all the VFs from PF.
As we need to support the scenario kernel PF + DPDK VF,
DPDK follows the interface between kernel PF + kernel VF.
We don't want to introduce too many new messages between PF and VF.
So this patch set adds some new APIs to control VFs directly from PF.
The new APIs include,
1) set VF MAC anti-spoofing
2) set VF VLAN anti-spoofing
3) set TX loopback
4) set VF unicast promiscuous mode
5) set VF multicast promiscuous mode
6) set VF MTU
7) get/reset VF stats
8) set VF MAC address
9) set VF VLAN stripping
10) VF VLAN insertion
12) set VF broadcast mode
12) set VF VLAN tag
13) set VF VLAN filter
VFD also includes VF to PF mailbox message management by APP.
When PF receives mailbox messages from VF, PF should call the callback provided by APP to know if they're permitted to be processed.2, Implement VF MAC address setting on VF.
3, Support the scenario DPDK PF + kernel VF.
v3:
- fix issue that VF does not work for i40e
- remove patch for VDMq receive mode init
- move get/reset VF stats API intorte_pmd_i40v2:
- fix the compile issues.
- fix the checkpatch warning and typo.
- update the commit log of some patches.
- fix the invalid port ID issue of testpmd.Bernard Iremonger (7):
net/i40e: add set VF VLAN insert function net/i40e: set VF broadcast mode from PF net/i40e: set VF VLAN tag from PF
net/i40e: set VF VLAN filter from PF app/testpmd: add command to test VF broadcast mode on i40e app/testpmd: add command to test VF VLAN tag on i40e app/testpmd: handle i40e in VF VLAN filter commandChen Jing D(Mark) (6):
net/i40e: add VF VLAN strip func
net/i40e: change version number to support Linux VF net/i40e: return correctvsi_id
net/i40e: parse more VF parameter and configure net/i40e: support Linux VF to configure IRQ link list net/i40e: enhance in sanity check of MACFerruh Yigit (3):
net/i40e: set VF MAC from PF support
net/i40e: set VF MAC from VF support
net/i40e: fix VF MAC address assignmentQi Zhang (3):
net/i40e: enable VF MTU change
net/i40e: fix VF reset flow
net/i40e: set/clear VF stats from PF
Quoted 12 lines
Wenzhuo Lu (10):
net/i40e: support link status notification net/i40e: add callback to user on VF to PF mbox msg net/i40e: set VF MAC anti-spoofing from PF net/i40e: set VF VLAN anti-spoofing from PF net/i40e: set Tx loopback from PF
net/i40e: set VF unicast promisc mode from PF net/i40e: set VF multicast promisc mode from PF app/testpmd: use VFD APIs on i40e app/testpmd: use unicast promiscuous mode on i40e app/testpmd: use multicast promiscuous mode on i40e
<...>
Hi Qi,
I can't cleanly apply the patchset to the next-net tree, mainly because of the testpmd conflicts.
I will send a new version of the patchset shortly.
Thanks,
ferruh
PATCH v4 9/29 net/i40e: fix VF reset flow
In reply to Ferruh YigitFrom: Qi Zhang <[email protected]>
Add missing step during VF reset: PF should set I40E_VFGEN_RSTAT to ACTIVE at end of the VF reset operation or VF driver may not able to detect that reset is already completed. This patch also remove the unnecessary enum for vfr state.
--- drivers/net/i40e/i40e_pf.c | 6 ++++-- drivers/net/i40e/i40e_pf.h | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/net/i40e/i40e_pf.c +4 -2
@@ -139,7 +139,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset) abs_vf_id = vf_id + hw->func_caps.vf_base_id;/* Notify VF that we are in VFR progress */ -I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_PF_VFR_INPROGRESS ); +I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_VFR_INPROGRESS );/* * If require a SW VF reset, a VFLR interrupt will be generated,
@@ -220,7 +220,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset) }/* Reset done, Set COMPLETE flag and clear reset bit */ -I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_PF_VFR_COMPLETED ); +I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_VFR_COMPLETED ); val =I40E_READ_REG (hw,I40E_VPGEN_VFRTRIG (vf_id)); val &= ~I40E_VPGEN_VFRTRIG_VFSWR_MASK ;I40E_WRITE_REG (hw,I40E_VPGEN_VFRTRIG (vf_id), val);
@@ -248,6 +248,8 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)return -EFAULT ; } +I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_VFR_VFACTIVE ); +return ret; }
drivers/net/i40e/i40e_pf.h +0 -5
@@ -48,11 +48,6 @@#define I40E_DPDK_OFFSET 0x100 -enum i40e_pf_vfr_state { -I40E_PF_VFR_INPROGRESS =0 , -I40E_PF_VFR_COMPLETED =1 , -}; -/* DPDK pf driver specific command to VF */ enum i40e_virtchnl_ops_dpdk {/*
Signature · 1 line
2.9.3
PATCH v4 12/29 net/i40e: fix VF MAC address assignment
In reply to Ferruh YigitIf PF sets vf->mac_addr, in VF initialization hw->mac.addr will be set to that same value. It is possible to check if PF set a MAC address or not through the hw->mac.addr variable.
hw->mac.addr set by i40e_vf_parse_hw_config(), call stack is:
In PF sidei40e_pf_host_process_cmd_get_vf_resources()
eth_addr_copy(vf->mac_addr, vf_res->vsi_res[0].default_mac_address)
In VF sisei40evf_init_vf()
i40evf_get_vf_resources()
i40e_vf_parse_hw_config()
memcpy(hw->mac.addr, vsi_res->default_mac_addr)Updated code is after i40evf_get_vf_resources() and can benefit from hw->mac.addr variable.
--- drivers/net/i40e/i40e_ethdev_vf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +2 -6
@@ -1193,7 +1193,6 @@ i40evf_init_vf(struct rte_eth_dev *dev)int i, err, bufsz;struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct i40e_vf *vf =I40EVF_DEV_PRIVATE_TO_VF (dev->data->dev_private); -struct ether_addr *p_mac_addr;uint16_t interval =i40e_calc_itr_interval (I40E_QUEUE_ITR_INTERVAL_MAX );
@@ -1270,13 +1269,10 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter =I40E_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private);/* Store the MAC address configured by host, or generate random one */ - p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr); -if (is_valid_assigned_ether_addr (p_mac_addr)) {/* Configured by host */ -ether_addr_copy (p_mac_addr, (struct ether_addr *)hw->mac.addr); +if (is_valid_assigned_ether_addr ((struct ether_addr *)hw->mac.addr)) vf->flags |=I40E_FLAG_VF_MAC_BY_PF ; - }else { +else eth_random_addr (hw->mac.addr);/* Generate a random one */ - }/* If the PF host is not DPDK, set the interval of ITR0 to max*/ if (vf->version_major !=I40E_DPDK_VERSION_MAJOR ) {
Signature · 1 line
2.9.3
v4 cover Support VFD and DPDK PF + kernel VF on i40e
In reply to Qi Zhang1, VF Daemon (VFD)
VFD is an idea to control all the VFs from PF.
As we need to support the scenario kernel PF + DPDK VF,
DPDK follows the interface between kernel PF + kernel VF.
We don't want to introduce too many new messages between PF and VF.
So this patch set adds some new APIs to control VFs directly from PF.
The new APIs include,
1) set VF MAC anti-spoofing
2) set VF VLAN anti-spoofing
3) set TX loopback
4) set VF unicast promiscuous mode
5) set VF multicast promiscuous mode
6) set VF MTU
7) get/reset VF stats
8) set VF MAC address
9) set VF VLAN stripping
10) VF VLAN insertion
12) set VF broadcast mode
12) set VF VLAN tag
13) set VF VLAN filter
VFD also includes VF to PF mailbox message management by APP.
When PF receives mailbox messages from VF, PF should call the callback provided by APP to know if they're permitted to be processed.
2, Implement VF MAC address setting on VF.
3, Support the scenario DPDK PF + kernel VF.
v4:
- rebase on latest next-net
- move patch 10/29 testpmd part to patch 18/29
v3:
- fix issue that VF does not work for i40e
- remove patch for VDMq receive mode init
- move get/reset VF stats API into rte_pmd_i40
v2:
- fix the compile issues.
- fix the checkpatch warning and typo.
- update the commit log of some patches.
- fix the invalid port ID issue of testpmd.
Bernard Iremonger (7):
net/i40e: add set VF VLAN insert function net/i40e: set VF broadcast mode from PF net/i40e: set VF VLAN tag from PF
net/i40e: set VF VLAN filter from PF app/testpmd: add command to test VF broadcast mode on i40e app/testpmd: add command to test VF VLAN tag on i40e app/testpmd: handle i40e in VF VLAN filter command
Chen Jing D(Mark) (6):
net/i40e: add VF VLAN strip func
net/i40e: change version number to support Linux VF net/i40e: return correct VSI id
net/i40e: parse more VF parameter and configure net/i40e: support Linux VF to configure IRQ link list net/i40e: enhance in sanity check of MAC
Ferruh Yigit (3):
net/i40e: set VF MAC from PF support
net/i40e: set VF MAC from VF support
net/i40e: fix VF MAC address assignment
Qi Zhang (3):
net/i40e: enable VF MTU change
net/i40e: fix VF reset flow
net/i40e: set/clear VF stats from PF
Wenzhuo Lu (10):
net/i40e: support link status notification net/i40e: add callback to user on VF to PF mbox msg net/i40e: set VF MAC anti-spoofing from PF net/i40e: set VF VLAN anti-spoofing from PF net/i40e: set Tx loopback from PF
net/i40e: set VF unicast promisc mode from PF net/i40e: set VF multicast promisc mode from PF app/testpmd: use VFD APIs on i40e app/testpmd: use unicast promiscuous mode on i40e app/testpmd: use multicast promiscuous mode on i40e
app/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 473 +++++++++++++++- app/test-pmd/config.c | 17 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 32 ++ drivers/net/i40e/Makefile | 4 +- drivers/net/i40e/i40e_ethdev.c | 847 +++++++++++++++++++++++++++- drivers/net/i40e/i40e_ethdev.h | 5 +- drivers/net/i40e/i40e_ethdev_vf.c | 82 ++- drivers/net/i40e/i40e_pf.c | 417 ++++++++++++-- drivers/net/i40e/i40e_pf.h | 9 +- drivers/net/i40e/rte_pmd_i40e.h | 328 +++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 20 + 12 files changed, 2129 insertions(+), 107 deletions(-) create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
Signature · 1 line
2.9.3
PATCH v4 1/29 net/i40e: support link status notification
From: Wenzhuo Lu <[email protected]>
Add an API to expose the ability, that PF can notify VF when link status changes, to APP.
So if PF APP doesn't want to enable interruption but check link status by itself, PF APP can let VF know link status changed.
--- drivers/net/i40e/Makefile | 4 ++- drivers/net/i40e/i40e_ethdev.c | 28 +++++++++++++++ drivers/net/i40e/i40e_pf.c | 4 +-- drivers/net/i40e/i40e_pf.h | 4 ++- drivers/net/i40e/rte_pmd_i40e.h | 58 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 6 ++++ 6 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
drivers/net/i40e/Makefile +3 -1
@@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without
@@ -111,6 +111,8 @@ ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),) CFLAGS_i40e_rxtx_vec_sse.o += -msse4.1 endif +# install this header file +SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
drivers/net/i40e/i40e_ethdev.c +28 -0
@@ -62,6 +62,7 @@#include "i40e_rxtx.h" #include "i40e_pf.h" #include "i40e_regs.h" +#include "rte_pmd_i40e.h" #define ETH_I40E_FLOATING_VEB_ARG "enable_floating_veb"#define ETH_I40E_FLOATING_VEB_LIST_ARG "floating_veb_list"
@@ -9695,3 +9696,30 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)return ret; } + +int +rte_pmd_i40e_ping_vfs (uint8_t port,uint16_t vf) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + +i40e_notify_vf_link_status (dev, &pf->vfs[vf]); + +return 0 ; +}
drivers/net/i40e/i40e_pf.c +2 -2
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -897,7 +897,7 @@ i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,return ret; } -static void +void i40e_notify_vf_link_status (struct rte_eth_dev *dev,struct i40e_pf_vf *vf) {struct i40e_virtchnl_pf_event event;
drivers/net/i40e/i40e_pf.h +3 -1
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -123,5 +123,7 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev, uint8_t *msg, uint16_t msglen);int i40e_pf_host_init (struct rte_eth_dev *dev);int i40e_pf_host_uninit (struct rte_eth_dev *dev); +void i40e_notify_vf_link_status (struct rte_eth_dev *dev, +struct i40e_pf_vf *vf);#endif /* _I40E_PF_H_ */
drivers/net/i40e/rte_pmd_i40e.h new file +58 -0
58 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +6 -0
@@ -2,3 +2,9 @@ DPDK_2.0 { local: *; }; + +DPDK_17.02 { + global: + + rte_pmd_i40e_ping_vfs; +} DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 2/29 net/i40e: add callback to user on VF to PF mbox msg
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
The callback asks the user application if it is allowed to perform the mailbox messages.
If the return value from user is RTE_PMD_I40E_MB_EVENT_PROCEED then continue. If ACK or NACK, do nothing and send not_supported to VF.
--- drivers/net/i40e/i40e_pf.c | 230 ++++++++++++++++++++++++++++++++++------ drivers/net/i40e/rte_pmd_i40e.h | 21 ++++ 2 files changed, 216 insertions(+), 35 deletions(-)
drivers/net/i40e/i40e_pf.c +195 -35
@@ -55,6 +55,7 @@#include "i40e_ethdev.h" #include "i40e_rxtx.h" #include "i40e_pf.h" +#include "rte_pmd_i40e.h" #define I40E_CFG_CRCSTRIP_DEFAULT 1
@@ -272,14 +273,23 @@ i40e_pf_host_send_msg_to_vf(struct i40e_pf_vf *vf, }static void -i40e_pf_host_process_cmd_version (struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_version (struct i40e_pf_vf *vf,bool b_op) {struct i40e_virtchnl_version_info info; info.major =I40E_DPDK_VERSION_MAJOR ; info.minor =I40E_DPDK_VERSION_MINOR ; -i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_VERSION , -I40E_SUCCESS , (uint8_t *)&info,sizeof (info)); + +if (b_op) +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_VERSION , +I40E_SUCCESS , + (uint8_t *)&info, +sizeof (info)); +else +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_VERSION , +I40E_NOT_SUPPORTED , + (uint8_t *)&info, +sizeof (info)); } static int
@@ -292,13 +302,20 @@ i40e_pf_host_process_cmd_reset_vf(struct i40e_pf_vf *vf) }static int -i40e_pf_host_process_cmd_get_vf_resource (struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_get_vf_resource (struct i40e_pf_vf *vf,bool b_op) {struct i40e_virtchnl_vf_resource *vf_res =NULL ;struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);uint32_t len =0 ;int ret =I40E_SUCCESS ; +if (!b_op) { +i40e_pf_host_send_msg_to_vf (vf, +I40E_VIRTCHNL_OP_GET_VF_RESOURCES , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +/* only have 1 VSI by default */ len =sizeof (struct i40e_virtchnl_vf_resource ) + I40E_DEFAULT_VF_VSI_NUM *
@@ -423,7 +440,8 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,static int i40e_pf_host_process_cmd_config_vsi_queues (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);struct i40e_vsi *vsi = vf->vsi;
@@ -432,6 +450,13 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,struct i40e_virtchnl_queue_pair_info *vc_qpi;int i, ret =I40E_SUCCESS ; +if (!b_op) { +i40e_pf_host_send_msg_to_vf (vf, +I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (!msg || vc_vqci->num_queue_pairs > vsi->nb_qps || vc_vqci->num_queue_pairs >I40E_MAX_VSI_QP || msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqci,
@@ -482,7 +507,8 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_config_vsi_queues_ext (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);struct i40e_vsi *vsi = vf->vsi;
@@ -491,6 +517,14 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,struct i40e_virtchnl_queue_pair_ext_info *vc_qpei;int i, ret =I40E_SUCCESS ; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (!msg || vc_vqcei->num_queue_pairs > vsi->nb_qps || vc_vqcei->num_queue_pairs >I40E_MAX_VSI_QP || msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqcei,
@@ -539,12 +573,21 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_config_irq_map (struct i40e_pf_vf *vf, -uint8_t *msg,uint16_t msglen) +uint8_t *msg,uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ;struct i40e_virtchnl_irq_map_info *irqmap = (struct i40e_virtchnl_irq_map_info *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <sizeof (struct i40e_virtchnl_irq_map_info )) {PMD_DRV_LOG (ERR ,"buffer too short" ); ret =I40E_ERR_PARAM ;
@@ -646,12 +689,21 @@ i40e_pf_host_process_cmd_enable_queues(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_disable_queues (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ;struct i40e_virtchnl_queue_select *q_sel = (struct i40e_virtchnl_queue_select *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_DISABLE_QUEUES , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*q_sel)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -669,7 +721,8 @@ i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_add_ether_address (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -678,6 +731,14 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,int i;struct ether_addr *mac; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +memset (&filter,0 ,sizeof (struct i40e_mac_filter_info ));if (msg ==NULL || msglen <=sizeof (*addr_list)) {
@@ -707,7 +768,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_del_ether_address (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -715,6 +777,14 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,int i;struct ether_addr *mac; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <=sizeof (*addr_list)) {PMD_DRV_LOG (ERR ,"delete_ether_address argument too short" ); ret =I40E_ERR_PARAM ;
@@ -739,7 +809,8 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_add_vlan (struct i40e_pf_vf *vf, -uint8_t *msg,uint16_t msglen) +uint8_t *msg,uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -747,6 +818,14 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,int i;uint16_t *vid; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_ADD_VLAN , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <=sizeof (*vlan_filter_list)) {PMD_DRV_LOG (ERR ,"add_vlan argument too short" ); ret =I40E_ERR_PARAM ;
@@ -771,7 +850,8 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_del_vlan (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -779,6 +859,14 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,int i;uint16_t *vid; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_DEL_VLAN , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <=sizeof (*vlan_filter_list)) {PMD_DRV_LOG (ERR ,"delete_vlan argument too short" ); ret =I40E_ERR_PARAM ;
@@ -803,7 +891,8 @@ static inti40e_pf_host_process_cmd_config_promisc_mode ( struct i40e_pf_vf *vf, uint8_t *msg, - uint16_t msglen) + uint16_t msglen, + bool b_op) { int ret = I40E_SUCCESS; struct i40e_virtchnl_promisc_info *promisc =
@@ -811,6 +900,14 @@ i40e_pf_host_process_cmd_config_promisc_mode(struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);bool unicast = FALSE, multicast = FALSE; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*promisc)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -836,13 +933,20 @@ i40e_pf_host_process_cmd_config_promisc_mode( }static int -i40e_pf_host_process_cmd_get_stats (struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_get_stats (struct i40e_pf_vf *vf,bool b_op) {i40e_update_vsi_stats (vf->vsi); -i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_GET_STATS , -I40E_SUCCESS , (uint8_t *)&vf->vsi->eth_stats, -sizeof (vf->vsi->eth_stats)); +if (b_op) +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_GET_STATS , +I40E_SUCCESS , + (uint8_t *)&vf->vsi->eth_stats, +sizeof (vf->vsi->eth_stats)); +else +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_GET_STATS , +I40E_NOT_SUPPORTED , + (uint8_t *)&vf->vsi->eth_stats, +sizeof (vf->vsi->eth_stats));return I40E_SUCCESS ; }
@@ -851,12 +955,21 @@ static inti40e_pf_host_process_cmd_cfg_vlan_offload ( struct i40e_pf_vf *vf, uint8_t *msg, - uint16_t msglen) + uint16_t msglen, + bool b_op) { int ret = I40E_SUCCESS;struct i40e_virtchnl_vlan_offload_info *offload = (struct i40e_virtchnl_vlan_offload_info *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*offload)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -877,12 +990,21 @@ i40e_pf_host_process_cmd_cfg_vlan_offload(static int i40e_pf_host_process_cmd_cfg_pvid (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ;struct i40e_virtchnl_pvid_info *tpid_info = (struct i40e_virtchnl_pvid_info *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CFG_VLAN_PVID , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*tpid_info)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -923,6 +1045,8 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,struct i40e_pf_vf *vf;/* AdminQ will pass absolute VF id, transfer to internal vf id */ uint16_t vf_id = abs_vf_id - hw->func_caps.vf_base_id; +struct rte_pmd_i40e_mb_event_param cb_param; +bool b_op = TRUE;if (vf_id > pf->vf_num -1 || !pf->vfs) {PMD_DRV_LOG (ERR ,"invalid argument" );
@@ -937,10 +1061,35 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,return ; } +/** +* initialise structure to send to user application +* will return response from user in retval field +*/ + cb_param.retval =RTE_PMD_I40E_MB_EVENT_PROCEED ; + cb_param.vfid = vf_id; + cb_param.msg_type = opcode; + cb_param.msg = (void *)msg; + cb_param.msglen = msglen; + +/** +* Ask user application if we're allowed to perform those functions. +* If we get cb_param.retval == RTE_PMD_I40E_MB_EVENT_PROCEED, +* then business as usual. +* If RTE_PMD_I40E_MB_EVENT_NOOP_ACK or RTE_PMD_I40E_MB_EVENT_NOOP_NACK, +* do nothing and send not_supported to VF. As PF must send a response +* to VF and ACK/NACK is not defined. +*/ +_rte_eth_dev_callback_process (dev,RTE_ETH_EVENT_VF_MBOX , &cb_param); +if (cb_param.retval !=RTE_PMD_I40E_MB_EVENT_PROCEED ) { +PMD_DRV_LOG (WARNING ,"VF to PF message(%d) is not permitted!" , + opcode); + b_op = FALSE; + } +switch (opcode) {case I40E_VIRTCHNL_OP_VERSION :PMD_DRV_LOG (INFO ,"OP_VERSION received" ); -i40e_pf_host_process_cmd_version (vf); +i40e_pf_host_process_cmd_version (vf, b_op);break ;case I40E_VIRTCHNL_OP_RESET_VF :PMD_DRV_LOG (INFO ,"OP_RESET_VF received" );
@@ -948,61 +1097,72 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,break ;case I40E_VIRTCHNL_OP_GET_VF_RESOURCES :PMD_DRV_LOG (INFO ,"OP_GET_VF_RESOURCES received" ); -i40e_pf_host_process_cmd_get_vf_resource (vf); +i40e_pf_host_process_cmd_get_vf_resource (vf, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES :PMD_DRV_LOG (INFO ,"OP_CONFIG_VSI_QUEUES received" ); -i40e_pf_host_process_cmd_config_vsi_queues (vf, msg, msglen); +i40e_pf_host_process_cmd_config_vsi_queues (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT :PMD_DRV_LOG (INFO ,"OP_CONFIG_VSI_QUEUES_EXT received" );i40e_pf_host_process_cmd_config_vsi_queues_ext (vf, msg, - msglen); + msglen, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP :PMD_DRV_LOG (INFO ,"OP_CONFIG_IRQ_MAP received" ); -i40e_pf_host_process_cmd_config_irq_map (vf, msg, msglen); +i40e_pf_host_process_cmd_config_irq_map (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_ENABLE_QUEUES :PMD_DRV_LOG (INFO ,"OP_ENABLE_QUEUES received" ); -i40e_pf_host_process_cmd_enable_queues (vf, msg, msglen); -i40e_notify_vf_link_status (dev, vf); +if (b_op) { +i40e_pf_host_process_cmd_enable_queues (vf, msg, msglen); +i40e_notify_vf_link_status (dev, vf); + }else { +i40e_pf_host_send_msg_to_vf ( + vf,I40E_VIRTCHNL_OP_ENABLE_QUEUES , +I40E_NOT_SUPPORTED ,NULL ,0 ); + }break ;case I40E_VIRTCHNL_OP_DISABLE_QUEUES :PMD_DRV_LOG (INFO ,"OP_DISABLE_QUEUE received" ); -i40e_pf_host_process_cmd_disable_queues (vf, msg, msglen); +i40e_pf_host_process_cmd_disable_queues (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS :PMD_DRV_LOG (INFO ,"OP_ADD_ETHER_ADDRESS received" ); -i40e_pf_host_process_cmd_add_ether_address (vf, msg, msglen); +i40e_pf_host_process_cmd_add_ether_address (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS :PMD_DRV_LOG (INFO ,"OP_DEL_ETHER_ADDRESS received" ); -i40e_pf_host_process_cmd_del_ether_address (vf, msg, msglen); +i40e_pf_host_process_cmd_del_ether_address (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_ADD_VLAN :PMD_DRV_LOG (INFO ,"OP_ADD_VLAN received" ); -i40e_pf_host_process_cmd_add_vlan (vf, msg, msglen); +i40e_pf_host_process_cmd_add_vlan (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_DEL_VLAN :PMD_DRV_LOG (INFO ,"OP_DEL_VLAN received" ); -i40e_pf_host_process_cmd_del_vlan (vf, msg, msglen); +i40e_pf_host_process_cmd_del_vlan (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE :PMD_DRV_LOG (INFO ,"OP_CONFIG_PROMISCUOUS_MODE received" ); -i40e_pf_host_process_cmd_config_promisc_mode (vf, msg, msglen); +i40e_pf_host_process_cmd_config_promisc_mode (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_GET_STATS :PMD_DRV_LOG (INFO ,"OP_GET_STATS received" ); -i40e_pf_host_process_cmd_get_stats (vf); +i40e_pf_host_process_cmd_get_stats (vf, b_op);break ;case I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD :PMD_DRV_LOG (INFO ,"OP_CFG_VLAN_OFFLOAD received" ); -i40e_pf_host_process_cmd_cfg_vlan_offload (vf, msg, msglen); +i40e_pf_host_process_cmd_cfg_vlan_offload (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_CFG_VLAN_PVID :PMD_DRV_LOG (INFO ,"OP_CFG_VLAN_PVID received" ); -i40e_pf_host_process_cmd_cfg_pvid (vf, msg, msglen); +i40e_pf_host_process_cmd_cfg_pvid (vf, msg, msglen, b_op);break ;/* Don't add command supported below, which will * return an error code.
drivers/net/i40e/rte_pmd_i40e.h +21 -0
@@ -42,6 +42,27 @@#include <rte_ethdev.h> /** +* Response sent back to i40e driver from user app after callback +*/ +enum rte_pmd_i40e_mb_event_rsp { +RTE_PMD_I40E_MB_EVENT_NOOP_ACK ,/**< skip mbox request and ACK */ +RTE_PMD_I40E_MB_EVENT_NOOP_NACK ,/**< skip mbox request and NACK */ +RTE_PMD_I40E_MB_EVENT_PROCEED ,/**< proceed with mbox request */ +RTE_PMD_I40E_MB_EVENT_MAX /**< max value of this enum */ +}; + +/** +* Data sent to the user application when the callback is executed. +*/ +struct rte_pmd_i40e_mb_event_param { +uint16_t vfid;/**< Virtual Function number */ +uint16_t msg_type;/**< VF to PF message type, see i40e_virtchnl_ops */ +uint16_t retval;/**< return value */ +void *msg;/**< pointer to message */ +uint16_t msglen;/**< length of the message */ +}; + +/** * Notify VF when PF link status changes. * * @param port
Signature · 1 line
2.9.3
PATCH v4 3/29 net/i40e: set VF MAC anti-spoofing from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF MAC anti-spoofing from PF.
User can call the API on PF to enable/disable a specific VF's MAC anti-spoofing.
--- drivers/net/i40e/i40e_ethdev.c | 63 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 83 insertions(+)
drivers/net/i40e/i40e_ethdev.c +63 -0
@@ -9723,3 +9723,66 @@ rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)return 0 ; } + +int +rte_pmd_i40e_set_vf_mac_anti_spoof (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +struct i40e_hw *hw; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + +/* Check if it has been already on or off */ +if (vsi->info.valid_sections & +rte_cpu_to_le_16 (I40E_AQ_VSI_PROP_SECURITY_VALID )) { +if (on) { +if ((vsi->info.sec_flags & +I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ) == +I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ) +return 0 ;/* already on */ + }else { +if ((vsi->info.sec_flags & +I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ) ==0 ) +return 0 ;/* already off */ + } + } + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_SECURITY_VALID ); +if (on) + vsi->info.sec_flags |=I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ; +else + vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -76,4 +76,23 @@ struct rte_pmd_i40e_mb_event_param {*/ int rte_pmd_i40e_ping_vfs (uint8_t port,uint16_t vf); +/** +* Enable/Disable VF MAC anti spoofing. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set MAC anti spoofing. +* @param on +* 1 - Enable VFs MAC anti spoofing. +* 0 - Disable VFs MAC anti spoofing. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_mac_anti_spoof (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -7,4 +7,5 @@ DPDK_17.02 { global: rte_pmd_i40e_ping_vfs; + rte_pmd_i40e_set_vf_mac_anti_spoof; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 4/29 net/i40e: set VF VLAN anti-spoofing from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF VLAN anti-spoofing from PF.
User can call the API on PF to enable/disable a specific VF's VLAN anti-spoofing.
--- drivers/net/i40e/i40e_ethdev.c | 116 +++++++++++++++++++++++++++++- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/rte_pmd_i40e.h | 19 +++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 4 files changed, 135 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +114 -2
@@ -4418,6 +4418,7 @@ i40e_vsi_setup(struct i40e_pf *pf, vsi->max_macaddrs =I40E_NUM_MACADDR_MAX ; vsi->parent_vsi = uplink_vsi ? uplink_vsi : pf->main_vsi; vsi->user_param = user_param; + vsi->vlan_anti_spoof_on =0 ;/* Allocate queues */ switch (vsi->type) {case I40E_VSI_MAIN :
@@ -5761,17 +5762,35 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, uint16_t vlan_id, bool on) { uint32_t vid_idx, vid_bit; +struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0 }; +int ret;if (vlan_id >ETH_VLAN_ID_MAX )return ; vid_idx =I40E_VFTA_IDX (vlan_id); vid_bit =I40E_VFTA_BIT (vlan_id); + vlan_data.vlan_tag =rte_cpu_to_le_16 (vlan_id); -if (on) +if (on) { +if (vsi->vlan_anti_spoof_on) { + ret =i40e_aq_add_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to add vlan filter" ); + } vsi->vfta[vid_idx] |= vid_bit; -else + }else { +if (vsi->vlan_anti_spoof_on) { + ret =i40e_aq_remove_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR , +"Failed to remove vlan filter" ); + } vsi->vfta[vid_idx] &= ~vid_bit; + } }/**
@@ -9786,3 +9805,96 @@ rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +static int +i40e_add_rm_all_vlan_filter (struct i40e_vsi *vsi,uint8_t add) +{ +uint32_t j, k; +uint16_t vlan_id; +struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0 }; +int ret; + +for (j =0 ; j <I40E_VFTA_SIZE ; j++) { +if (!vsi->vfta[j]) +continue ; + +for (k =0 ; k <I40E_UINT32_BIT_SIZE ; k++) { +if (!(vsi->vfta[j] & (1 << k))) +continue ; + + vlan_id = j *I40E_UINT32_BIT_SIZE + k; + vlan_data.vlan_tag =rte_cpu_to_le_16 (vlan_id); +if (add) + ret =i40e_aq_add_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +else + ret =i40e_aq_remove_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +if (ret !=I40E_SUCCESS ) { +PMD_DRV_LOG (ERR , +"Failed to add/rm vlan filter" ); +return ret; + } + } + } + +return I40E_SUCCESS ; +} + +int +rte_pmd_i40e_set_vf_vlan_anti_spoof (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +struct i40e_hw *hw; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + +/* Check if it has been already on or off */ +if (vsi->vlan_anti_spoof_on == on) +return 0 ;/* already on or off */ + + vsi->vlan_anti_spoof_on = on; + ret =i40e_add_rm_all_vlan_filter (vsi, on); +if (ret) +return ret; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_SECURITY_VALID ); +if (on) + vsi->info.sec_flags |=I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK ; +else + vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK ; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -300,6 +300,7 @@ struct i40e_vsi {uint16_t msix_intr;/* The MSIX interrupt binds to VSI */ uint16_t nb_msix;/* The max number of msix vector */ uint8_t enabled_tc;/* The traffic class enabled */ +uint8_t vlan_anti_spoof_on;/* The VLAN anti-spoofing enabled */ struct i40e_bw_info bw_info;/* VSI bandwidth information */ };
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -95,4 +95,23 @@ int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Enable/Disable VF VLAN anti spoofing. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set VLAN anti spoofing. +* @param on +* 1 - Enable VFs VLAN anti spoofing. +* 0 - Disable VFs VLAN anti spoofing. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_vlan_anti_spoof (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -8,4 +8,5 @@ DPDK_17.02 { rte_pmd_i40e_ping_vfs; rte_pmd_i40e_set_vf_mac_anti_spoof; + rte_pmd_i40e_set_vf_vlan_anti_spoof; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 5/29 net/i40e: set Tx loopback from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling TX loopback from PF. User can call the API on PF to enable/disable TX loopback for all the PF and VFs.
--- drivers/net/i40e/i40e_ethdev.c | 219 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 16 +++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 236 insertions(+)
drivers/net/i40e/i40e_ethdev.c +219 -0
@@ -9898,3 +9898,222 @@ rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +static int +i40e_vsi_rm_mac_filter (struct i40e_vsi *vsi) +{ +struct i40e_mac_filter *f; +struct i40e_macvlan_filter *mv_f; +int i, vlan_num; +enum rte_mac_filter_type filter_type; +int ret =I40E_SUCCESS ; + +/* remove all the MACs */ + TAILQ_FOREACH(f, &vsi->mac_list, next) { + vlan_num = vsi->vlan_num; + filter_type = f->mac_info.filter_type; +if (filter_type ==RTE_MACVLAN_PERFECT_MATCH || + filter_type ==RTE_MACVLAN_HASH_MATCH ) { +if (vlan_num ==0 ) { +PMD_DRV_LOG (ERR , +"VLAN number shouldn't be 0\n" ); +return I40E_ERR_PARAM ; + } + }else if (filter_type ==RTE_MAC_PERFECT_MATCH || + filter_type ==RTE_MAC_HASH_MATCH ) + vlan_num =1 ; + + mv_f =rte_zmalloc ("macvlan_data" , vlan_num *sizeof (*mv_f),0 ); +if (!mv_f) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return I40E_ERR_NO_MEMORY ; + } + +for (i =0 ; i < vlan_num; i++) { + mv_f[i].filter_type = filter_type; + (void )rte_memcpy (&mv_f[i].macaddr, + &f->mac_info.mac_addr, +ETH_ADDR_LEN ); + } +if (filter_type ==RTE_MACVLAN_PERFECT_MATCH || + filter_type ==RTE_MACVLAN_HASH_MATCH ) { + ret =i40e_find_all_vlan_for_mac (vsi, mv_f, vlan_num, + &f->mac_info.mac_addr); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + } + + ret =i40e_remove_macvlan_filters (vsi, mv_f, vlan_num); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + +rte_free (mv_f); + ret =I40E_SUCCESS ; + } + +return ret; +} + +static int +i40e_vsi_restore_mac_filter (struct i40e_vsi *vsi) +{ +struct i40e_mac_filter *f; +struct i40e_macvlan_filter *mv_f; +int i, vlan_num =0 ; +int ret =I40E_SUCCESS ; + +/* restore all the MACs */ + TAILQ_FOREACH(f, &vsi->mac_list, next) { +if ((f->mac_info.filter_type ==RTE_MACVLAN_PERFECT_MATCH ) || + (f->mac_info.filter_type ==RTE_MACVLAN_HASH_MATCH )) { +/** +* If vlan_num is 0, that's the first time to add mac, +* set mask for vlan_id 0. +*/ +if (vsi->vlan_num ==0 ) { +i40e_set_vlan_filter (vsi,0 ,1 ); + vsi->vlan_num =1 ; + } + vlan_num = vsi->vlan_num; + }else if ((f->mac_info.filter_type ==RTE_MAC_PERFECT_MATCH ) || + (f->mac_info.filter_type ==RTE_MAC_HASH_MATCH )) + vlan_num =1 ; + + mv_f =rte_zmalloc ("macvlan_data" , vlan_num *sizeof (*mv_f),0 ); +if (!mv_f) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return I40E_ERR_NO_MEMORY ; + } + +for (i =0 ; i < vlan_num; i++) { + mv_f[i].filter_type = f->mac_info.filter_type; + (void )rte_memcpy (&mv_f[i].macaddr, + &f->mac_info.mac_addr, +ETH_ADDR_LEN ); + } + +if (f->mac_info.filter_type ==RTE_MACVLAN_PERFECT_MATCH || + f->mac_info.filter_type ==RTE_MACVLAN_HASH_MATCH ) { + ret =i40e_find_all_vlan_for_mac (vsi, mv_f, vlan_num, + &f->mac_info.mac_addr); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + } + + ret =i40e_add_macvlan_filters (vsi, mv_f, vlan_num); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + +rte_free (mv_f); + ret =I40E_SUCCESS ; + } + +return ret; +} + +static int +i40e_vsi_set_tx_loopback (struct i40e_vsi *vsi,uint8_t on) +{ +struct i40e_vsi_context ctxt; +struct i40e_hw *hw; +int ret; + + hw =I40E_VSI_TO_HW (vsi); + +/* Use the FW API if FW >= v5.0 */ +if (hw->aq.fw_maj_ver <5 ) { +PMD_INIT_LOG (ERR ,"FW < v5.0, cannot enable loopback" ); +return -ENOTSUP ; + } + +/* Check if it has been already on or off */ +if (vsi->info.valid_sections & +rte_cpu_to_le_16 (I40E_AQ_VSI_PROP_SWITCH_VALID )) { +if (on) { +if ((vsi->info.switch_id & +I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ) == +I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ) +return 0 ;/* already on */ + }else { +if ((vsi->info.switch_id & +I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ) ==0 ) +return 0 ;/* already off */ + } + } + +/* remove all the MACs first */ + ret =i40e_vsi_rm_mac_filter (vsi); +if (ret) +return ret; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_SWITCH_VALID ); +if (on) + vsi->info.switch_id |=I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ; +else + vsi->info.switch_id &= ~I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) { +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); +return ret; + } + +/* add all the MACs back */ + ret =i40e_vsi_restore_mac_filter (vsi); +if (ret) +return ret; + +return ret; +} + +int +rte_pmd_i40e_set_tx_loopback (uint8_t port,uint8_t on) +{ +struct rte_eth_dev *dev; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +uint16_t vf_id; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +/* setup PF TX loopback */ + vsi = pf->main_vsi; + ret =i40e_vsi_set_tx_loopback (vsi, on); +if (ret) +return ret; + +/* setup TX loopback for all the VFs */ +if (!pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + +for (vf_id =0 ; vf_id < pf->vf_num; vf_id++) { + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + + ret =i40e_vsi_set_tx_loopback (vsi, on); +if (ret) +return ret; + } + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +16 -0
@@ -114,4 +114,20 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Enable/Disable TX loopback on all the PF and VFs. +* +* @param port +* The port identifier of the Ethernet device. +* @param on +* 1 - Enable TX loopback. +* 0 - Disable TX loopback. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_tx_loopback (uint8_t port, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -9,4 +9,5 @@ DPDK_17.02 { rte_pmd_i40e_ping_vfs; rte_pmd_i40e_set_vf_mac_anti_spoof; rte_pmd_i40e_set_vf_vlan_anti_spoof; + rte_pmd_i40e_set_tx_loopback; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 6/29 net/i40e: set VF unicast promisc mode from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF unicast promiscuous mode from PF.
User can call the API on PF to enable/disable a specific VF's unicast promiscuous mode.
--- drivers/net/i40e/i40e_ethdev.c | 36 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 56 insertions(+)
drivers/net/i40e/i40e_ethdev.c +36 -0
@@ -10117,3 +10117,39 @@ rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)return ret; } + +int +rte_pmd_i40e_set_vf_unicast_promisc (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + hw =I40E_VSI_TO_HW (vf->vsi); + + ret =i40e_aq_set_vsi_unicast_promiscuous (hw, vf->vsi->seid, + on,NULL , true); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set unicast promiscuous mode" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -130,4 +130,23 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,int rte_pmd_i40e_set_tx_loopback (uint8_t port,uint8_t on); +/** +* Enable/Disable VF unicast promiscuous mode. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set. +* @param on +* 1 - Enable. +* 0 - Disable. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_unicast_promisc (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -10,4 +10,5 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_mac_anti_spoof; rte_pmd_i40e_set_vf_vlan_anti_spoof; rte_pmd_i40e_set_tx_loopback; + rte_pmd_i40e_set_vf_unicast_promisc; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 7/29 net/i40e: set VF multicast promisc mode from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF multicast promiscuous mode from PF.
User can call the API on PF to enable/disable a specific VF's multicast promiscuous mode.
--- drivers/net/i40e/i40e_ethdev.c | 36 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 56 insertions(+)
drivers/net/i40e/i40e_ethdev.c +36 -0
@@ -10153,3 +10153,39 @@ rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +int +rte_pmd_i40e_set_vf_multicast_promisc (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + hw =I40E_VSI_TO_HW (vf->vsi); + + ret =i40e_aq_set_vsi_multicast_promiscuous (hw, vf->vsi->seid, + on,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set multicast promiscuous mode" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -149,4 +149,23 @@ int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Enable/Disable VF multicast promiscuous mode. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set. +* @param on +* 1 - Enable. +* 0 - Disable. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_multicast_promisc (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -11,4 +11,5 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_anti_spoof; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_unicast_promisc; + rte_pmd_i40e_set_vf_multicast_promisc; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 8/29 net/i40e: enable VF MTU change
In reply to Ferruh YigitFrom: Qi Zhang <[email protected]>
This patch implement mtu_set ops for i40e VF.
--- drivers/net/i40e/i40e_ethdev_vf.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/net/i40e/i40e_ethdev_vf.c +33 -0
@@ -151,6 +151,7 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf);static int i40evf_dev_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf); +static int i40evf_dev_mtu_set (struct rte_eth_dev *dev,uint16_t mtu);static int i40evf_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); static int
@@ -225,6 +226,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .reta_query = i40evf_dev_rss_reta_query, .rss_hash_update = i40evf_dev_rss_hash_update, .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, + .mtu_set = i40evf_dev_mtu_set, };/*
@@ -2641,3 +2643,34 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,return 0 ; } + +static int +i40evf_dev_mtu_set (struct rte_eth_dev *dev,uint16_t mtu) +{ +struct i40e_vf *vf =I40EVF_DEV_PRIVATE_TO_VF (dev->data->dev_private); +struct rte_eth_dev_data *dev_data = vf->dev_data; +uint32_t frame_size = mtu +ETHER_HDR_LEN + +ETHER_CRC_LEN +I40E_VLAN_TAG_SIZE ; +int ret =0 ; + +/* check if mtu is within the allowed range */ +if ((mtu <ETHER_MIN_MTU ) || (frame_size >I40E_FRAME_SIZE_MAX )) +return -EINVAL ; + +/* mtu setting is forbidden if port is start */ +if (dev_data->dev_started) { +PMD_DRV_LOG (ERR , +"port %d must be stopped before configuration\n" , + dev_data->port_id); +return -EBUSY ; + } + +if (frame_size >ETHER_MAX_LEN ) + dev_data->dev_conf.rxmode.jumbo_frame =1 ; +else + dev_data->dev_conf.rxmode.jumbo_frame =0 ; + + dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size; + +return ret; +}
Signature · 1 line
2.9.3
PATCH v4 10/29 net/i40e: set VF MAC from PF support
In reply to Ferruh YigitSupport setting VF MAC address from PF.
User can call the API on PF to set a specific
VF's MAC address.
This will remove all existing MAC filters.
--- drivers/net/i40e/i40e_ethdev.c | 40 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 2 ++ 3 files changed, 61 insertions(+)
drivers/net/i40e/i40e_ethdev.c +40 -0
@@ -10189,3 +10189,43 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +int +rte_pmd_i40e_set_vf_mac_addr (uint8_t port,uint16_t vf_id, +struct ether_addr *mac_addr) +{ +struct rte_eth_dev_info dev_info; +struct i40e_mac_filter *f; +struct rte_eth_dev *dev; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +struct i40e_pf *pf; +void *temp; + +if (i40e_validate_mac_addr ((u8 *)mac_addr) !=I40E_SUCCESS ) +return -EINVAL ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) +return -EINVAL ; + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + +ether_addr_copy (mac_addr, &vf->mac_addr); + +/* Remove all existing mac */ + TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) +i40e_vsi_delete_mac (vsi, &f->mac_info.mac_addr); + +return 0 ; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -168,4 +168,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Set the VF MAC address. +* +* This will remove all existing MAC filters. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf_id +* VF id. +* @param mac_addr +* VF MAC address. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if *vf* or *mac_addr* is invalid. +*/ +int rte_pmd_i40e_set_vf_mac_addr (uint8_t port,uint16_t vf_id, +struct ether_addr *mac_addr); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +2 -0
@@ -12,4 +12,6 @@ DPDK_17.02 { rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_unicast_promisc; rte_pmd_i40e_set_vf_multicast_promisc; + rte_pmd_i40e_set_vf_mac_addr; + } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 11/29 net/i40e: set VF MAC from VF support
In reply to Ferruh YigitSupport changing VF default MAC address.
This function is not supported if PF set the MAC
address for the PF.
--- drivers/net/i40e/i40e_ethdev.h | 4 +++- drivers/net/i40e/i40e_ethdev_vf.c | 49 +++++++++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 8 deletions(-)
drivers/net/i40e/i40e_ethdev.h +3 -1
@@ -126,6 +126,7 @@ enum i40e_flxpld_layer_idx {#define I40E_FLAG_FDIR (1ULL << 6)#define I40E_FLAG_VXLAN (1ULL << 7)#define I40E_FLAG_RSS_AQ_CAPABLE (1ULL << 8) +#define I40E_FLAG_VF_MAC_BY_PF (1ULL << 9)#define I40E_FLAG_ALL (I40E_FLAG_RSS | \ I40E_FLAG_DCB | \ I40E_FLAG_VMDQ | \
@@ -134,7 +135,8 @@ enum i40e_flxpld_layer_idx { I40E_FLAG_HEADER_SPLIT_ENABLED | \ I40E_FLAG_FDIR | \ I40E_FLAG_VXLAN | \ - I40E_FLAG_RSS_AQ_CAPABLE) + I40E_FLAG_RSS_AQ_CAPABLE | \ + I40E_FLAG_VF_MAC_BY_PF)#define I40E_RSS_OFFLOAD_ALL ( \ ETH_RSS_FRAG_IPV4 | \
drivers/net/i40e/i40e_ethdev_vf.c +42 -7
92 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 13/29 net/i40e: add VF VLAN strip func
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
Add a function to configure vlan strip enable/disable for specific SRIOV VF device.
--- drivers/net/i40e/i40e_ethdev.c | 26 ++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 46 insertions(+)
drivers/net/i40e/i40e_ethdev.c +26 -0
@@ -10229,3 +10229,29 @@ rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,return 0 ; } + +/* Set vlan strip on/off for specific VF from host */ +int +rte_pmd_i40e_set_vf_vlan_stripq (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct i40e_pf *pf; +struct i40e_vsi *vsi; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vsi = pf->vfs[vf_id].vsi; + +if (vsi) +return i40e_vsi_config_vlan_stripping (vsi, !!on); +else +return -EINVAL ; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -187,4 +187,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,int rte_pmd_i40e_set_vf_mac_addr (uint8_t port,uint16_t vf_id,struct ether_addr *mac_addr); +/** +* Enable/Disable vf vlan strip for all queues in a pool +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param on +* 1 - Enable VF's vlan strip on RX queues. +* 0 - Disable VF's vlan strip on RX queues. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int +rte_pmd_i40e_set_vf_vlan_stripq (uint8_t port,uint16_t vf,uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -13,5 +13,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_unicast_promisc; rte_pmd_i40e_set_vf_multicast_promisc; rte_pmd_i40e_set_vf_mac_addr; + rte_pmd_i40e_set_vf_vlan_stripq; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 14/29 net/i40e: add set VF VLAN insert function
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
Support inserting VF VLAN id from PF.
User can call the API on PF to insert a VLAN id to a specific VF.
--- drivers/net/i40e/i40e_ethdev.c | 53 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 73 insertions(+)
drivers/net/i40e/i40e_ethdev.c +53 -0
@@ -10255,3 +10255,56 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)else return -EINVAL ; } + +int rte_pmd_i40e_set_vf_vlan_insert (uint8_t port,uint16_t vf_id, +uint16_t vlan_id) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +struct i40e_vsi *vsi; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =I40E_PF_TO_HW (pf); + +/** +* return -ENODEV if SRIOV not enabled, VF number not configured +* or no queue assigned. +*/ +if (!hw->func_caps.sr_iov_1_1 || pf->vf_num ==0 || + pf->vf_nb_qps ==0 ) +return -ENODEV ; + +if (vf_id >= pf->vf_num || !pf->vfs) +return -EINVAL ; + +if (vlan_id >ETHER_MAX_VLAN_ID ) +return -EINVAL ; + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_VLAN_VALID ); + vsi->info.port_vlan_flags |=I40E_AQ_VSI_PVLAN_INSERT_PVID ; + vsi->info.pvid = vlan_id; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -206,4 +206,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,int rte_pmd_i40e_set_vf_vlan_stripq (uint8_t port,uint16_t vf,uint8_t on); +/** +* Enable/Disable vf vlan insert +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param vlan_id +* 0 - Disable VF's vlan insert. +* n - Enable; n is inserted as the vlan id. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_vlan_insert (uint8_t port,uint16_t vf_id, +uint16_t vlan_id); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -14,5 +14,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_multicast_promisc; rte_pmd_i40e_set_vf_mac_addr; rte_pmd_i40e_set_vf_vlan_stripq; + rte_pmd_i40e_set_vf_vlan_insert; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 15/29 net/i40e: set VF broadcast mode from PF
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
Support enabling/disabling VF broadcast mode from PF. User can call the API on PF to enable/disable a specific VF's broadcast mode.
--- drivers/net/i40e/i40e_ethdev.c | 43 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 63 insertions(+)
drivers/net/i40e/i40e_ethdev.c +43 -0
@@ -10308,3 +10308,46 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,return ret; } + +int rte_pmd_i40e_set_vf_broadcast (uint8_t port,uint16_t vf_id, +uint8_t on) { +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =I40E_PF_TO_HW (pf); + +if (vf_id >= pf->vf_num || !pf->vfs) +return -EINVAL ; + +/** +* return -ENODEV if SRIOV not enabled, VF number not configured +* or no queue assigned. +*/ +if (!hw->func_caps.sr_iov_1_1 || pf->vf_num ==0 || pf->vf_nb_qps ==0 ) +return -ENODEV ; + + vf = &pf->vfs[vf_id]; + hw =I40E_VSI_TO_HW (vf->vsi); + + ret =i40e_aq_set_vsi_broadcast (hw, vf->vsi->seid, on,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set VSI broadcast" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -225,4 +225,23 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);int rte_pmd_i40e_set_vf_vlan_insert (uint8_t port,uint16_t vf_id,uint16_t vlan_id); +/** +* Enable/Disable vf broadcast mode +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param on +* 0 - Disable broadcast. +* 1 - Enable broadcast. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_broadcast (uint8_t port,uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -15,5 +15,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_mac_addr; rte_pmd_i40e_set_vf_vlan_stripq; rte_pmd_i40e_set_vf_vlan_insert; + rte_pmd_i40e_set_vf_broadcast; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 16/29 net/i40e: set VF VLAN tag from PF
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
Add rte_pmd_i40e_set_vf_vlan_tag API.
User can call the API on PF to enable/disable a specific VF's VLAN tag.
--- drivers/net/i40e/i40e_ethdev.c | 59 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 18 ++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 78 insertions(+)
drivers/net/i40e/i40e_ethdev.c +59 -0
@@ -10351,3 +10351,62 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,return ret; } + +int rte_pmd_i40e_set_vf_vlan_tag (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +struct i40e_vsi *vsi; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =I40E_PF_TO_HW (pf); + +/** +* return -ENODEV if SRIOV not enabled, VF number not configured +* or no queue assigned. +*/ +if (!hw->func_caps.sr_iov_1_1 || pf->vf_num ==0 || pf->vf_nb_qps ==0 ) +return -ENODEV ; + +if (vf_id >= pf->vf_num) +return -EINVAL ; + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_VLAN_VALID ); +if (on) { + vsi->info.port_vlan_flags |=I40E_AQ_VSI_PVLAN_MODE_TAGGED ; + vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_UNTAGGED ; + }else { + vsi->info.port_vlan_flags |=I40E_AQ_VSI_PVLAN_MODE_UNTAGGED ; + vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_TAGGED ; + } + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +18 -0
@@ -244,4 +244,22 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,int rte_pmd_i40e_set_vf_broadcast (uint8_t port,uint16_t vf_id,uint8_t on); +/** +* Enable/Disable vf vlan tag +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param vlan_id +* 0 - Disable VF's vlan tag. +* n - Enable VF's vlan tag. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_vlan_tag (uint8_t port,uint16_t vf_id,uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -16,5 +16,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_stripq; rte_pmd_i40e_set_vf_vlan_insert; rte_pmd_i40e_set_vf_broadcast; + rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 17/29 net/i40e: set VF VLAN filter from PF
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
add rte_pmd_i40e_set_vf_vlan_filter API.
User can call the API on PF to enable/disable
a set of VF's VLAN filters.
--- drivers/net/i40e/i40e_ethdev.c | 52 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 22 +++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 75 insertions(+)
drivers/net/i40e/i40e_ethdev.c +52 -0
@@ -10410,3 +10410,55 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +int rte_pmd_i40e_set_vf_vlan_filter (uint8_t port,uint16_t vlan_id, +uint64_t vf_mask,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +uint16_t pool_idx; +int ret =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vlan_id >ETHER_MAX_VLAN_ID ) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); +if ((pf->flags &I40E_FLAG_VMDQ ) ==0 ) { +PMD_INIT_LOG (ERR ,"Firmware doesn't support VMDQ" ); +return -ENOTSUP ; + } + +if (!pf->vmdq) { +PMD_INIT_LOG (INFO ,"VMDQ not configured" ); +return -ENOTSUP ; + } + +for (pool_idx =0 ; + pool_idx <ETH_64_POOLS && + pool_idx < pf->nb_cfg_vmdq_vsi && + ret ==I40E_SUCCESS ; + pool_idx++) { +if (vf_mask & ((uint64_t )(1ULL << pool_idx))) { +if (on) + ret =i40e_vsi_add_vlan (pf->vmdq[pool_idx].vsi, + vlan_id); +else + ret =i40e_vsi_delete_vlan ( + pf->vmdq[pool_idx].vsi, vlan_id); + } + } + +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set VF VLAN filter, on = %d" , on); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +22 -0
@@ -262,4 +262,26 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,*/ int rte_pmd_i40e_set_vf_vlan_tag (uint8_t port,uint16_t vf_id,uint8_t on); +/** +* Enable/Disable VF VLAN filter +* +* @param port +* The port identifier of the Ethernet device. +* @param vlan_id +* ID specifying VLAN +* @param vf_mask +* Mask to filter VF's +* @param on +* 0 - Disable VF's VLAN filter. +* 1 - Enable VF's VLAN filter. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (-ENOTSUP) VMDq not configured of not supported by firmware. +*/ +int rte_pmd_i40e_set_vf_vlan_filter (uint8_t port,uint16_t vlan_id, +uint64_t vf_mask,uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -17,5 +17,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_insert; rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_vlan_tag; + rte_pmd_i40e_set_vf_vlan_filter; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v4 18/29 app/testpmd: use VFD APIs on i40e
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
The new VF Daemon (VFD) APIs is implemented on i40e. Change testpmd code to use them, including VF MAC anti-spoofing, VF VLAN anti-spoofing, TX loopback, VF VLAN strip, VF VLAN insert.
--- app/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 125 ++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 100 insertions(+), 27 deletions(-)
app/test-pmd/Makefile +2 -0
@@ -58,7 +58,9 @@ SRCS-y += csumonly.c SRCS-y += icmpecho.c SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c +_LDLIBS-y += --whole-archive _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e CFLAGS_cmdline.o := -D_GNU_SOURCE
app/test-pmd/cmdline.c +98 -27
303 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v4 19/29 app/testpmd: use unicast promiscuous mode on i40e
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Add testpmd CLI to set VF unicast promiscuous mode on i40e.
--- app/test-pmd/cmdline.c | 86 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++ 2 files changed, 95 insertions(+)
app/test-pmd/cmdline.c +86 -0
@@ -395,6 +395,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set allmulti (port_id|all) (on|off)\n" " Set the allmulti mode on port_id, or all.\n\n" +"set vf promisc (port_id) (vf_id) (on|off)\n" +" Set unicast promiscuous mode for a VF from the PF.\n\n" +"set flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n"
@@ -11540,6 +11543,88 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = { }, }; +/* VF unicast promiscuous mode configuration */ + +/* Common result structure for VF unicast promiscuous mode */ +struct cmd_vf_promisc_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t promisc; +uint8_t port_id; +uint32_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for VF unicast promiscuous mode enable disable */ +cmdline_parse_token_string_t cmd_vf_promisc_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_promisc_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_promisc_promisc = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + promisc,"promisc" ); +cmdline_parse_token_num_t cmd_vf_promisc_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_promisc_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_promisc_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_promisc_result, + vf_id,UINT32 ); +cmdline_parse_token_string_t cmd_vf_promisc_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + on_off,"on#off" ); + +static void +cmd_set_vf_promisc_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_promisc_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + + ret =rte_pmd_i40e_set_vf_unicast_promisc (res->port_id, + res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d\n" , res->vf_id); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_promisc = { + .f = cmd_set_vf_promisc_parsed, + .data =NULL , + .help_str ="set vf unicast promiscuous mode for a VF from PF" , + .tokens = { + (void *)&cmd_vf_promisc_set, + (void *)&cmd_vf_promisc_vf, + (void *)&cmd_vf_promisc_promisc, + (void *)&cmd_vf_promisc_port_id, + (void *)&cmd_vf_promisc_vf_id, + (void *)&cmd_vf_promisc_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11704,6 +11789,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_traffic, (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, (cmdline_parse_inst_t *)&cmd_vf_rate_limit, + (cmdline_parse_inst_t *)&cmd_set_vf_promisc, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -0
@@ -820,6 +820,15 @@ Set the allmulti mode for a port or for all ports:: Same as the ifconfig (8) option. Controls how multicast packets are handled. +set promisc (for VF) +~~~~~~~~~~~~~~~~~~~~ + +Set the unicast promiscuous mode for a VF from PF. +It's supported by Intel i40e NICs now. +In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: + + testpmd> set vf promisc (port_id) (vf_id) (on|off) + set flow_ctrl rx ~~~~~~~~~~~~~~~~
Signature · 1 line
2.9.3
PATCH v4 20/29 app/testpmd: use multicast promiscuous mode on i40e
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Add testpmd CLI to set VF multicast promiscuous mode on i40e.
--- app/test-pmd/cmdline.c | 86 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++ 2 files changed, 95 insertions(+)
app/test-pmd/cmdline.c +86 -0
@@ -398,6 +398,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf promisc (port_id) (vf_id) (on|off)\n" " Set unicast promiscuous mode for a VF from the PF.\n\n" +"set vf allmulti (port_id) (vf_id) (on|off)\n" +" Set multicast promiscuous mode for a VF from the PF.\n\n" +"set flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n"
@@ -11625,6 +11628,88 @@ cmdline_parse_inst_t cmd_set_vf_promisc = { }, }; +/* VF multicast promiscuous mode configuration */ + +/* Common result structure for VF multicast promiscuous mode */ +struct cmd_vf_allmulti_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t allmulti; +uint8_t port_id; +uint32_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for VF multicast promiscuous mode enable disable */ +cmdline_parse_token_string_t cmd_vf_allmulti_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_allmulti_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_allmulti_allmulti = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + allmulti,"allmulti" ); +cmdline_parse_token_num_t cmd_vf_allmulti_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_allmulti_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_allmulti_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_allmulti_result, + vf_id,UINT32 ); +cmdline_parse_token_string_t cmd_vf_allmulti_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + on_off,"on#off" ); + +static void +cmd_set_vf_allmulti_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_allmulti_result *res = parsed_result; +int ret =0 ; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + + ret =rte_pmd_i40e_set_vf_multicast_promisc (res->port_id, + res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d\n" , res->vf_id); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_allmulti = { + .f = cmd_set_vf_allmulti_parsed, + .data =NULL , + .help_str ="set vf multicast promiscuous for a VF from PF" , + .tokens = { + (void *)&cmd_vf_allmulti_set, + (void *)&cmd_vf_allmulti_vf, + (void *)&cmd_vf_allmulti_allmulti, + (void *)&cmd_vf_allmulti_port_id, + (void *)&cmd_vf_allmulti_vf_id, + (void *)&cmd_vf_allmulti_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11790,6 +11875,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, (cmdline_parse_inst_t *)&cmd_vf_rate_limit, (cmdline_parse_inst_t *)&cmd_set_vf_promisc, + (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -0
@@ -829,6 +829,15 @@ In promiscuous mode packets are not dropped if they aren't for the specified MAC testpmd> set vf promisc (port_id) (vf_id) (on|off) +set allmulticast (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set the multicast promiscuous mode for a VF from PF. +It's supported by Intel i40e NICs now. +In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: + + testpmd> set vf allmulti (port_id) (vf_id) (on|off) + set flow_ctrl rx ~~~~~~~~~~~~~~~~
Signature · 1 line
2.9.3
PATCH v4 21/29 app/testpmd: add command to test VF broadcast mode on i40e
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
Add command to call rte_pmd_i40e_set_vf_broadcast. Add set vf broadcast in testpmd_funcs.rst file.
--- app/test-pmd/cmdline.c | 85 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 92 insertions(+)
app/test-pmd/cmdline.c +85 -0
@@ -274,6 +274,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf mac antispoof (port_id) (vf_id) (on|off).\n" " Set MAC antispoof for a VF from the PF.\n\n" +"set vf broadcast (port_id) (vf_id) (on|off)\n" +" Set VF broadcast for a VF from the PF.\n\n" +"vlan set strip (on|off) (port_id)\n" " Set the VLAN strip on a port.\n\n"
@@ -11710,6 +11713,87 @@ cmdline_parse_inst_t cmd_set_vf_allmulti = { }, }; +/* vf broadcast mode configuration */ + +/* Common result structure for vf broadcast */ +struct cmd_set_vf_broadcast_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t broadcast; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf broadcast enable disable */ +cmdline_parse_token_string_t cmd_set_vf_broadcast_set = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + set,"set" ); +cmdline_parse_token_string_t cmd_set_vf_broadcast_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_set_vf_broadcast_broadcast = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + broadcast,"broadcast" ); +cmdline_parse_token_num_t cmd_set_vf_broadcast_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_broadcast_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_set_vf_broadcast_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_broadcast_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_set_vf_broadcast_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + on_off,"on#off" ); + +static void +cmd_set_vf_broadcast_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_set_vf_broadcast_result *res = parsed_result; +int ret; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + + ret =rte_pmd_i40e_set_vf_broadcast (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_broadcast = { + .f = cmd_set_vf_broadcast_parsed, + .data =NULL , + .help_str ="set vf broadcast port_id vf_id on|off" , + .tokens = { + (void *)&cmd_set_vf_broadcast_set, + (void *)&cmd_set_vf_broadcast_vf, + (void *)&cmd_set_vf_broadcast_broadcast, + (void *)&cmd_set_vf_broadcast_port_id, + (void *)&cmd_set_vf_broadcast_vf_id, + (void *)&cmd_set_vf_broadcast_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11876,6 +11960,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_rate_limit, (cmdline_parse_inst_t *)&cmd_set_vf_promisc, (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, + (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -507,6 +507,13 @@ Set mac antispoof for a VF from the PF:: testpmd> set vf mac antispoof (port_id) (vf_id) (on|off) +set broadcast mode (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set broadcast mode for a VF from the PF:: + + testpmd> set vf broadcast (port_id) (vf_id) (on|off) + vlan set strip ~~~~~~~~~~~~~~
Signature · 1 line
2.9.3
PATCH v4 22/29 app/testpmd: add command to test VF VLAN tag on i40e
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
command is: set vf vlan tag port_id vf_id on|off
--- app/test-pmd/cmdline.c | 91 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 98 insertions(+)
app/test-pmd/cmdline.c +91 -0
@@ -292,6 +292,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf vlan antispoof (port_id) (vf_id) (on|off)\n" " Set VLAN antispoof for a VF from the PF.\n\n" +"set vf vlan tag (port_id) (vf_id) (on|off)\n" +" Set VLAN tag for a VF from the PF.\n\n" +"vlan set filter (on|off) (port_id)\n" " Set the VLAN filter on a port.\n\n"
@@ -11794,6 +11797,93 @@ cmdline_parse_inst_t cmd_set_vf_broadcast = { }, }; +/* vf vlan tag configuration */ + +/* Common result structure for vf vlan tag */ +struct cmd_set_vf_vlan_tag_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t vlan; +cmdline_fixed_string_t tag; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf vlan tag enable disable */ +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_set = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + set,"set" ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vlan = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + vlan,"vlan" ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_tag = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + tag,"tag" ); +cmdline_parse_token_num_t cmd_set_vf_vlan_tag_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_set_vf_vlan_tag_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + on_off,"on#off" ); + +static void +cmd_set_vf_vlan_tag_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_set_vf_vlan_tag_result *res = parsed_result; +int ret; +int is_on = (strcmp (res->on_off,"on" ) ==0 ) ?1 :0 ; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + + ret =rte_pmd_i40e_set_vf_vlan_tag (res->port_id, res->vf_id, is_on); +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_vlan_tag = { + .f = cmd_set_vf_vlan_tag_parsed, + .data =NULL , + .help_str ="set vf vlan tag port_id vf_id on|off" , + .tokens = { + (void *)&cmd_set_vf_vlan_tag_set, + (void *)&cmd_set_vf_vlan_tag_vf, + (void *)&cmd_set_vf_vlan_tag_vlan, + (void *)&cmd_set_vf_vlan_tag_tag, + (void *)&cmd_set_vf_vlan_tag_port_id, + (void *)&cmd_set_vf_vlan_tag_vf_id, + (void *)&cmd_set_vf_vlan_tag_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11961,6 +12051,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_promisc, (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, + (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -542,6 +542,13 @@ Set VLAN insert for a VF from the PF:: testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id) +vlan set tag (for VF) +~~~~~~~~~~~~~~~~~~~~~ + +Set VLAN tag for a VF from the PF:: + + testpmd> set vf vlan tag (port_id) (vf_id) (on|off) + vlan set antispoof (for VF) ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.9.3
PATCH v4 23/29 app/testpmd: handle i40e in VF VLAN filter command
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
modify set_vf_rx_vlan function to handle the i40e PMD.
--- app/test-pmd/config.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
app/test-pmd/config.c +15 -2
@@ -92,6 +92,9 @@#include <rte_ethdev.h> #include <rte_string_fns.h> #include <rte_cycles.h> +#ifdef RTE_LIBRTE_I40E_PMD +#include <rte_pmd_i40e.h> +#endif #ifdef RTE_LIBRTE_IXGBE_PMD #include <rte_pmd_ixgbe.h> #endif
@@ -2353,12 +2356,22 @@ void set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on) { int diag; +struct rte_eth_dev_info dev_info; + +rte_eth_dev_info_get (port_id, &dev_info); - diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on); +#ifdef RTE_LIBRTE_I40E_PMD +if (strstr (dev_info.driver_name,"i40e" ) !=NULL ) + diag =rte_pmd_i40e_set_vf_vlan_filter (port_id, vlan_id, + vf_mask, on); + else +#endif + diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, + vf_mask, on);if (diag ==0 )return ; -printf ("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed " +printf ("rte_pmd_xxx_set_vf_vlan_filter for port_id=%d failed " "diag=%d\n" , port_id, diag); }#endif
Signature · 1 line
2.9.3
PATCH v4 24/29 net/i40e: change version number to support Linux VF
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
i40e PF host only support to work with DPDK VF driver, Linux VF driver is not supported. This change will enhance in version number returned.
Current version info returned won't be able to be recognized by Linux VF driver, change to values that both DPDK VF and Linux driver can recognize.
The expense is original DPDK host specific feature like CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available.
DPDK VF also can't identify host driver by version number returned. It always assume talking with Linux PF.
--- drivers/net/i40e/i40e_pf.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +13 -2
@@ -279,8 +279,19 @@ i40e_pf_host_process_cmd_version(struct i40e_pf_vf *vf, bool b_op) {struct i40e_virtchnl_version_info info; - info.major =I40E_DPDK_VERSION_MAJOR ; - info.minor =I40E_DPDK_VERSION_MINOR ; +/* Respond like a Linux PF host in order to support both DPDK VF and +* Linux VF driver. The expense is original DPDK host specific feature +* like CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available. +* +* DPDK VF also can't identify host driver by version number returned. +* It always assume talking with Linux PF. +* +* TODO: +* Discuss with Linux driver maintainer if possible to carry more info +* in this function to identify it's Linux or DPDK host. +*/ + info.major =I40E_VIRTCHNL_VERSION_MAJOR ; + info.minor =I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS ;if (b_op) i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
Signature · 1 line
2.9.3
PATCH v4 25/29 net/i40e: return correct VSI id
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
PF host didn't return correct VSI id to VF.
This change fix it.
--- drivers/net/i40e/i40e_pf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +1 -2
@@ -351,8 +351,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, bool b_op)/* Change below setting if PF host can support more VSIs for VF */ vf_res->vsi_res[0 ].vsi_type =I40E_VSI_SRIOV ; -/* As assume Vf only has single VSI now, always return 0 */ - vf_res->vsi_res[0 ].vsi_id =0 ; + vf_res->vsi_res[0 ].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0 ].num_queue_pairs = vf->vsi->nb_qps;ether_addr_copy (&vf->mac_addr, (struct ether_addr *)vf_res->vsi_res[0 ].default_mac_addr);
Signature · 1 line
2.9.3
PATCH v4 26/29 net/i40e: parse more VF parameter and configure
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
When VF requested to configure TX queue, a few parameters are missed to be configured in PF host. This change have more fields parsed and configured for TX context.
--- drivers/net/i40e/i40e_pf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_pf.c +3 -1
@@ -422,10 +422,12 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,/* clear the context structure first */ memset (&tx_ctx,0 ,sizeof (tx_ctx)); - tx_ctx.new_context =1 ; tx_ctx.base = txq->dma_ring_addr /I40E_QUEUE_BASE_ADDR_UNIT ; tx_ctx.qlen = txq->ring_len; tx_ctx.rdylist =rte_le_to_cpu_16 (vf->vsi->info.qs_handle[0 ]); + tx_ctx.head_wb_ena = txq->headwb_enabled; + tx_ctx.head_wb_addr = txq->dma_headwb_addr; + err =i40e_clear_lan_tx_queue_context (hw, abs_queue_id);if (err !=I40E_SUCCESS )return err;
Signature · 1 line
2.9.3
PATCH v4 27/29 net/i40e: support Linux VF to configure IRQ link list
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
i40e PF host only support to work with DPDK VF driver, Linux VF driver is not supported. This change will enhance in configuring IRQ link list.
This Change will identify VF client by number of vector requested. DPDK VF will ask only single one while Linux VF will request at least 2. It will have different configuration for different clients. DPDK VF will be configured to link all queue together, while Linux VF will be configured per request.
--- drivers/net/i40e/i40e_pf.c | 151 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 138 insertions(+), 13 deletions(-)
drivers/net/i40e/i40e_pf.c +138 -13
@@ -585,14 +585,116 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,return ret; } +static void +i40e_pf_config_irq_link_list (struct i40e_pf_vf *vf, +struct i40e_virtchnl_vector_map *vvm) +{ +uint64_t linklistmap =0 , tempmap; +struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf); +uint16_t qid; +bool b_first_q = true; +enum i40e_queue_type qtype; +uint16_t vector_id; +uint32_t reg, reg_idx; +uint16_t itr_idx =0 , i; + + vector_id = vvm->vector_id; +/* setup the head */ +if (!vector_id) + reg_idx =I40E_VPINT_LNKLST0 (vf->vf_idx); +else + reg_idx =I40E_VPINT_LNKLSTN ( + ((hw->func_caps.num_msix_vectors_vf -1 ) * vf->vf_idx) + + (vector_id -1 )); + +if (vvm->rxq_map ==0 && vvm->txq_map ==0 ) { +I40E_WRITE_REG (hw, reg_idx, +I40E_VPINT_LNKLST0_FIRSTQ_INDX_MASK ); + goto cfg_irq_done; + } + +/* sort all rx and tx queues */ + tempmap = vvm->rxq_map; +for (i =0 ; i <sizeof (vvm->rxq_map) *8 ; i++) { +if (tempmap &0x1 ) + linklistmap |= (1 << (2 * i)); + tempmap >>=1 ; + } + + tempmap = vvm->txq_map; +for (i =0 ; i <sizeof (vvm->txq_map) *8 ; i++) { +if (tempmap &0x1 ) + linklistmap |= (1 << (2 * i +1 )); + tempmap >>=1 ; + } + +/* Link all rx and tx queues into a chained list */ + tempmap = linklistmap; + i =0 ; + b_first_q = true; +do { +if (tempmap &0x1 ) { + qtype = (enum i40e_queue_type )(i %2 ); + qid = vf->vsi->base_queue + i /2 ; +if (b_first_q) { +/* This is header */ + b_first_q = false; + reg = ((qtype << +I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT ) + | qid); + }else { +/* element in the link list */ + reg = (vector_id) | + (qtype <<I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT ) | + (qid <<I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | +BIT (I40E_QINT_RQCTL_CAUSE_ENA_SHIFT ) | + (itr_idx <<I40E_QINT_RQCTL_ITR_INDX_SHIFT ); + } +I40E_WRITE_REG (hw, reg_idx, reg); +/* find next register to program */ +switch (qtype) { +case I40E_QUEUE_TYPE_RX : + reg_idx =I40E_QINT_RQCTL (qid); + itr_idx = vvm->rxitr_idx; +break ; +case I40E_QUEUE_TYPE_TX : + reg_idx =I40E_QINT_TQCTL (qid); + itr_idx = vvm->txitr_idx; +break ; +default : +break ; + } + } + i++; + tempmap >>=1 ; + }while (tempmap); + +/* Terminate the link list */ + reg = (vector_id) | + (0 <<I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT ) | + (0x7FF <<I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | +BIT (I40E_QINT_RQCTL_CAUSE_ENA_SHIFT ) | + (itr_idx <<I40E_QINT_RQCTL_ITR_INDX_SHIFT ); +I40E_WRITE_REG (hw, reg_idx, reg); + +cfg_irq_done: +I40E_WRITE_FLUSH (hw); +} +static int i40e_pf_host_process_cmd_config_irq_map (struct i40e_pf_vf *vf,uint8_t *msg,uint16_t msglen,bool b_op) {int ret =I40E_SUCCESS ; +struct i40e_pf *pf = vf->pf; +struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);struct i40e_virtchnl_irq_map_info *irqmap = (struct i40e_virtchnl_irq_map_info *)msg; +struct i40e_virtchnl_vector_map *map; +int i; +uint16_t vector_id; +unsigned long qbit_max;if (!b_op) { i40e_pf_host_send_msg_to_vf(
@@ -608,23 +710,46 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, goto send_msg; } -/* Assume VF only have 1 vector to bind all queues */ -if (irqmap->num_vectors !=1 ) { -PMD_DRV_LOG (ERR ,"DKDK host only support 1 vector" ); - ret =I40E_ERR_PARAM ; +/* PF host will support both DPDK VF or Linux VF driver, identify by +* number of vectors requested. +*/ + +/* DPDK VF only requires single vector */ +if (irqmap->num_vectors ==1 ) { +/* This MSIX intr store the intr in VF range */ + vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; + vf->vsi->nb_msix = irqmap->num_vectors; + vf->vsi->nb_used_qps = vf->vsi->nb_qps; + +/* Don't care how the TX/RX queue mapping with this vector. +* Link all VF RX queues together. Only did mapping work. +* VF can disable/enable the intr by itself. +*/ +i40e_vsi_queues_bind_intr (vf->vsi); goto send_msg; } -/* This MSIX intr store the intr in VF range */ - vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; - vf->vsi->nb_msix = irqmap->num_vectors; - vf->vsi->nb_used_qps = vf->vsi->nb_qps; +/* Then, it's Linux VF driver */ + qbit_max =1 << pf->vf_nb_qp_max; +for (i =0 ; i < irqmap->num_vectors; i++) { + map = &irqmap->vecmap[i]; + + vector_id = map->vector_id; +/* validate msg params */ +if (vector_id >= hw->func_caps.num_msix_vectors_vf) { + ret =I40E_ERR_PARAM ; + goto send_msg; + } + +if ((map->rxq_map < qbit_max) && (map->txq_map < qbit_max)) { +i40e_pf_config_irq_link_list (vf, map); + }else { +/* configured queue size excceed limit */ + ret =I40E_ERR_PARAM ; + goto send_msg; + } + } -/* Don't care how the TX/RX queue mapping with this vector. -* Link all VF RX queues together. Only did mapping work. -* VF can disable/enable the intr by itself. -*/ -i40e_vsi_queues_bind_intr (vf->vsi); send_msg:i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP , ret,NULL ,0 );
Signature · 1 line
2.9.3
PATCH v4 28/29 net/i40e: enhance in sanity check of MAC
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
When VF sends request to add a new MAC address, PF host will check if it's a non-zero or unicast address, or it will return with error. In fact, VF still can set multicast address. This change remove to check if it's a unicast address.
--- drivers/net/i40e/i40e_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +2 -2
@@ -890,8 +890,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, mac = (struct ether_addr *)(addr_list->list[i].addr); (void )rte_memcpy (&filter.mac_addr, mac,ETHER_ADDR_LEN ); filter.filter_type =RTE_MACVLAN_PERFECT_MATCH ; -if (!is_valid_assigned_ether_addr (mac) || -i40e_vsi_add_mac (vf->vsi, &filter)) { +if (is_zero_ether_addr (mac) || +i40e_vsi_add_mac (vf->vsi, &filter)) { ret =I40E_ERR_INVALID_MAC_ADDR ; goto send_msg; }
Signature · 1 line
2.9.3
PATCH v4 29/29 net/i40e: set/clear VF stats from PF
In reply to Ferruh YigitFrom: Qi Zhang <[email protected]>
This patch add support to get/clear VF statistics
from PF side.
Two APIs are added:rte_pmd_i40e_get_vf_stats.rte_pmd_i40e_reset_vf_stats.
--- drivers/net/i40e/i40e_ethdev.c | 76 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 41 +++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 2 + 3 files changed, 119 insertions(+)
drivers/net/i40e/i40e_ethdev.c +76 -0
@@ -10462,3 +10462,79 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,return ret; } + +int +rte_pmd_i40e_get_vf_stats (uint8_t port, +uint16_t vf_id, +struct rte_eth_stats *stats) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_vsi *vsi; +int ret =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vsi = pf->vfs[vf_id].vsi; +i40e_update_vsi_stats (vsi); + + stats->ipackets = vsi->eth_stats.rx_unicast + + vsi->eth_stats.rx_multicast + + vsi->eth_stats.rx_broadcast; + stats->opackets = vsi->eth_stats.tx_unicast + + vsi->eth_stats.tx_multicast + + vsi->eth_stats.tx_broadcast; + stats->ibytes = vsi->eth_stats.rx_bytes; + stats->obytes = vsi->eth_stats.tx_bytes; + stats->ierrors = vsi->eth_stats.rx_discards; + stats->oerrors = vsi->eth_stats.tx_errors + vsi->eth_stats.tx_discards; + +return ret; +} + +int +rte_pmd_i40e_reset_vf_stats (uint8_t port, +uint16_t vf_id) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_vsi *vsi; +int ret =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vsi = pf->vfs[vf_id].vsi; + + vsi->offset_loaded = false; +i40e_update_vsi_stats (vsi); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +41 -0
45 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +2 -0
@@ -18,5 +18,7 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_vlan_tag; rte_pmd_i40e_set_vf_vlan_filter; + rte_pmd_i40e_get_vf_stats; + rte_pmd_i40e_reset_vf_stats; } DPDK_2.0;
Signature · 1 line
2.9.3
I do not see test to validate that the PF userland will look like a Linux PF. I am getting concerned that it is a bad solution since we have two/three PF mailboxes which may not be consistent: Linux, DPDK, VMware.
Quoted 100 lines · Ferruh Yigit
1, VF Daemon (VFD)
VFD is an idea to control all the VFs from PF.
As we need to support the scenario kernel PF + DPDK VF,
DPDK follows the interface between kernel PF + kernel VF.
We don't want to introduce too many new messages between PF and VF.
So this patch set adds some new APIs to control VFs directly from PF.
The new APIs include,
1) set VF MAC anti-spoofing
2) set VF VLAN anti-spoofing
3) set TX loopback
4) set VF unicast promiscuous mode
5) set VF multicast promiscuous mode
6) set VF MTU
7) get/reset VF stats
8) set VF MAC address
9) set VF VLAN stripping
10) VF VLAN insertion
12) set VF broadcast mode
12) set VF VLAN tag
13) set VF VLAN filter
VFD also includes VF to PF mailbox message management by APP.
When PF receives mailbox messages from VF, PF should call the callback provided by APP to know if they're permitted to be processed.2, Implement VF MAC address setting on VF.
3, Support the scenario DPDK PF + kernel VF.
v4:
- rebase on latest next-net
- move patch 10/29 testpmd part to patch 18/29v3:
- fix issue that VF does not work for i40e
- remove patch for VDMq receive mode init
- move get/reset VF stats API intorte_pmd_i40v2:
- fix the compile issues.
- fix the checkpatch warning and typo.
- update the commit log of some patches.
- fix the invalid port ID issue of testpmd.Bernard Iremonger (7):
net/i40e: add set VF VLAN insert function net/i40e: set VF broadcast mode from PF net/i40e: set VF VLAN tag from PF
net/i40e: set VF VLAN filter from PF app/testpmd: add command to test VF broadcast mode on i40e app/testpmd: add command to test VF VLAN tag on i40e app/testpmd: handle i40e in VF VLAN filter commandChen Jing D(Mark) (6):
net/i40e: add VF VLAN strip func
net/i40e: change version number to support Linux VF net/i40e: return correct VSI id
net/i40e: parse more VF parameter and configure net/i40e: support Linux VF to configure IRQ link list net/i40e: enhance in sanity check of MACFerruh Yigit (3):
net/i40e: set VF MAC from PF support
net/i40e: set VF MAC from VF support
net/i40e: fix VF MAC address assignmentQi Zhang (3):
net/i40e: enable VF MTU change
net/i40e: fix VF reset flow
net/i40e: set/clear VF stats from PFWenzhuo Lu (10):
net/i40e: support link status notification net/i40e: add callback to user on VF to PF mbox msg net/i40e: set VF MAC anti-spoofing from PF net/i40e: set VF VLAN anti-spoofing from PF net/i40e: set Tx loopback from PF
net/i40e: set VF unicast promisc mode from PF net/i40e: set VF multicast promisc mode from PF app/testpmd: use VFD APIs on i40e app/testpmd: use unicast promiscuous mode on i40e app/testpmd: use multicast promiscuous mode on i40eapp/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 473 +++++++++++++++- app/test-pmd/config.c | 17 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 32 ++ drivers/net/i40e/Makefile | 4 +- drivers/net/i40e/i40e_ethdev.c | 847 +++++++++++++++++++++++++++- drivers/net/i40e/i40e_ethdev.h | 5 +- drivers/net/i40e/i40e_ethdev_vf.c | 82 ++- drivers/net/i40e/i40e_pf.c | 417 ++++++++++++-- drivers/net/i40e/i40e_pf.h | 9 +- drivers/net/i40e/rte_pmd_i40e.h | 328 +++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 20 + 12 files changed, 2129 insertions(+), 107 deletions(-) create mode 100644 drivers/net/i40e/rte_pmd_i40e.h--
2.9.3
PATCH v5 9/29 net/i40e: fix VF reset flow
In reply to Ferruh YigitFrom: Qi Zhang <[email protected]>
Add missing step during VF reset: PF should set I40E_VFGEN_RSTAT to ACTIVE at end of the VF reset operation or VF driver may not able to detect that reset is already completed. This patch also remove the unnecessary enum for vfr state.
--- drivers/net/i40e/i40e_pf.c | 6 ++++-- drivers/net/i40e/i40e_pf.h | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-)
drivers/net/i40e/i40e_pf.c +4 -2
@@ -139,7 +139,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset) abs_vf_id = vf_id + hw->func_caps.vf_base_id;/* Notify VF that we are in VFR progress */ -I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_PF_VFR_INPROGRESS ); +I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_VFR_INPROGRESS );/* * If require a SW VF reset, a VFLR interrupt will be generated,
@@ -220,7 +220,7 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset) }/* Reset done, Set COMPLETE flag and clear reset bit */ -I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_PF_VFR_COMPLETED ); +I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_VFR_COMPLETED ); val =I40E_READ_REG (hw,I40E_VPGEN_VFRTRIG (vf_id)); val &= ~I40E_VPGEN_VFRTRIG_VFSWR_MASK ;I40E_WRITE_REG (hw,I40E_VPGEN_VFRTRIG (vf_id), val);
@@ -248,6 +248,8 @@ i40e_pf_host_vf_reset(struct i40e_pf_vf *vf, bool do_hw_reset)return -EFAULT ; } +I40E_WRITE_REG (hw,I40E_VFGEN_RSTAT1 (vf_id),I40E_VFR_VFACTIVE ); +return ret; }
drivers/net/i40e/i40e_pf.h +0 -5
@@ -48,11 +48,6 @@#define I40E_DPDK_OFFSET 0x100 -enum i40e_pf_vfr_state { -I40E_PF_VFR_INPROGRESS =0 , -I40E_PF_VFR_COMPLETED =1 , -}; -/* DPDK pf driver specific command to VF */ enum i40e_virtchnl_ops_dpdk {/*
Signature · 1 line
2.9.3
PATCH v5 12/29 net/i40e: fix VF MAC address assignment
In reply to Ferruh YigitIf PF sets vf->mac_addr, in VF initialization hw->mac.addr will be set to that same value. It is possible to check if PF set a MAC address or not through the hw->mac.addr variable.
hw->mac.addr set by i40e_vf_parse_hw_config(), call stack is:
In PF sidei40e_pf_host_process_cmd_get_vf_resources()
eth_addr_copy(vf->mac_addr, vf_res->vsi_res[0].default_mac_address)
In VF sisei40evf_init_vf()
i40evf_get_vf_resources()
i40e_vf_parse_hw_config()
memcpy(hw->mac.addr, vsi_res->default_mac_addr)Updated code is after i40evf_get_vf_resources() and can benefit from hw->mac.addr variable.
--- drivers/net/i40e/i40e_ethdev_vf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/i40e/i40e_ethdev_vf.c +2 -6
@@ -1193,7 +1193,6 @@ i40evf_init_vf(struct rte_eth_dev *dev)int i, err, bufsz;struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct i40e_vf *vf =I40EVF_DEV_PRIVATE_TO_VF (dev->data->dev_private); -struct ether_addr *p_mac_addr;uint16_t interval =i40e_calc_itr_interval (I40E_QUEUE_ITR_INTERVAL_MAX );
@@ -1270,13 +1269,10 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter =I40E_DEV_PRIVATE_TO_ADAPTER (dev->data->dev_private);/* Store the MAC address configured by host, or generate random one */ - p_mac_addr = (struct ether_addr *)(vf->vsi_res->default_mac_addr); -if (is_valid_assigned_ether_addr (p_mac_addr)) {/* Configured by host */ -ether_addr_copy (p_mac_addr, (struct ether_addr *)hw->mac.addr); +if (is_valid_assigned_ether_addr ((struct ether_addr *)hw->mac.addr)) vf->flags |=I40E_FLAG_VF_MAC_BY_PF ; - }else { +else eth_random_addr (hw->mac.addr);/* Generate a random one */ - }/* If the PF host is not DPDK, set the interval of ITR0 to max*/ if (vf->version_major !=I40E_DPDK_VERSION_MAJOR ) {
Signature · 1 line
2.9.3
v5 cover Support VFD and DPDK PF + kernel VF on i40e
In reply to Ferruh Yigit1, VF Daemon (VFD)
VFD is an idea to control all the VFs from PF.
As we need to support the scenario kernel PF + DPDK VF,
DPDK follows the interface between kernel PF + kernel VF.
We don't want to introduce too many new messages between PF and VF.
So this patch set adds some new APIs to control VFs directly from PF.
The new APIs include,
1) set VF MAC anti-spoofing
2) set VF VLAN anti-spoofing
3) set TX loopback
4) set VF unicast promiscuous mode
5) set VF multicast promiscuous mode
6) set VF MTU
7) get/reset VF stats
8) set VF MAC address
9) set VF VLAN stripping
10) VF VLAN insertion
12) set VF broadcast mode
12) set VF VLAN tag
13) set VF VLAN filter
VFD also includes VF to PF mailbox message management by APP.
When PF receives mailbox messages from VF, PF should call the callback provided by APP to know if they're permitted to be processed.
2, Implement VF MAC address setting on VF.
3, Support the scenario DPDK PF + kernel VF.
v5:
- fix testpmd build error(s)
- fix i40e vf_rx_vlan
- remove redundant memset on dev_info
- add functions to .map file sorted
v4:
- rebase on latest next-net
- move patch 10/29 testpmd part to patch 18/29
v3:
- fix issue that VF does not work for i40e
- remove patch for VDMq receive mode init
- move get/reset VF stats API into rte_pmd_i40
v2:
- fix the compile issues.
- fix the checkpatch warning and typo.
- update the commit log of some patches.
- fix the invalid port ID issue of testpmd.
Bernard Iremonger (7):
net/i40e: add set VF VLAN insert function net/i40e: set VF broadcast mode from PF net/i40e: set VF VLAN tag from PF
net/i40e: set VF VLAN filter from PF app/testpmd: add command to test VF broadcast mode on i40e app/testpmd: add command to test VF VLAN tag on i40e app/testpmd: handle i40e in VF VLAN filter command
Chen Jing D(Mark) (6):
net/i40e: add VF VLAN strip func
net/i40e: change version number to support Linux VF net/i40e: return correct VSI id
net/i40e: parse more VF parameter and configure net/i40e: support Linux VF to configure IRQ link list net/i40e: enhance in sanity check of MAC
Ferruh Yigit (3):
net/i40e: set VF MAC from PF support
net/i40e: set VF MAC from VF support
net/i40e: fix VF MAC address assignment
Qi Zhang (3):
net/i40e: enable VF MTU change
net/i40e: fix VF reset flow
net/i40e: set/clear VF stats from PF
Wenzhuo Lu (10):
net/i40e: support link status notification net/i40e: add callback to user on VF to PF mbox msg net/i40e: set VF MAC anti-spoofing from PF net/i40e: set VF VLAN anti-spoofing from PF net/i40e: set Tx loopback from PF
net/i40e: set VF unicast promisc mode from PF net/i40e: set VF multicast promisc mode from PF app/testpmd: use VFD APIs on i40e app/testpmd: use unicast promiscuous mode on i40e app/testpmd: use multicast promiscuous mode on i40e
app/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 560 ++++++++++++++++-- app/test-pmd/config.c | 13 - app/test-pmd/testpmd.h | 2 - doc/guides/testpmd_app_ug/testpmd_funcs.rst | 32 ++ drivers/net/i40e/Makefile | 4 +- drivers/net/i40e/i40e_ethdev.c | 847 +++++++++++++++++++++++++++- drivers/net/i40e/i40e_ethdev.h | 5 +- drivers/net/i40e/i40e_ethdev_vf.c | 82 ++- drivers/net/i40e/i40e_pf.c | 417 ++++++++++++-- drivers/net/i40e/i40e_pf.h | 9 +- drivers/net/i40e/rte_pmd_i40e.h | 328 +++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 20 + 13 files changed, 2191 insertions(+), 130 deletions(-) create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
Signature · 1 line
2.9.3
PATCH v5 1/29 net/i40e: support link status notification
From: Wenzhuo Lu <[email protected]>
Add an API to expose the ability, that PF can notify VF when link status changes, to APP.
So if PF APP doesn't want to enable interruption but check link status by itself, PF APP can let VF know link status changed.
--- drivers/net/i40e/Makefile | 4 ++- drivers/net/i40e/i40e_ethdev.c | 28 +++++++++++++++ drivers/net/i40e/i40e_pf.c | 4 +-- drivers/net/i40e/i40e_pf.h | 4 ++- drivers/net/i40e/rte_pmd_i40e.h | 58 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 7 ++++ 6 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 drivers/net/i40e/rte_pmd_i40e.h
drivers/net/i40e/Makefile +3 -1
@@ -1,6 +1,6 @@ # BSD LICENSE # -# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved. # All rights reserved. # # Redistribution and use in source and binary forms, with or without
@@ -111,6 +111,8 @@ ifeq ($(findstring RTE_MACHINE_CPUFLAG_SSE4_1,$(CFLAGS)),) CFLAGS_i40e_rxtx_vec_sse.o += -msse4.1 endif +# install this header file +SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
drivers/net/i40e/i40e_ethdev.c +28 -0
@@ -62,6 +62,7 @@#include "i40e_rxtx.h" #include "i40e_pf.h" #include "i40e_regs.h" +#include "rte_pmd_i40e.h" #define ETH_I40E_FLOATING_VEB_ARG "enable_floating_veb"#define ETH_I40E_FLOATING_VEB_LIST_ARG "floating_veb_list"
@@ -9695,3 +9696,30 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)return ret; } + +int +rte_pmd_i40e_ping_vfs (uint8_t port,uint16_t vf) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + +i40e_notify_vf_link_status (dev, &pf->vfs[vf]); + +return 0 ; +}
drivers/net/i40e/i40e_pf.c +2 -2
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -897,7 +897,7 @@ i40e_pf_host_process_cmd_cfg_pvid(struct i40e_pf_vf *vf,return ret; } -static void +void i40e_notify_vf_link_status (struct rte_eth_dev *dev,struct i40e_pf_vf *vf) {struct i40e_virtchnl_pf_event event;
drivers/net/i40e/i40e_pf.h +3 -1
@@ -1,7 +1,7 @@/*- * BSD LICENSE * -* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* Copyright(c) 2010-2016 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -123,5 +123,7 @@ void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev, uint8_t *msg, uint16_t msglen);int i40e_pf_host_init (struct rte_eth_dev *dev);int i40e_pf_host_uninit (struct rte_eth_dev *dev); +void i40e_notify_vf_link_status (struct rte_eth_dev *dev, +struct i40e_pf_vf *vf);#endif /* _I40E_PF_H_ */
drivers/net/i40e/rte_pmd_i40e.h new file +58 -0
58 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +7 -0
@@ -2,3 +2,10 @@ DPDK_2.0 { local: *; }; + +DPDK_17.02 { + global: + + rte_pmd_i40e_ping_vfs; + +} DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v5 2/29 net/i40e: add callback to user on VF to PF mbox msg
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
The callback asks the user application if it is allowed to perform the mailbox messages.
If the return value from user is RTE_PMD_I40E_MB_EVENT_PROCEED then continue. If ACK or NACK, do nothing and send not_supported to VF.
--- drivers/net/i40e/i40e_pf.c | 230 ++++++++++++++++++++++++++++++++++------ drivers/net/i40e/rte_pmd_i40e.h | 21 ++++ 2 files changed, 216 insertions(+), 35 deletions(-)
drivers/net/i40e/i40e_pf.c +195 -35
@@ -55,6 +55,7 @@#include "i40e_ethdev.h" #include "i40e_rxtx.h" #include "i40e_pf.h" +#include "rte_pmd_i40e.h" #define I40E_CFG_CRCSTRIP_DEFAULT 1
@@ -272,14 +273,23 @@ i40e_pf_host_send_msg_to_vf(struct i40e_pf_vf *vf, }static void -i40e_pf_host_process_cmd_version (struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_version (struct i40e_pf_vf *vf,bool b_op) {struct i40e_virtchnl_version_info info; info.major =I40E_DPDK_VERSION_MAJOR ; info.minor =I40E_DPDK_VERSION_MINOR ; -i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_VERSION , -I40E_SUCCESS , (uint8_t *)&info,sizeof (info)); + +if (b_op) +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_VERSION , +I40E_SUCCESS , + (uint8_t *)&info, +sizeof (info)); +else +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_VERSION , +I40E_NOT_SUPPORTED , + (uint8_t *)&info, +sizeof (info)); } static int
@@ -292,13 +302,20 @@ i40e_pf_host_process_cmd_reset_vf(struct i40e_pf_vf *vf) }static int -i40e_pf_host_process_cmd_get_vf_resource (struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_get_vf_resource (struct i40e_pf_vf *vf,bool b_op) {struct i40e_virtchnl_vf_resource *vf_res =NULL ;struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);uint32_t len =0 ;int ret =I40E_SUCCESS ; +if (!b_op) { +i40e_pf_host_send_msg_to_vf (vf, +I40E_VIRTCHNL_OP_GET_VF_RESOURCES , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +/* only have 1 VSI by default */ len =sizeof (struct i40e_virtchnl_vf_resource ) + I40E_DEFAULT_VF_VSI_NUM *
@@ -423,7 +440,8 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,static int i40e_pf_host_process_cmd_config_vsi_queues (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);struct i40e_vsi *vsi = vf->vsi;
@@ -432,6 +450,13 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,struct i40e_virtchnl_queue_pair_info *vc_qpi;int i, ret =I40E_SUCCESS ; +if (!b_op) { +i40e_pf_host_send_msg_to_vf (vf, +I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (!msg || vc_vqci->num_queue_pairs > vsi->nb_qps || vc_vqci->num_queue_pairs >I40E_MAX_VSI_QP || msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqci,
@@ -482,7 +507,8 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_config_vsi_queues_ext (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);struct i40e_vsi *vsi = vf->vsi;
@@ -491,6 +517,14 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,struct i40e_virtchnl_queue_pair_ext_info *vc_qpei;int i, ret =I40E_SUCCESS ; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (!msg || vc_vqcei->num_queue_pairs > vsi->nb_qps || vc_vqcei->num_queue_pairs >I40E_MAX_VSI_QP || msglen < I40E_VIRTCHNL_CONFIG_VSI_QUEUES_SIZE(vc_vqcei,
@@ -539,12 +573,21 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_config_irq_map (struct i40e_pf_vf *vf, -uint8_t *msg,uint16_t msglen) +uint8_t *msg,uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ;struct i40e_virtchnl_irq_map_info *irqmap = (struct i40e_virtchnl_irq_map_info *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <sizeof (struct i40e_virtchnl_irq_map_info )) {PMD_DRV_LOG (ERR ,"buffer too short" ); ret =I40E_ERR_PARAM ;
@@ -646,12 +689,21 @@ i40e_pf_host_process_cmd_enable_queues(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_disable_queues (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ;struct i40e_virtchnl_queue_select *q_sel = (struct i40e_virtchnl_queue_select *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_DISABLE_QUEUES , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*q_sel)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -669,7 +721,8 @@ i40e_pf_host_process_cmd_disable_queues(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_add_ether_address (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -678,6 +731,14 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,int i;struct ether_addr *mac; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +memset (&filter,0 ,sizeof (struct i40e_mac_filter_info ));if (msg ==NULL || msglen <=sizeof (*addr_list)) {
@@ -707,7 +768,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_del_ether_address (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_ether_addr_list *addr_list =
@@ -715,6 +777,14 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,int i;struct ether_addr *mac; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <=sizeof (*addr_list)) {PMD_DRV_LOG (ERR ,"delete_ether_address argument too short" ); ret =I40E_ERR_PARAM ;
@@ -739,7 +809,8 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_add_vlan (struct i40e_pf_vf *vf, -uint8_t *msg,uint16_t msglen) +uint8_t *msg,uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -747,6 +818,14 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,int i;uint16_t *vid; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_ADD_VLAN , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <=sizeof (*vlan_filter_list)) {PMD_DRV_LOG (ERR ,"add_vlan argument too short" ); ret =I40E_ERR_PARAM ;
@@ -771,7 +850,8 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,static int i40e_pf_host_process_cmd_del_vlan (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ; struct i40e_virtchnl_vlan_filter_list *vlan_filter_list =
@@ -779,6 +859,14 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,int i;uint16_t *vid; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_DEL_VLAN , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen <=sizeof (*vlan_filter_list)) {PMD_DRV_LOG (ERR ,"delete_vlan argument too short" ); ret =I40E_ERR_PARAM ;
@@ -803,7 +891,8 @@ static inti40e_pf_host_process_cmd_config_promisc_mode ( struct i40e_pf_vf *vf, uint8_t *msg, - uint16_t msglen) + uint16_t msglen, + bool b_op) { int ret = I40E_SUCCESS; struct i40e_virtchnl_promisc_info *promisc =
@@ -811,6 +900,14 @@ i40e_pf_host_process_cmd_config_promisc_mode(struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);bool unicast = FALSE, multicast = FALSE; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*promisc)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -836,13 +933,20 @@ i40e_pf_host_process_cmd_config_promisc_mode( }static int -i40e_pf_host_process_cmd_get_stats (struct i40e_pf_vf *vf) +i40e_pf_host_process_cmd_get_stats (struct i40e_pf_vf *vf,bool b_op) {i40e_update_vsi_stats (vf->vsi); -i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_GET_STATS , -I40E_SUCCESS , (uint8_t *)&vf->vsi->eth_stats, -sizeof (vf->vsi->eth_stats)); +if (b_op) +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_GET_STATS , +I40E_SUCCESS , + (uint8_t *)&vf->vsi->eth_stats, +sizeof (vf->vsi->eth_stats)); +else +i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_GET_STATS , +I40E_NOT_SUPPORTED , + (uint8_t *)&vf->vsi->eth_stats, +sizeof (vf->vsi->eth_stats));return I40E_SUCCESS ; }
@@ -851,12 +955,21 @@ static inti40e_pf_host_process_cmd_cfg_vlan_offload ( struct i40e_pf_vf *vf, uint8_t *msg, - uint16_t msglen) + uint16_t msglen, + bool b_op) { int ret = I40E_SUCCESS;struct i40e_virtchnl_vlan_offload_info *offload = (struct i40e_virtchnl_vlan_offload_info *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*offload)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -877,12 +990,21 @@ i40e_pf_host_process_cmd_cfg_vlan_offload(static int i40e_pf_host_process_cmd_cfg_pvid (struct i40e_pf_vf *vf,uint8_t *msg, -uint16_t msglen) +uint16_t msglen, +bool b_op) {int ret =I40E_SUCCESS ;struct i40e_virtchnl_pvid_info *tpid_info = (struct i40e_virtchnl_pvid_info *)msg; +if (!b_op) { +i40e_pf_host_send_msg_to_vf ( + vf, +I40E_VIRTCHNL_OP_CFG_VLAN_PVID , +I40E_NOT_SUPPORTED ,NULL ,0 ); +return ret; + } +if (msg ==NULL || msglen !=sizeof (*tpid_info)) { ret =I40E_ERR_PARAM ; goto send_msg;
@@ -923,6 +1045,8 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,struct i40e_pf_vf *vf;/* AdminQ will pass absolute VF id, transfer to internal vf id */ uint16_t vf_id = abs_vf_id - hw->func_caps.vf_base_id; +struct rte_pmd_i40e_mb_event_param cb_param; +bool b_op = TRUE;if (vf_id > pf->vf_num -1 || !pf->vfs) {PMD_DRV_LOG (ERR ,"invalid argument" );
@@ -937,10 +1061,35 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,return ; } +/** +* initialise structure to send to user application +* will return response from user in retval field +*/ + cb_param.retval =RTE_PMD_I40E_MB_EVENT_PROCEED ; + cb_param.vfid = vf_id; + cb_param.msg_type = opcode; + cb_param.msg = (void *)msg; + cb_param.msglen = msglen; + +/** +* Ask user application if we're allowed to perform those functions. +* If we get cb_param.retval == RTE_PMD_I40E_MB_EVENT_PROCEED, +* then business as usual. +* If RTE_PMD_I40E_MB_EVENT_NOOP_ACK or RTE_PMD_I40E_MB_EVENT_NOOP_NACK, +* do nothing and send not_supported to VF. As PF must send a response +* to VF and ACK/NACK is not defined. +*/ +_rte_eth_dev_callback_process (dev,RTE_ETH_EVENT_VF_MBOX , &cb_param); +if (cb_param.retval !=RTE_PMD_I40E_MB_EVENT_PROCEED ) { +PMD_DRV_LOG (WARNING ,"VF to PF message(%d) is not permitted!" , + opcode); + b_op = FALSE; + } +switch (opcode) {case I40E_VIRTCHNL_OP_VERSION :PMD_DRV_LOG (INFO ,"OP_VERSION received" ); -i40e_pf_host_process_cmd_version (vf); +i40e_pf_host_process_cmd_version (vf, b_op);break ;case I40E_VIRTCHNL_OP_RESET_VF :PMD_DRV_LOG (INFO ,"OP_RESET_VF received" );
@@ -948,61 +1097,72 @@ i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev,break ;case I40E_VIRTCHNL_OP_GET_VF_RESOURCES :PMD_DRV_LOG (INFO ,"OP_GET_VF_RESOURCES received" ); -i40e_pf_host_process_cmd_get_vf_resource (vf); +i40e_pf_host_process_cmd_get_vf_resource (vf, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES :PMD_DRV_LOG (INFO ,"OP_CONFIG_VSI_QUEUES received" ); -i40e_pf_host_process_cmd_config_vsi_queues (vf, msg, msglen); +i40e_pf_host_process_cmd_config_vsi_queues (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EXT :PMD_DRV_LOG (INFO ,"OP_CONFIG_VSI_QUEUES_EXT received" );i40e_pf_host_process_cmd_config_vsi_queues_ext (vf, msg, - msglen); + msglen, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP :PMD_DRV_LOG (INFO ,"OP_CONFIG_IRQ_MAP received" ); -i40e_pf_host_process_cmd_config_irq_map (vf, msg, msglen); +i40e_pf_host_process_cmd_config_irq_map (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_ENABLE_QUEUES :PMD_DRV_LOG (INFO ,"OP_ENABLE_QUEUES received" ); -i40e_pf_host_process_cmd_enable_queues (vf, msg, msglen); -i40e_notify_vf_link_status (dev, vf); +if (b_op) { +i40e_pf_host_process_cmd_enable_queues (vf, msg, msglen); +i40e_notify_vf_link_status (dev, vf); + }else { +i40e_pf_host_send_msg_to_vf ( + vf,I40E_VIRTCHNL_OP_ENABLE_QUEUES , +I40E_NOT_SUPPORTED ,NULL ,0 ); + }break ;case I40E_VIRTCHNL_OP_DISABLE_QUEUES :PMD_DRV_LOG (INFO ,"OP_DISABLE_QUEUE received" ); -i40e_pf_host_process_cmd_disable_queues (vf, msg, msglen); +i40e_pf_host_process_cmd_disable_queues (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS :PMD_DRV_LOG (INFO ,"OP_ADD_ETHER_ADDRESS received" ); -i40e_pf_host_process_cmd_add_ether_address (vf, msg, msglen); +i40e_pf_host_process_cmd_add_ether_address (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS :PMD_DRV_LOG (INFO ,"OP_DEL_ETHER_ADDRESS received" ); -i40e_pf_host_process_cmd_del_ether_address (vf, msg, msglen); +i40e_pf_host_process_cmd_del_ether_address (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_ADD_VLAN :PMD_DRV_LOG (INFO ,"OP_ADD_VLAN received" ); -i40e_pf_host_process_cmd_add_vlan (vf, msg, msglen); +i40e_pf_host_process_cmd_add_vlan (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_DEL_VLAN :PMD_DRV_LOG (INFO ,"OP_DEL_VLAN received" ); -i40e_pf_host_process_cmd_del_vlan (vf, msg, msglen); +i40e_pf_host_process_cmd_del_vlan (vf, msg, msglen, b_op);break ;case I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE :PMD_DRV_LOG (INFO ,"OP_CONFIG_PROMISCUOUS_MODE received" ); -i40e_pf_host_process_cmd_config_promisc_mode (vf, msg, msglen); +i40e_pf_host_process_cmd_config_promisc_mode (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_GET_STATS :PMD_DRV_LOG (INFO ,"OP_GET_STATS received" ); -i40e_pf_host_process_cmd_get_stats (vf); +i40e_pf_host_process_cmd_get_stats (vf, b_op);break ;case I40E_VIRTCHNL_OP_CFG_VLAN_OFFLOAD :PMD_DRV_LOG (INFO ,"OP_CFG_VLAN_OFFLOAD received" ); -i40e_pf_host_process_cmd_cfg_vlan_offload (vf, msg, msglen); +i40e_pf_host_process_cmd_cfg_vlan_offload (vf, msg, + msglen, b_op);break ;case I40E_VIRTCHNL_OP_CFG_VLAN_PVID :PMD_DRV_LOG (INFO ,"OP_CFG_VLAN_PVID received" ); -i40e_pf_host_process_cmd_cfg_pvid (vf, msg, msglen); +i40e_pf_host_process_cmd_cfg_pvid (vf, msg, msglen, b_op);break ;/* Don't add command supported below, which will * return an error code.
drivers/net/i40e/rte_pmd_i40e.h +21 -0
@@ -42,6 +42,27 @@#include <rte_ethdev.h> /** +* Response sent back to i40e driver from user app after callback +*/ +enum rte_pmd_i40e_mb_event_rsp { +RTE_PMD_I40E_MB_EVENT_NOOP_ACK ,/**< skip mbox request and ACK */ +RTE_PMD_I40E_MB_EVENT_NOOP_NACK ,/**< skip mbox request and NACK */ +RTE_PMD_I40E_MB_EVENT_PROCEED ,/**< proceed with mbox request */ +RTE_PMD_I40E_MB_EVENT_MAX /**< max value of this enum */ +}; + +/** +* Data sent to the user application when the callback is executed. +*/ +struct rte_pmd_i40e_mb_event_param { +uint16_t vfid;/**< Virtual Function number */ +uint16_t msg_type;/**< VF to PF message type, see i40e_virtchnl_ops */ +uint16_t retval;/**< return value */ +void *msg;/**< pointer to message */ +uint16_t msglen;/**< length of the message */ +}; + +/** * Notify VF when PF link status changes. * * @param port
Signature · 1 line
2.9.3
PATCH v5 3/29 net/i40e: set VF MAC anti-spoofing from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF MAC anti-spoofing from PF.
User can call the API on PF to enable/disable a specific VF's MAC anti-spoofing.
--- drivers/net/i40e/i40e_ethdev.c | 63 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 83 insertions(+)
drivers/net/i40e/i40e_ethdev.c +63 -0
@@ -9723,3 +9723,66 @@ rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf)return 0 ; } + +int +rte_pmd_i40e_set_vf_mac_anti_spoof (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +struct i40e_hw *hw; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + +/* Check if it has been already on or off */ +if (vsi->info.valid_sections & +rte_cpu_to_le_16 (I40E_AQ_VSI_PROP_SECURITY_VALID )) { +if (on) { +if ((vsi->info.sec_flags & +I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ) == +I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ) +return 0 ;/* already on */ + }else { +if ((vsi->info.sec_flags & +I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ) ==0 ) +return 0 ;/* already off */ + } + } + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_SECURITY_VALID ); +if (on) + vsi->info.sec_flags |=I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ; +else + vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK ; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -76,4 +76,23 @@ struct rte_pmd_i40e_mb_event_param {*/ int rte_pmd_i40e_ping_vfs (uint8_t port,uint16_t vf); +/** +* Enable/Disable VF MAC anti spoofing. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set MAC anti spoofing. +* @param on +* 1 - Enable VFs MAC anti spoofing. +* 0 - Disable VFs MAC anti spoofing. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_mac_anti_spoof (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -7,5 +7,6 @@ DPDK_17.02 { global: rte_pmd_i40e_ping_vfs; + rte_pmd_i40e_set_vf_mac_anti_spoof; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v5 4/29 net/i40e: set VF VLAN anti-spoofing from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF VLAN anti-spoofing from PF.
User can call the API on PF to enable/disable a specific VF's VLAN anti-spoofing.
--- drivers/net/i40e/i40e_ethdev.c | 116 +++++++++++++++++++++++++++++- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/rte_pmd_i40e.h | 19 +++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 4 files changed, 135 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_ethdev.c +114 -2
@@ -4418,6 +4418,7 @@ i40e_vsi_setup(struct i40e_pf *pf, vsi->max_macaddrs =I40E_NUM_MACADDR_MAX ; vsi->parent_vsi = uplink_vsi ? uplink_vsi : pf->main_vsi; vsi->user_param = user_param; + vsi->vlan_anti_spoof_on =0 ;/* Allocate queues */ switch (vsi->type) {case I40E_VSI_MAIN :
@@ -5761,17 +5762,35 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, uint16_t vlan_id, bool on) { uint32_t vid_idx, vid_bit; +struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0 }; +int ret;if (vlan_id >ETH_VLAN_ID_MAX )return ; vid_idx =I40E_VFTA_IDX (vlan_id); vid_bit =I40E_VFTA_BIT (vlan_id); + vlan_data.vlan_tag =rte_cpu_to_le_16 (vlan_id); -if (on) +if (on) { +if (vsi->vlan_anti_spoof_on) { + ret =i40e_aq_add_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to add vlan filter" ); + } vsi->vfta[vid_idx] |= vid_bit; -else + }else { +if (vsi->vlan_anti_spoof_on) { + ret =i40e_aq_remove_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR , +"Failed to remove vlan filter" ); + } vsi->vfta[vid_idx] &= ~vid_bit; + } }/**
@@ -9786,3 +9805,96 @@ rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +static int +i40e_add_rm_all_vlan_filter (struct i40e_vsi *vsi,uint8_t add) +{ +uint32_t j, k; +uint16_t vlan_id; +struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +struct i40e_aqc_add_remove_vlan_element_data vlan_data = {0 }; +int ret; + +for (j =0 ; j <I40E_VFTA_SIZE ; j++) { +if (!vsi->vfta[j]) +continue ; + +for (k =0 ; k <I40E_UINT32_BIT_SIZE ; k++) { +if (!(vsi->vfta[j] & (1 << k))) +continue ; + + vlan_id = j *I40E_UINT32_BIT_SIZE + k; + vlan_data.vlan_tag =rte_cpu_to_le_16 (vlan_id); +if (add) + ret =i40e_aq_add_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +else + ret =i40e_aq_remove_vlan (hw, vsi->seid, + &vlan_data,1 ,NULL ); +if (ret !=I40E_SUCCESS ) { +PMD_DRV_LOG (ERR , +"Failed to add/rm vlan filter" ); +return ret; + } + } + } + +return I40E_SUCCESS ; +} + +int +rte_pmd_i40e_set_vf_vlan_anti_spoof (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +struct i40e_hw *hw; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + +/* Check if it has been already on or off */ +if (vsi->vlan_anti_spoof_on == on) +return 0 ;/* already on or off */ + + vsi->vlan_anti_spoof_on = on; + ret =i40e_add_rm_all_vlan_filter (vsi, on); +if (ret) +return ret; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_SECURITY_VALID ); +if (on) + vsi->info.sec_flags |=I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK ; +else + vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK ; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/i40e_ethdev.h +1 -0
@@ -300,6 +300,7 @@ struct i40e_vsi {uint16_t msix_intr;/* The MSIX interrupt binds to VSI */ uint16_t nb_msix;/* The max number of msix vector */ uint8_t enabled_tc;/* The traffic class enabled */ +uint8_t vlan_anti_spoof_on;/* The VLAN anti-spoofing enabled */ struct i40e_bw_info bw_info;/* VSI bandwidth information */ };
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -95,4 +95,23 @@ int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Enable/Disable VF VLAN anti spoofing. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set VLAN anti spoofing. +* @param on +* 1 - Enable VFs VLAN anti spoofing. +* 0 - Disable VFs VLAN anti spoofing. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_vlan_anti_spoof (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -8,5 +8,6 @@ DPDK_17.02 { rte_pmd_i40e_ping_vfs; rte_pmd_i40e_set_vf_mac_anti_spoof; + rte_pmd_i40e_set_vf_vlan_anti_spoof; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v5 5/29 net/i40e: set Tx loopback from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling TX loopback from PF. User can call the API on PF to enable/disable TX loopback for all the PF and VFs.
--- drivers/net/i40e/i40e_ethdev.c | 219 ++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 16 +++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 236 insertions(+)
drivers/net/i40e/i40e_ethdev.c +219 -0
@@ -9898,3 +9898,222 @@ rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +static int +i40e_vsi_rm_mac_filter (struct i40e_vsi *vsi) +{ +struct i40e_mac_filter *f; +struct i40e_macvlan_filter *mv_f; +int i, vlan_num; +enum rte_mac_filter_type filter_type; +int ret =I40E_SUCCESS ; + +/* remove all the MACs */ + TAILQ_FOREACH(f, &vsi->mac_list, next) { + vlan_num = vsi->vlan_num; + filter_type = f->mac_info.filter_type; +if (filter_type ==RTE_MACVLAN_PERFECT_MATCH || + filter_type ==RTE_MACVLAN_HASH_MATCH ) { +if (vlan_num ==0 ) { +PMD_DRV_LOG (ERR , +"VLAN number shouldn't be 0\n" ); +return I40E_ERR_PARAM ; + } + }else if (filter_type ==RTE_MAC_PERFECT_MATCH || + filter_type ==RTE_MAC_HASH_MATCH ) + vlan_num =1 ; + + mv_f =rte_zmalloc ("macvlan_data" , vlan_num *sizeof (*mv_f),0 ); +if (!mv_f) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return I40E_ERR_NO_MEMORY ; + } + +for (i =0 ; i < vlan_num; i++) { + mv_f[i].filter_type = filter_type; + (void )rte_memcpy (&mv_f[i].macaddr, + &f->mac_info.mac_addr, +ETH_ADDR_LEN ); + } +if (filter_type ==RTE_MACVLAN_PERFECT_MATCH || + filter_type ==RTE_MACVLAN_HASH_MATCH ) { + ret =i40e_find_all_vlan_for_mac (vsi, mv_f, vlan_num, + &f->mac_info.mac_addr); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + } + + ret =i40e_remove_macvlan_filters (vsi, mv_f, vlan_num); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + +rte_free (mv_f); + ret =I40E_SUCCESS ; + } + +return ret; +} + +static int +i40e_vsi_restore_mac_filter (struct i40e_vsi *vsi) +{ +struct i40e_mac_filter *f; +struct i40e_macvlan_filter *mv_f; +int i, vlan_num =0 ; +int ret =I40E_SUCCESS ; + +/* restore all the MACs */ + TAILQ_FOREACH(f, &vsi->mac_list, next) { +if ((f->mac_info.filter_type ==RTE_MACVLAN_PERFECT_MATCH ) || + (f->mac_info.filter_type ==RTE_MACVLAN_HASH_MATCH )) { +/** +* If vlan_num is 0, that's the first time to add mac, +* set mask for vlan_id 0. +*/ +if (vsi->vlan_num ==0 ) { +i40e_set_vlan_filter (vsi,0 ,1 ); + vsi->vlan_num =1 ; + } + vlan_num = vsi->vlan_num; + }else if ((f->mac_info.filter_type ==RTE_MAC_PERFECT_MATCH ) || + (f->mac_info.filter_type ==RTE_MAC_HASH_MATCH )) + vlan_num =1 ; + + mv_f =rte_zmalloc ("macvlan_data" , vlan_num *sizeof (*mv_f),0 ); +if (!mv_f) { +PMD_DRV_LOG (ERR ,"failed to allocate memory" ); +return I40E_ERR_NO_MEMORY ; + } + +for (i =0 ; i < vlan_num; i++) { + mv_f[i].filter_type = f->mac_info.filter_type; + (void )rte_memcpy (&mv_f[i].macaddr, + &f->mac_info.mac_addr, +ETH_ADDR_LEN ); + } + +if (f->mac_info.filter_type ==RTE_MACVLAN_PERFECT_MATCH || + f->mac_info.filter_type ==RTE_MACVLAN_HASH_MATCH ) { + ret =i40e_find_all_vlan_for_mac (vsi, mv_f, vlan_num, + &f->mac_info.mac_addr); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + } + + ret =i40e_add_macvlan_filters (vsi, mv_f, vlan_num); +if (ret !=I40E_SUCCESS ) { +rte_free (mv_f); +return ret; + } + +rte_free (mv_f); + ret =I40E_SUCCESS ; + } + +return ret; +} + +static int +i40e_vsi_set_tx_loopback (struct i40e_vsi *vsi,uint8_t on) +{ +struct i40e_vsi_context ctxt; +struct i40e_hw *hw; +int ret; + + hw =I40E_VSI_TO_HW (vsi); + +/* Use the FW API if FW >= v5.0 */ +if (hw->aq.fw_maj_ver <5 ) { +PMD_INIT_LOG (ERR ,"FW < v5.0, cannot enable loopback" ); +return -ENOTSUP ; + } + +/* Check if it has been already on or off */ +if (vsi->info.valid_sections & +rte_cpu_to_le_16 (I40E_AQ_VSI_PROP_SWITCH_VALID )) { +if (on) { +if ((vsi->info.switch_id & +I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ) == +I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ) +return 0 ;/* already on */ + }else { +if ((vsi->info.switch_id & +I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ) ==0 ) +return 0 ;/* already off */ + } + } + +/* remove all the MACs first */ + ret =i40e_vsi_rm_mac_filter (vsi); +if (ret) +return ret; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_SWITCH_VALID ); +if (on) + vsi->info.switch_id |=I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ; +else + vsi->info.switch_id &= ~I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB ; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) { +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); +return ret; + } + +/* add all the MACs back */ + ret =i40e_vsi_restore_mac_filter (vsi); +if (ret) +return ret; + +return ret; +} + +int +rte_pmd_i40e_set_tx_loopback (uint8_t port,uint8_t on) +{ +struct rte_eth_dev *dev; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +uint16_t vf_id; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +/* setup PF TX loopback */ + vsi = pf->main_vsi; + ret =i40e_vsi_set_tx_loopback (vsi, on); +if (ret) +return ret; + +/* setup TX loopback for all the VFs */ +if (!pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + +for (vf_id =0 ; vf_id < pf->vf_num; vf_id++) { + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + + ret =i40e_vsi_set_tx_loopback (vsi, on); +if (ret) +return ret; + } + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +16 -0
@@ -114,4 +114,20 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Enable/Disable TX loopback on all the PF and VFs. +* +* @param port +* The port identifier of the Ethernet device. +* @param on +* 1 - Enable TX loopback. +* 0 - Disable TX loopback. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_tx_loopback (uint8_t port, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -7,6 +7,7 @@ DPDK_17.02 { global: rte_pmd_i40e_ping_vfs; + rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_mac_anti_spoof; rte_pmd_i40e_set_vf_vlan_anti_spoof;
Signature · 1 line
2.9.3
PATCH v5 6/29 net/i40e: set VF unicast promisc mode from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF unicast promiscuous mode from PF.
User can call the API on PF to enable/disable a specific VF's unicast promiscuous mode.
--- drivers/net/i40e/i40e_ethdev.c | 36 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 56 insertions(+)
drivers/net/i40e/i40e_ethdev.c +36 -0
@@ -10117,3 +10117,39 @@ rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on)return ret; } + +int +rte_pmd_i40e_set_vf_unicast_promisc (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + hw =I40E_VSI_TO_HW (vf->vsi); + + ret =i40e_aq_set_vsi_unicast_promiscuous (hw, vf->vsi->seid, + on,NULL , true); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set unicast promiscuous mode" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -130,4 +130,23 @@ int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,int rte_pmd_i40e_set_tx_loopback (uint8_t port,uint8_t on); +/** +* Enable/Disable VF unicast promiscuous mode. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set. +* @param on +* 1 - Enable. +* 0 - Disable. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_unicast_promisc (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -9,6 +9,7 @@ DPDK_17.02 { rte_pmd_i40e_ping_vfs; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_mac_anti_spoof; + rte_pmd_i40e_set_vf_unicast_promisc; rte_pmd_i40e_set_vf_vlan_anti_spoof; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v5 7/29 net/i40e: set VF multicast promisc mode from PF
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Support enabling/disabling VF multicast promiscuous mode from PF.
User can call the API on PF to enable/disable a specific VF's multicast promiscuous mode.
--- drivers/net/i40e/i40e_ethdev.c | 36 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 56 insertions(+)
drivers/net/i40e/i40e_ethdev.c +36 -0
@@ -10153,3 +10153,39 @@ rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +int +rte_pmd_i40e_set_vf_multicast_promisc (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vf = &pf->vfs[vf_id]; + hw =I40E_VSI_TO_HW (vf->vsi); + + ret =i40e_aq_set_vsi_multicast_promiscuous (hw, vf->vsi->seid, + on,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set multicast promiscuous mode" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -149,4 +149,23 @@ int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Enable/Disable VF multicast promiscuous mode. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* VF on which to set. +* @param on +* 1 - Enable. +* 0 - Disable. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_multicast_promisc (uint8_t port, +uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -9,6 +9,7 @@ DPDK_17.02 { rte_pmd_i40e_ping_vfs; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_mac_anti_spoof; + rte_pmd_i40e_set_vf_multicast_promisc; rte_pmd_i40e_set_vf_unicast_promisc; rte_pmd_i40e_set_vf_vlan_anti_spoof;
Signature · 1 line
2.9.3
PATCH v5 10/29 net/i40e: set VF MAC from PF support
In reply to Ferruh YigitSupport setting VF MAC address from PF.
User can call the API on PF to set a specific
VF's MAC address.
This will remove all existing MAC filters.
--- drivers/net/i40e/i40e_ethdev.c | 40 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 60 insertions(+)
drivers/net/i40e/i40e_ethdev.c +40 -0
@@ -10189,3 +10189,43 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +int +rte_pmd_i40e_set_vf_mac_addr (uint8_t port,uint16_t vf_id, +struct ether_addr *mac_addr) +{ +struct rte_eth_dev_info dev_info; +struct i40e_mac_filter *f; +struct rte_eth_dev *dev; +struct i40e_pf_vf *vf; +struct i40e_vsi *vsi; +struct i40e_pf *pf; +void *temp; + +if (i40e_validate_mac_addr ((u8 *)mac_addr) !=I40E_SUCCESS ) +return -EINVAL ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) +return -EINVAL ; + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + +ether_addr_copy (mac_addr, &vf->mac_addr); + +/* Remove all existing mac */ + TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) +i40e_vsi_delete_mac (vsi, &f->mac_info.mac_addr); + +return 0 ; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -168,4 +168,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,uint16_t vf_id, uint8_t on); +/** +* Set the VF MAC address. +* +* This will remove all existing MAC filters. +* +* @param port +* The port identifier of the Ethernet device. +* @param vf_id +* VF id. +* @param mac_addr +* VF MAC address. +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if *vf* or *mac_addr* is invalid. +*/ +int rte_pmd_i40e_set_vf_mac_addr (uint8_t port,uint16_t vf_id, +struct ether_addr *mac_addr); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -8,6 +8,7 @@ DPDK_17.02 { rte_pmd_i40e_ping_vfs; rte_pmd_i40e_set_tx_loopback; + rte_pmd_i40e_set_vf_mac_addr; rte_pmd_i40e_set_vf_mac_anti_spoof; rte_pmd_i40e_set_vf_multicast_promisc; rte_pmd_i40e_set_vf_unicast_promisc;
Signature · 1 line
2.9.3
PATCH v5 8/29 net/i40e: enable VF MTU change
In reply to Ferruh YigitFrom: Qi Zhang <[email protected]>
This patch implement mtu_set ops for i40e VF.
--- drivers/net/i40e/i40e_ethdev_vf.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/net/i40e/i40e_ethdev_vf.c +33 -0
@@ -151,6 +151,7 @@ static int i40evf_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf);static int i40evf_dev_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf); +static int i40evf_dev_mtu_set (struct rte_eth_dev *dev,uint16_t mtu);static int i40evf_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); static int
@@ -225,6 +226,7 @@ static const struct eth_dev_ops i40evf_eth_dev_ops = { .reta_query = i40evf_dev_rss_reta_query, .rss_hash_update = i40evf_dev_rss_hash_update, .rss_hash_conf_get = i40evf_dev_rss_hash_conf_get, + .mtu_set = i40evf_dev_mtu_set, };/*
@@ -2641,3 +2643,34 @@ i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev,return 0 ; } + +static int +i40evf_dev_mtu_set (struct rte_eth_dev *dev,uint16_t mtu) +{ +struct i40e_vf *vf =I40EVF_DEV_PRIVATE_TO_VF (dev->data->dev_private); +struct rte_eth_dev_data *dev_data = vf->dev_data; +uint32_t frame_size = mtu +ETHER_HDR_LEN + +ETHER_CRC_LEN +I40E_VLAN_TAG_SIZE ; +int ret =0 ; + +/* check if mtu is within the allowed range */ +if ((mtu <ETHER_MIN_MTU ) || (frame_size >I40E_FRAME_SIZE_MAX )) +return -EINVAL ; + +/* mtu setting is forbidden if port is start */ +if (dev_data->dev_started) { +PMD_DRV_LOG (ERR , +"port %d must be stopped before configuration\n" , + dev_data->port_id); +return -EBUSY ; + } + +if (frame_size >ETHER_MAX_LEN ) + dev_data->dev_conf.rxmode.jumbo_frame =1 ; +else + dev_data->dev_conf.rxmode.jumbo_frame =0 ; + + dev_data->dev_conf.rxmode.max_rx_pkt_len = frame_size; + +return ret; +}
Signature · 1 line
2.9.3
PATCH v5 11/29 net/i40e: set VF MAC from VF support
In reply to Ferruh YigitSupport changing VF default MAC address.
This function is not supported if PF set the MAC
address for the PF.
--- drivers/net/i40e/i40e_ethdev.h | 4 +++- drivers/net/i40e/i40e_ethdev_vf.c | 49 +++++++++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 8 deletions(-)
drivers/net/i40e/i40e_ethdev.h +3 -1
@@ -126,6 +126,7 @@ enum i40e_flxpld_layer_idx {#define I40E_FLAG_FDIR (1ULL << 6)#define I40E_FLAG_VXLAN (1ULL << 7)#define I40E_FLAG_RSS_AQ_CAPABLE (1ULL << 8) +#define I40E_FLAG_VF_MAC_BY_PF (1ULL << 9)#define I40E_FLAG_ALL (I40E_FLAG_RSS | \ I40E_FLAG_DCB | \ I40E_FLAG_VMDQ | \
@@ -134,7 +135,8 @@ enum i40e_flxpld_layer_idx { I40E_FLAG_HEADER_SPLIT_ENABLED | \ I40E_FLAG_FDIR | \ I40E_FLAG_VXLAN | \ - I40E_FLAG_RSS_AQ_CAPABLE) + I40E_FLAG_RSS_AQ_CAPABLE | \ + I40E_FLAG_VF_MAC_BY_PF)#define I40E_RSS_OFFLOAD_ALL ( \ ETH_RSS_FRAG_IPV4 | \
drivers/net/i40e/i40e_ethdev_vf.c +42 -7
92 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v5 13/29 net/i40e: add VF VLAN strip func
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
Add a function to configure vlan strip enable/disable for specific SRIOV VF device.
--- drivers/net/i40e/i40e_ethdev.c | 26 ++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 46 insertions(+)
drivers/net/i40e/i40e_ethdev.c +26 -0
@@ -10229,3 +10229,29 @@ rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,return 0 ; } + +/* Set vlan strip on/off for specific VF from host */ +int +rte_pmd_i40e_set_vf_vlan_stripq (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct i40e_pf *pf; +struct i40e_vsi *vsi; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vsi = pf->vfs[vf_id].vsi; + +if (vsi) +return i40e_vsi_config_vlan_stripping (vsi, !!on); +else +return -EINVAL ; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -187,4 +187,23 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,int rte_pmd_i40e_set_vf_mac_addr (uint8_t port,uint16_t vf_id,struct ether_addr *mac_addr); +/** +* Enable/Disable vf vlan strip for all queues in a pool +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param on +* 1 - Enable VF's vlan strip on RX queues. +* 0 - Disable VF's vlan strip on RX queues. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int +rte_pmd_i40e_set_vf_vlan_stripq (uint8_t port,uint16_t vf,uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -13,5 +13,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_multicast_promisc; rte_pmd_i40e_set_vf_unicast_promisc; rte_pmd_i40e_set_vf_vlan_anti_spoof; + rte_pmd_i40e_set_vf_vlan_stripq; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v5 14/29 net/i40e: add set VF VLAN insert function
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
Support inserting VF VLAN id from PF.
User can call the API on PF to insert a VLAN id to a specific VF.
--- drivers/net/i40e/i40e_ethdev.c | 53 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 +++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 73 insertions(+)
drivers/net/i40e/i40e_ethdev.c +53 -0
@@ -10255,3 +10255,56 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on)else return -EINVAL ; } + +int rte_pmd_i40e_set_vf_vlan_insert (uint8_t port,uint16_t vf_id, +uint16_t vlan_id) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +struct i40e_vsi *vsi; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =I40E_PF_TO_HW (pf); + +/** +* return -ENODEV if SRIOV not enabled, VF number not configured +* or no queue assigned. +*/ +if (!hw->func_caps.sr_iov_1_1 || pf->vf_num ==0 || + pf->vf_nb_qps ==0 ) +return -ENODEV ; + +if (vf_id >= pf->vf_num || !pf->vfs) +return -EINVAL ; + +if (vlan_id >ETHER_MAX_VLAN_ID ) +return -EINVAL ; + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_VLAN_VALID ); + vsi->info.port_vlan_flags |=I40E_AQ_VSI_PVLAN_INSERT_PVID ; + vsi->info.pvid = vlan_id; + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -206,4 +206,23 @@ int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,int rte_pmd_i40e_set_vf_vlan_stripq (uint8_t port,uint16_t vf,uint8_t on); +/** +* Enable/Disable vf vlan insert +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param vlan_id +* 0 - Disable VF's vlan insert. +* n - Enable; n is inserted as the vlan id. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_vlan_insert (uint8_t port,uint16_t vf_id, +uint16_t vlan_id); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -13,6 +13,7 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_multicast_promisc; rte_pmd_i40e_set_vf_unicast_promisc; rte_pmd_i40e_set_vf_vlan_anti_spoof; + rte_pmd_i40e_set_vf_vlan_insert; rte_pmd_i40e_set_vf_vlan_stripq; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v5 15/29 net/i40e: set VF broadcast mode from PF
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
Support enabling/disabling VF broadcast mode from PF. User can call the API on PF to enable/disable a specific VF's broadcast mode.
--- drivers/net/i40e/i40e_ethdev.c | 43 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 19 ++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 63 insertions(+)
drivers/net/i40e/i40e_ethdev.c +43 -0
@@ -10308,3 +10308,46 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,return ret; } + +int rte_pmd_i40e_set_vf_broadcast (uint8_t port,uint16_t vf_id, +uint8_t on) { +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =I40E_PF_TO_HW (pf); + +if (vf_id >= pf->vf_num || !pf->vfs) +return -EINVAL ; + +/** +* return -ENODEV if SRIOV not enabled, VF number not configured +* or no queue assigned. +*/ +if (!hw->func_caps.sr_iov_1_1 || pf->vf_num ==0 || pf->vf_nb_qps ==0 ) +return -ENODEV ; + + vf = &pf->vfs[vf_id]; + hw =I40E_VSI_TO_HW (vf->vsi); + + ret =i40e_aq_set_vsi_broadcast (hw, vf->vsi->seid, on,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set VSI broadcast" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +19 -0
@@ -225,4 +225,23 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);int rte_pmd_i40e_set_vf_vlan_insert (uint8_t port,uint16_t vf_id,uint16_t vlan_id); +/** +* Enable/Disable vf broadcast mode +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param on +* 0 - Disable broadcast. +* 1 - Enable broadcast. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_broadcast (uint8_t port,uint16_t vf_id, +uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -8,6 +8,7 @@ DPDK_17.02 { rte_pmd_i40e_ping_vfs; rte_pmd_i40e_set_tx_loopback; + rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_mac_addr; rte_pmd_i40e_set_vf_mac_anti_spoof; rte_pmd_i40e_set_vf_multicast_promisc;
Signature · 1 line
2.9.3
PATCH v5 16/29 net/i40e: set VF VLAN tag from PF
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
Add rte_pmd_i40e_set_vf_vlan_tag API.
User can call the API on PF to enable/disable a specific VF's VLAN tag.
--- drivers/net/i40e/i40e_ethdev.c | 59 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 18 ++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 78 insertions(+)
drivers/net/i40e/i40e_ethdev.c +59 -0
@@ -10351,3 +10351,62 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,return ret; } + +int rte_pmd_i40e_set_vf_vlan_tag (uint8_t port,uint16_t vf_id,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_pf_vf *vf; +struct i40e_hw *hw; +struct i40e_vsi *vsi; +struct i40e_vsi_context ctxt; +int ret; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =I40E_PF_TO_HW (pf); + +/** +* return -ENODEV if SRIOV not enabled, VF number not configured +* or no queue assigned. +*/ +if (!hw->func_caps.sr_iov_1_1 || pf->vf_num ==0 || pf->vf_nb_qps ==0 ) +return -ENODEV ; + +if (vf_id >= pf->vf_num) +return -EINVAL ; + + vf = &pf->vfs[vf_id]; + vsi = vf->vsi; + + vsi->info.valid_sections =cpu_to_le16 (I40E_AQ_VSI_PROP_VLAN_VALID ); +if (on) { + vsi->info.port_vlan_flags |=I40E_AQ_VSI_PVLAN_MODE_TAGGED ; + vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_UNTAGGED ; + }else { + vsi->info.port_vlan_flags |=I40E_AQ_VSI_PVLAN_MODE_UNTAGGED ; + vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_MODE_TAGGED ; + } + +memset (&ctxt,0 ,sizeof (ctxt)); + (void )rte_memcpy (&ctxt.info, &vsi->info,sizeof (vsi->info)); + ctxt.seid = vsi->seid; + + hw =I40E_VSI_TO_HW (vsi); + ret =i40e_aq_update_vsi_params (hw, &ctxt,NULL ); +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to update VSI params" ); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +18 -0
@@ -244,4 +244,22 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,int rte_pmd_i40e_set_vf_broadcast (uint8_t port,uint16_t vf_id,uint8_t on); +/** +* Enable/Disable vf vlan tag +* +* @param port +* The port identifier of the Ethernet device. +* @param vf +* ID specifying VF. +* @param vlan_id +* 0 - Disable VF's vlan tag. +* n - Enable VF's vlan tag. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +*/ +int rte_pmd_i40e_set_vf_vlan_tag (uint8_t port,uint16_t vf_id,uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -16,5 +16,6 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_vlan_anti_spoof; rte_pmd_i40e_set_vf_vlan_insert; rte_pmd_i40e_set_vf_vlan_stripq; + rte_pmd_i40e_set_vf_vlan_tag; } DPDK_2.0;
Signature · 1 line
2.9.3
PATCH v5 17/29 net/i40e: set VF VLAN filter from PF
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
add rte_pmd_i40e_set_vf_vlan_filter API.
User can call the API on PF to enable/disable
a set of VF's VLAN filters.
--- drivers/net/i40e/i40e_ethdev.c | 52 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 22 +++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 75 insertions(+)
drivers/net/i40e/i40e_ethdev.c +52 -0
@@ -10410,3 +10410,55 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on)return ret; } + +int rte_pmd_i40e_set_vf_vlan_filter (uint8_t port,uint16_t vlan_id, +uint64_t vf_mask,uint8_t on) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +uint16_t pool_idx; +int ret =I40E_SUCCESS ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vlan_id >ETHER_MAX_VLAN_ID ) +return -EINVAL ; + +if (on >1 ) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); +if ((pf->flags &I40E_FLAG_VMDQ ) ==0 ) { +PMD_INIT_LOG (ERR ,"Firmware doesn't support VMDQ" ); +return -ENOTSUP ; + } + +if (!pf->vmdq) { +PMD_INIT_LOG (INFO ,"VMDQ not configured" ); +return -ENOTSUP ; + } + +for (pool_idx =0 ; + pool_idx <ETH_64_POOLS && + pool_idx < pf->nb_cfg_vmdq_vsi && + ret ==I40E_SUCCESS ; + pool_idx++) { +if (vf_mask & ((uint64_t )(1ULL << pool_idx))) { +if (on) + ret =i40e_vsi_add_vlan (pf->vmdq[pool_idx].vsi, + vlan_id); +else + ret =i40e_vsi_delete_vlan ( + pf->vmdq[pool_idx].vsi, vlan_id); + } + } + +if (ret !=I40E_SUCCESS ) +PMD_DRV_LOG (ERR ,"Failed to set VF VLAN filter, on = %d" , on); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +22 -0
@@ -262,4 +262,26 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,*/ int rte_pmd_i40e_set_vf_vlan_tag (uint8_t port,uint16_t vf_id,uint8_t on); +/** +* Enable/Disable VF VLAN filter +* +* @param port +* The port identifier of the Ethernet device. +* @param vlan_id +* ID specifying VLAN +* @param vf_mask +* Mask to filter VF's +* @param on +* 0 - Disable VF's VLAN filter. +* 1 - Enable VF's VLAN filter. +* +* @return +* - (0) if successful. +* - (-ENODEV) if *port* invalid. +* - (-EINVAL) if bad parameter. +* - (-ENOTSUP) VMDq not configured of not supported by firmware. +*/ +int rte_pmd_i40e_set_vf_vlan_filter (uint8_t port,uint16_t vlan_id, +uint64_t vf_mask,uint8_t on); +#endif /* _PMD_I40E_H_ */
drivers/net/i40e/rte_pmd_i40e_version.map +1 -0
@@ -14,6 +14,7 @@ DPDK_17.02 { rte_pmd_i40e_set_vf_multicast_promisc; rte_pmd_i40e_set_vf_unicast_promisc; rte_pmd_i40e_set_vf_vlan_anti_spoof; + rte_pmd_i40e_set_vf_vlan_filter; rte_pmd_i40e_set_vf_vlan_insert; rte_pmd_i40e_set_vf_vlan_stripq; rte_pmd_i40e_set_vf_vlan_tag;
Signature · 1 line
2.9.3
PATCH v5 18/29 app/testpmd: use VFD APIs on i40e
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
The new VF Daemon (VFD) APIs is implemented on i40e. Change testpmd code to use them, including VF MAC anti-spoofing, VF VLAN anti-spoofing, TX loopback, VF VLAN strip, VF VLAN insert.
--- app/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 150 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 121 insertions(+), 31 deletions(-)
app/test-pmd/Makefile +2 -0
@@ -58,7 +58,9 @@ SRCS-y += csumonly.c SRCS-y += icmpecho.c SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c +_LDLIBS-y += --whole-archive _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e CFLAGS_cmdline.o := -D_GNU_SOURCE
app/test-pmd/cmdline.c +119 -31
320 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v5 19/29 app/testpmd: use unicast promiscuous mode on i40e
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Add testpmd CLI to set VF unicast promiscuous mode on i40e.
--- app/test-pmd/cmdline.c | 92 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++ 2 files changed, 101 insertions(+)
app/test-pmd/cmdline.c +92 -0
@@ -400,6 +400,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set allmulti (port_id|all) (on|off)\n" " Set the allmulti mode on port_id, or all.\n\n" +"set vf promisc (port_id) (vf_id) (on|off)\n" +" Set unicast promiscuous mode for a VF from the PF.\n\n" +"set flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n"
@@ -11555,6 +11558,94 @@ cmdline_parse_inst_t cmd_set_vf_mac_addr = { }, }; +/* VF unicast promiscuous mode configuration */ + +/* Common result structure for VF unicast promiscuous mode */ +struct cmd_vf_promisc_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t promisc; +uint8_t port_id; +uint32_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for VF unicast promiscuous mode enable disable */ +cmdline_parse_token_string_t cmd_vf_promisc_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_promisc_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_promisc_promisc = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + promisc,"promisc" ); +cmdline_parse_token_num_t cmd_vf_promisc_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_promisc_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_promisc_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_promisc_result, + vf_id,UINT32 ); +cmdline_parse_token_string_t cmd_vf_promisc_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_promisc_result, + on_off,"on#off" ); + +static void +cmd_set_vf_promisc_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_promisc_result *res = parsed_result; +int ret = -ENOTSUP ; + __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD + ret =rte_pmd_i40e_set_vf_unicast_promisc (res->port_id, + res->vf_id, is_on); +#endif + +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d\n" , res->vf_id); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("function not implemented\n" ); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_promisc = { + .f = cmd_set_vf_promisc_parsed, + .data =NULL , + .help_str ="set vf unicast promiscuous mode for a VF from PF" , + .tokens = { + (void *)&cmd_vf_promisc_set, + (void *)&cmd_vf_promisc_vf, + (void *)&cmd_vf_promisc_promisc, + (void *)&cmd_vf_promisc_port_id, + (void *)&cmd_vf_promisc_vf_id, + (void *)&cmd_vf_promisc_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11721,6 +11812,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_vf_rate_limit, #endif (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, + (cmdline_parse_inst_t *)&cmd_set_vf_promisc, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -0
@@ -820,6 +820,15 @@ Set the allmulti mode for a port or for all ports:: Same as the ifconfig (8) option. Controls how multicast packets are handled. +set promisc (for VF) +~~~~~~~~~~~~~~~~~~~~ + +Set the unicast promiscuous mode for a VF from PF. +It's supported by Intel i40e NICs now. +In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: + + testpmd> set vf promisc (port_id) (vf_id) (on|off) + set flow_ctrl rx ~~~~~~~~~~~~~~~~
Signature · 1 line
2.9.3
PATCH v5 20/29 app/testpmd: use multicast promiscuous mode on i40e
In reply to Ferruh YigitFrom: Wenzhuo Lu <[email protected]>
Add testpmd CLI to set VF multicast promiscuous mode on i40e.
--- app/test-pmd/cmdline.c | 92 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++ 2 files changed, 101 insertions(+)
app/test-pmd/cmdline.c +92 -0
@@ -403,6 +403,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf promisc (port_id) (vf_id) (on|off)\n" " Set unicast promiscuous mode for a VF from the PF.\n\n" +"set vf allmulti (port_id) (vf_id) (on|off)\n" +" Set multicast promiscuous mode for a VF from the PF.\n\n" +"set flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n"
@@ -11646,6 +11649,94 @@ cmdline_parse_inst_t cmd_set_vf_promisc = { }, }; +/* VF multicast promiscuous mode configuration */ + +/* Common result structure for VF multicast promiscuous mode */ +struct cmd_vf_allmulti_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t allmulti; +uint8_t port_id; +uint32_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for VF multicast promiscuous mode enable disable */ +cmdline_parse_token_string_t cmd_vf_allmulti_set = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + set,"set" ); +cmdline_parse_token_string_t cmd_vf_allmulti_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_vf_allmulti_allmulti = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + allmulti,"allmulti" ); +cmdline_parse_token_num_t cmd_vf_allmulti_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_allmulti_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_vf_allmulti_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_vf_allmulti_result, + vf_id,UINT32 ); +cmdline_parse_token_string_t cmd_vf_allmulti_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_vf_allmulti_result, + on_off,"on#off" ); + +static void +cmd_set_vf_allmulti_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_vf_allmulti_result *res = parsed_result; +int ret = -ENOTSUP ; + __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD + ret =rte_pmd_i40e_set_vf_multicast_promisc (res->port_id, + res->vf_id, is_on); +#endif + +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d\n" , res->vf_id); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("function not implemented\n" ); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_allmulti = { + .f = cmd_set_vf_allmulti_parsed, + .data =NULL , + .help_str ="set vf multicast promiscuous for a VF from PF" , + .tokens = { + (void *)&cmd_vf_allmulti_set, + (void *)&cmd_vf_allmulti_vf, + (void *)&cmd_vf_allmulti_allmulti, + (void *)&cmd_vf_allmulti_port_id, + (void *)&cmd_vf_allmulti_vf_id, + (void *)&cmd_vf_allmulti_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11813,6 +11904,7 @@ cmdline_parse_ctx_t main_ctx[] = {#endif (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, (cmdline_parse_inst_t *)&cmd_set_vf_promisc, + (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -0
@@ -829,6 +829,15 @@ In promiscuous mode packets are not dropped if they aren't for the specified MAC testpmd> set vf promisc (port_id) (vf_id) (on|off) +set allmulticast (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set the multicast promiscuous mode for a VF from PF. +It's supported by Intel i40e NICs now. +In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: + + testpmd> set vf allmulti (port_id) (vf_id) (on|off) + set flow_ctrl rx ~~~~~~~~~~~~~~~~
Signature · 1 line
2.9.3
PATCH v5 21/29 app/testpmd: add command to test VF broadcast mode on i40e
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
Add command to call rte_pmd_i40e_set_vf_broadcast. Add set vf broadcast in testpmd_funcs.rst file.
--- app/test-pmd/cmdline.c | 91 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 98 insertions(+)
app/test-pmd/cmdline.c +91 -0
@@ -279,6 +279,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf mac antispoof (port_id) (vf_id) (on|off).\n" " Set MAC antispoof for a VF from the PF.\n\n" +"set vf broadcast (port_id) (vf_id) (on|off)\n" +" Set VF broadcast for a VF from the PF.\n\n" +"vlan set strip (on|off) (port_id)\n" " Set the VLAN strip on a port.\n\n"
@@ -11737,6 +11740,93 @@ cmdline_parse_inst_t cmd_set_vf_allmulti = { }, }; +/* vf broadcast mode configuration */ + +/* Common result structure for vf broadcast */ +struct cmd_set_vf_broadcast_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t broadcast; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf broadcast enable disable */ +cmdline_parse_token_string_t cmd_set_vf_broadcast_set = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + set,"set" ); +cmdline_parse_token_string_t cmd_set_vf_broadcast_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_set_vf_broadcast_broadcast = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + broadcast,"broadcast" ); +cmdline_parse_token_num_t cmd_set_vf_broadcast_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_broadcast_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_set_vf_broadcast_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_broadcast_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_set_vf_broadcast_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_broadcast_result, + on_off,"on#off" ); + +static void +cmd_set_vf_broadcast_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_set_vf_broadcast_result *res = parsed_result; +int ret = -ENOTSUP ; + __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD + ret =rte_pmd_i40e_set_vf_broadcast (res->port_id, res->vf_id, is_on); +#endif + +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("function not implemented\n" ); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_broadcast = { + .f = cmd_set_vf_broadcast_parsed, + .data =NULL , + .help_str ="set vf broadcast port_id vf_id on|off" , + .tokens = { + (void *)&cmd_set_vf_broadcast_set, + (void *)&cmd_set_vf_broadcast_vf, + (void *)&cmd_set_vf_broadcast_broadcast, + (void *)&cmd_set_vf_broadcast_port_id, + (void *)&cmd_set_vf_broadcast_vf_id, + (void *)&cmd_set_vf_broadcast_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11905,6 +11995,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, (cmdline_parse_inst_t *)&cmd_set_vf_promisc, (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, + (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -507,6 +507,13 @@ Set mac antispoof for a VF from the PF:: testpmd> set vf mac antispoof (port_id) (vf_id) (on|off) +set broadcast mode (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set broadcast mode for a VF from the PF:: + + testpmd> set vf broadcast (port_id) (vf_id) (on|off) + vlan set strip ~~~~~~~~~~~~~~
Signature · 1 line
2.9.3
PATCH v5 22/29 app/testpmd: add command to test VF VLAN tag on i40e
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
command is: set vf vlan tag port_id vf_id on|off
--- app/test-pmd/cmdline.c | 97 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 104 insertions(+)
app/test-pmd/cmdline.c +97 -0
@@ -297,6 +297,9 @@ static void cmd_help_long_parsed(void *parsed_result,"set vf vlan antispoof (port_id) (vf_id) (on|off)\n" " Set VLAN antispoof for a VF from the PF.\n\n" +"set vf vlan tag (port_id) (vf_id) (on|off)\n" +" Set VLAN tag for a VF from the PF.\n\n" +"vlan set filter (on|off) (port_id)\n" " Set the VLAN filter on a port.\n\n"
@@ -11827,6 +11830,99 @@ cmdline_parse_inst_t cmd_set_vf_broadcast = { }, }; +/* vf vlan tag configuration */ + +/* Common result structure for vf vlan tag */ +struct cmd_set_vf_vlan_tag_result { +cmdline_fixed_string_t set; +cmdline_fixed_string_t vf; +cmdline_fixed_string_t vlan; +cmdline_fixed_string_t tag; +uint8_t port_id; +uint16_t vf_id; +cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for vf vlan tag enable disable */ +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_set = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + set,"set" ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vf = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + vf,"vf" ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vlan = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + vlan,"vlan" ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_tag = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + tag,"tag" ); +cmdline_parse_token_num_t cmd_set_vf_vlan_tag_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + port_id,UINT8 ); +cmdline_parse_token_num_t cmd_set_vf_vlan_tag_vf_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + vf_id,UINT16 ); +cmdline_parse_token_string_t cmd_set_vf_vlan_tag_on_off = +TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_vlan_tag_result, + on_off,"on#off" ); + +static void +cmd_set_vf_vlan_tag_parsed ( +void *parsed_result, + __attribute__((unused))struct cmdline *cl, + __attribute__((unused))void *data) +{ +struct cmd_set_vf_vlan_tag_result *res = parsed_result; +int ret = -ENOTSUP ; + __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + +if (port_id_is_invalid (res->port_id,ENABLED_WARN )) +return ; + +#ifdef RTE_LIBRTE_I40E_PMD + ret =rte_pmd_i40e_set_vf_vlan_tag (res->port_id, res->vf_id, is_on); +#endif + +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vf_id %d or is_on %d\n" , res->vf_id, is_on); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("function not implemented\n" ); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_vlan_tag = { + .f = cmd_set_vf_vlan_tag_parsed, + .data =NULL , + .help_str ="set vf vlan tag port_id vf_id on|off" , + .tokens = { + (void *)&cmd_set_vf_vlan_tag_set, + (void *)&cmd_set_vf_vlan_tag_vf, + (void *)&cmd_set_vf_vlan_tag_vlan, + (void *)&cmd_set_vf_vlan_tag_tag, + (void *)&cmd_set_vf_vlan_tag_port_id, + (void *)&cmd_set_vf_vlan_tag_vf_id, + (void *)&cmd_set_vf_vlan_tag_on_off, +NULL , + }, +}; +/* ******************************************************************************** */ /* list of instructions */
@@ -11996,6 +12092,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_promisc, (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, + (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, NULL, };
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -542,6 +542,13 @@ Set VLAN insert for a VF from the PF:: testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id) +vlan set tag (for VF) +~~~~~~~~~~~~~~~~~~~~~ + +Set VLAN tag for a VF from the PF:: + + testpmd> set vf vlan tag (port_id) (vf_id) (on|off) + vlan set antispoof (for VF) ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.9.3
PATCH v5 23/29 app/testpmd: handle i40e in VF VLAN filter command
In reply to Ferruh YigitFrom: Bernard Iremonger <[email protected]>
modify set_vf_rx_vlan function to handle the i40e PMD.
--- app/test-pmd/cmdline.c | 40 +++++++++++++++++++++++++++++++++------- app/test-pmd/config.c | 13 ------------- app/test-pmd/testpmd.h | 2 -- 3 files changed, 33 insertions(+), 22 deletions(-)
app/test-pmd/cmdline.c +33 -7
@@ -6835,7 +6835,6 @@ cmdline_parse_inst_t cmd_vf_mac_addr_filter = { }, }; -#ifdef RTE_LIBRTE_IXGBE_PMD/* *** ADD/REMOVE A VLAN IDENTIFIER TO/FROM A PORT VLAN RX FILTER *** */ struct cmd_vf_rx_vlan_filter {cmdline_fixed_string_t rx_vlan;
@@ -6853,11 +6852,39 @@ cmd_vf_rx_vlan_filter_parsed(void *parsed_result, __attribute__((unused)) void *data) {struct cmd_vf_rx_vlan_filter *res = parsed_result; +int ret = -ENOTSUP ; + __rte_unused int is_add = (strcmp(res->what, "add") == 0) ? 1 : 0; +struct rte_eth_dev_info dev_info; -if (!strcmp (res->what,"add" )) -set_vf_rx_vlan (res->port_id, res->vlan_id,res->vf_mask,1 ); -else -set_vf_rx_vlan (res->port_id, res->vlan_id,res->vf_mask,0 ); +rte_eth_dev_info_get (res->port_id, &dev_info); + +#ifdef RTE_LIBRTE_IXGBE_PMD +if (strstr (dev_info.driver_name,"ixgbe" ) !=NULL ) + ret =rte_pmd_ixgbe_set_vf_vlan_filter (res->port_id, + res->vlan_id, res->vf_mask, is_add); +#endif +#ifdef RTE_LIBRTE_I40E_PMD +if (strstr (dev_info.driver_name,"i40e" ) !=NULL ) + ret =rte_pmd_i40e_set_vf_vlan_filter (res->port_id, + res->vlan_id, res->vf_mask, is_add); +#endif + +switch (ret) { +case 0 : +break ; +case -EINVAL : +printf ("invalid vlan_id %d or vf_mask %lu\n" , + res->vlan_id, res->vf_mask); +break ; +case -ENODEV : +printf ("invalid port_id %d\n" , res->port_id); +break ; +case -ENOTSUP : +printf ("function not implemented or supported\n" ); +break ; +default : +printf ("programming error: (%s)\n" ,strerror (-ret)); + } } cmdline_parse_token_string_t cmd_vf_rx_vlan_filter_rx_vlan =
@@ -6898,7 +6925,6 @@ cmdline_parse_inst_t cmd_vf_rxvlan_filter = { NULL, }, }; -#endif /* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */ struct cmd_queue_rate_limit_result {
@@ -12085,9 +12111,9 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_rxmode, (cmdline_parse_inst_t *)&cmd_set_vf_traffic, - (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, (cmdline_parse_inst_t *)&cmd_vf_rate_limit, #endif + (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, (cmdline_parse_inst_t *)&cmd_set_vf_promisc, (cmdline_parse_inst_t *)&cmd_set_vf_allmulti,
app/test-pmd/config.c +0 -13
@@ -2348,19 +2348,6 @@ set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on) "diag=%d\n", port_id, diag); } - -void -set_vf_rx_vlan (portid_t port_id,uint16_t vlan_id,uint64_t vf_mask,uint8_t on) -{ -int diag; - - diag =rte_pmd_ixgbe_set_vf_vlan_filter (port_id, vlan_id, vf_mask, on); - -if (diag ==0 ) -return ; -printf ("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed " -"diag=%d\n" , port_id, diag); -}#endif int
app/test-pmd/testpmd.h +0 -2
@@ -571,8 +571,6 @@ void port_rss_reta_info(portid_t port_id, uint16_t nb_entries);void set_vf_traffic (portid_t port_id,uint8_t is_rx,uint16_t vf,uint8_t on); -void set_vf_rx_vlan (portid_t port_id,uint16_t vlan_id, -uint64_t vf_mask,uint8_t on);int set_queue_rate_limit (portid_t port_id,uint16_t queue_idx,uint16_t rate); int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
Signature · 1 line
2.9.3
PATCH v5 24/29 net/i40e: change version number to support Linux VF
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
i40e PF host only support to work with DPDK VF driver, Linux VF driver is not supported. This change will enhance in version number returned.
Current version info returned won't be able to be recognized by Linux VF driver, change to values that both DPDK VF and Linux driver can recognize.
The expense is original DPDK host specific feature like CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available.
DPDK VF also can't identify host driver by version number returned. It always assume talking with Linux PF.
--- drivers/net/i40e/i40e_pf.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +13 -2
@@ -279,8 +279,19 @@ i40e_pf_host_process_cmd_version(struct i40e_pf_vf *vf, bool b_op) {struct i40e_virtchnl_version_info info; - info.major =I40E_DPDK_VERSION_MAJOR ; - info.minor =I40E_DPDK_VERSION_MINOR ; +/* Respond like a Linux PF host in order to support both DPDK VF and +* Linux VF driver. The expense is original DPDK host specific feature +* like CFG_VLAN_PVID and CONFIG_VSI_QUEUES_EXT will not available. +* +* DPDK VF also can't identify host driver by version number returned. +* It always assume talking with Linux PF. +* +* TODO: +* Discuss with Linux driver maintainer if possible to carry more info +* in this function to identify it's Linux or DPDK host. +*/ + info.major =I40E_VIRTCHNL_VERSION_MAJOR ; + info.minor =I40E_VIRTCHNL_VERSION_MINOR_NO_VF_CAPS ;if (b_op) i40e_pf_host_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_VERSION,
Signature · 1 line
2.9.3
PATCH v5 25/29 net/i40e: return correct VSI id
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
PF host didn't return correct VSI id to VF.
This change fix it.
--- drivers/net/i40e/i40e_pf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +1 -2
@@ -351,8 +351,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, bool b_op)/* Change below setting if PF host can support more VSIs for VF */ vf_res->vsi_res[0 ].vsi_type =I40E_VSI_SRIOV ; -/* As assume Vf only has single VSI now, always return 0 */ - vf_res->vsi_res[0 ].vsi_id =0 ; + vf_res->vsi_res[0 ].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0 ].num_queue_pairs = vf->vsi->nb_qps;ether_addr_copy (&vf->mac_addr, (struct ether_addr *)vf_res->vsi_res[0 ].default_mac_addr);
Signature · 1 line
2.9.3
PATCH v5 26/29 net/i40e: parse more VF parameter and configure
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
When VF requested to configure TX queue, a few parameters are missed to be configured in PF host. This change have more fields parsed and configured for TX context.
--- drivers/net/i40e/i40e_pf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_pf.c +3 -1
@@ -422,10 +422,12 @@ i40e_pf_host_hmc_config_txq(struct i40e_hw *hw,/* clear the context structure first */ memset (&tx_ctx,0 ,sizeof (tx_ctx)); - tx_ctx.new_context =1 ; tx_ctx.base = txq->dma_ring_addr /I40E_QUEUE_BASE_ADDR_UNIT ; tx_ctx.qlen = txq->ring_len; tx_ctx.rdylist =rte_le_to_cpu_16 (vf->vsi->info.qs_handle[0 ]); + tx_ctx.head_wb_ena = txq->headwb_enabled; + tx_ctx.head_wb_addr = txq->dma_headwb_addr; + err =i40e_clear_lan_tx_queue_context (hw, abs_queue_id);if (err !=I40E_SUCCESS )return err;
Signature · 1 line
2.9.3
PATCH v5 27/29 net/i40e: support Linux VF to configure IRQ link list
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
i40e PF host only support to work with DPDK VF driver, Linux VF driver is not supported. This change will enhance in configuring IRQ link list.
This Change will identify VF client by number of vector requested. DPDK VF will ask only single one while Linux VF will request at least 2. It will have different configuration for different clients. DPDK VF will be configured to link all queue together, while Linux VF will be configured per request.
--- drivers/net/i40e/i40e_pf.c | 151 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 138 insertions(+), 13 deletions(-)
drivers/net/i40e/i40e_pf.c +138 -13
@@ -585,14 +585,116 @@ i40e_pf_host_process_cmd_config_vsi_queues_ext(struct i40e_pf_vf *vf,return ret; } +static void +i40e_pf_config_irq_link_list (struct i40e_pf_vf *vf, +struct i40e_virtchnl_vector_map *vvm) +{ +uint64_t linklistmap =0 , tempmap; +struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf); +uint16_t qid; +bool b_first_q = true; +enum i40e_queue_type qtype; +uint16_t vector_id; +uint32_t reg, reg_idx; +uint16_t itr_idx =0 , i; + + vector_id = vvm->vector_id; +/* setup the head */ +if (!vector_id) + reg_idx =I40E_VPINT_LNKLST0 (vf->vf_idx); +else + reg_idx =I40E_VPINT_LNKLSTN ( + ((hw->func_caps.num_msix_vectors_vf -1 ) * vf->vf_idx) + + (vector_id -1 )); + +if (vvm->rxq_map ==0 && vvm->txq_map ==0 ) { +I40E_WRITE_REG (hw, reg_idx, +I40E_VPINT_LNKLST0_FIRSTQ_INDX_MASK ); + goto cfg_irq_done; + } + +/* sort all rx and tx queues */ + tempmap = vvm->rxq_map; +for (i =0 ; i <sizeof (vvm->rxq_map) *8 ; i++) { +if (tempmap &0x1 ) + linklistmap |= (1 << (2 * i)); + tempmap >>=1 ; + } + + tempmap = vvm->txq_map; +for (i =0 ; i <sizeof (vvm->txq_map) *8 ; i++) { +if (tempmap &0x1 ) + linklistmap |= (1 << (2 * i +1 )); + tempmap >>=1 ; + } + +/* Link all rx and tx queues into a chained list */ + tempmap = linklistmap; + i =0 ; + b_first_q = true; +do { +if (tempmap &0x1 ) { + qtype = (enum i40e_queue_type )(i %2 ); + qid = vf->vsi->base_queue + i /2 ; +if (b_first_q) { +/* This is header */ + b_first_q = false; + reg = ((qtype << +I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT ) + | qid); + }else { +/* element in the link list */ + reg = (vector_id) | + (qtype <<I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT ) | + (qid <<I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | +BIT (I40E_QINT_RQCTL_CAUSE_ENA_SHIFT ) | + (itr_idx <<I40E_QINT_RQCTL_ITR_INDX_SHIFT ); + } +I40E_WRITE_REG (hw, reg_idx, reg); +/* find next register to program */ +switch (qtype) { +case I40E_QUEUE_TYPE_RX : + reg_idx =I40E_QINT_RQCTL (qid); + itr_idx = vvm->rxitr_idx; +break ; +case I40E_QUEUE_TYPE_TX : + reg_idx =I40E_QINT_TQCTL (qid); + itr_idx = vvm->txitr_idx; +break ; +default : +break ; + } + } + i++; + tempmap >>=1 ; + }while (tempmap); + +/* Terminate the link list */ + reg = (vector_id) | + (0 <<I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT ) | + (0x7FF <<I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | +BIT (I40E_QINT_RQCTL_CAUSE_ENA_SHIFT ) | + (itr_idx <<I40E_QINT_RQCTL_ITR_INDX_SHIFT ); +I40E_WRITE_REG (hw, reg_idx, reg); + +cfg_irq_done: +I40E_WRITE_FLUSH (hw); +} +static int i40e_pf_host_process_cmd_config_irq_map (struct i40e_pf_vf *vf,uint8_t *msg,uint16_t msglen,bool b_op) {int ret =I40E_SUCCESS ; +struct i40e_pf *pf = vf->pf; +struct i40e_hw *hw =I40E_PF_TO_HW (vf->pf);struct i40e_virtchnl_irq_map_info *irqmap = (struct i40e_virtchnl_irq_map_info *)msg; +struct i40e_virtchnl_vector_map *map; +int i; +uint16_t vector_id; +unsigned long qbit_max;if (!b_op) { i40e_pf_host_send_msg_to_vf(
@@ -608,23 +710,46 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, goto send_msg; } -/* Assume VF only have 1 vector to bind all queues */ -if (irqmap->num_vectors !=1 ) { -PMD_DRV_LOG (ERR ,"DKDK host only support 1 vector" ); - ret =I40E_ERR_PARAM ; +/* PF host will support both DPDK VF or Linux VF driver, identify by +* number of vectors requested. +*/ + +/* DPDK VF only requires single vector */ +if (irqmap->num_vectors ==1 ) { +/* This MSIX intr store the intr in VF range */ + vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; + vf->vsi->nb_msix = irqmap->num_vectors; + vf->vsi->nb_used_qps = vf->vsi->nb_qps; + +/* Don't care how the TX/RX queue mapping with this vector. +* Link all VF RX queues together. Only did mapping work. +* VF can disable/enable the intr by itself. +*/ +i40e_vsi_queues_bind_intr (vf->vsi); goto send_msg; } -/* This MSIX intr store the intr in VF range */ - vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; - vf->vsi->nb_msix = irqmap->num_vectors; - vf->vsi->nb_used_qps = vf->vsi->nb_qps; +/* Then, it's Linux VF driver */ + qbit_max =1 << pf->vf_nb_qp_max; +for (i =0 ; i < irqmap->num_vectors; i++) { + map = &irqmap->vecmap[i]; + + vector_id = map->vector_id; +/* validate msg params */ +if (vector_id >= hw->func_caps.num_msix_vectors_vf) { + ret =I40E_ERR_PARAM ; + goto send_msg; + } + +if ((map->rxq_map < qbit_max) && (map->txq_map < qbit_max)) { +i40e_pf_config_irq_link_list (vf, map); + }else { +/* configured queue size excceed limit */ + ret =I40E_ERR_PARAM ; + goto send_msg; + } + } -/* Don't care how the TX/RX queue mapping with this vector. -* Link all VF RX queues together. Only did mapping work. -* VF can disable/enable the intr by itself. -*/ -i40e_vsi_queues_bind_intr (vf->vsi); send_msg:i40e_pf_host_send_msg_to_vf (vf,I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP , ret,NULL ,0 );
Signature · 1 line
2.9.3
PATCH v5 28/29 net/i40e: enhance in sanity check of MAC
In reply to Ferruh YigitFrom: "Chen Jing D(Mark)" <[email protected]>
When VF sends request to add a new MAC address, PF host will check if it's a non-zero or unicast address, or it will return with error. In fact, VF still can set multicast address. This change remove to check if it's a unicast address.
--- drivers/net/i40e/i40e_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_pf.c +2 -2
@@ -890,8 +890,8 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, mac = (struct ether_addr *)(addr_list->list[i].addr); (void )rte_memcpy (&filter.mac_addr, mac,ETHER_ADDR_LEN ); filter.filter_type =RTE_MACVLAN_PERFECT_MATCH ; -if (!is_valid_assigned_ether_addr (mac) || -i40e_vsi_add_mac (vf->vsi, &filter)) { +if (is_zero_ether_addr (mac) || +i40e_vsi_add_mac (vf->vsi, &filter)) { ret =I40E_ERR_INVALID_MAC_ADDR ; goto send_msg; }
Signature · 1 line
2.9.3
PATCH v5 29/29 net/i40e: set/clear VF stats from PF
In reply to Ferruh YigitFrom: Qi Zhang <[email protected]>
This patch add support to get/clear VF statistics
from PF side.
Two APIs are added:rte_pmd_i40e_get_vf_stats.rte_pmd_i40e_reset_vf_stats.
--- drivers/net/i40e/i40e_ethdev.c | 76 +++++++++++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 41 +++++++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 2 + 3 files changed, 119 insertions(+)
drivers/net/i40e/i40e_ethdev.c +76 -0
@@ -10462,3 +10462,79 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,return ret; } + +int +rte_pmd_i40e_get_vf_stats (uint8_t port, +uint16_t vf_id, +struct rte_eth_stats *stats) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_vsi *vsi; +int ret =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vsi = pf->vfs[vf_id].vsi; +i40e_update_vsi_stats (vsi); + + stats->ipackets = vsi->eth_stats.rx_unicast + + vsi->eth_stats.rx_multicast + + vsi->eth_stats.rx_broadcast; + stats->opackets = vsi->eth_stats.tx_unicast + + vsi->eth_stats.tx_multicast + + vsi->eth_stats.tx_broadcast; + stats->ibytes = vsi->eth_stats.rx_bytes; + stats->obytes = vsi->eth_stats.tx_bytes; + stats->ierrors = vsi->eth_stats.rx_discards; + stats->oerrors = vsi->eth_stats.tx_errors + vsi->eth_stats.tx_discards; + +return ret; +} + +int +rte_pmd_i40e_reset_vf_stats (uint8_t port, +uint16_t vf_id) +{ +struct rte_eth_dev *dev; +struct rte_eth_dev_info dev_info; +struct i40e_pf *pf; +struct i40e_vsi *vsi; +int ret =0 ; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port, -ENODEV ); + + dev = &rte_eth_devices[port]; +rte_eth_dev_info_get (port, &dev_info); + +if (vf_id >= dev_info.max_vfs) +return -EINVAL ; + + pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private); + +if (vf_id > pf->vf_num -1 || !pf->vfs) { +PMD_DRV_LOG (ERR ,"Invalid argument." ); +return -EINVAL ; + } + + vsi = pf->vfs[vf_id].vsi; + + vsi->offset_loaded = false; +i40e_update_vsi_stats (vsi); + +return ret; +}
drivers/net/i40e/rte_pmd_i40e.h +41 -0
45 lines not on this page · raw message
drivers/net/i40e/rte_pmd_i40e_version.map +2 -0
@@ -6,7 +6,9 @@ DPDK_2.0 { DPDK_17.02 { global: + rte_pmd_i40e_get_vf_stats; rte_pmd_i40e_ping_vfs; + rte_pmd_i40e_reset_vf_stats; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_mac_addr;
Signature · 1 line
2.9.3
Re: [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode on i40e
In reply to Ferruh Yigitapp/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_vf_mac_addr = { · line 11615
Quoted 4 lines · Ferruh Yigit
app/test-pmd/cmdline.c +4
-0+#ifdef RTE_LIBRTE_I40E_PMD + ret =rte_pmd_i40e_set_vf_unicast_promisc (res->port_id, + res->vf_id, is_on); +#endif
Why is an ifdef used here? It won't scale to all PMDs.
I means that you are missing an abstraction layer.
Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
In reply to Ferruh Yigitapp/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result, · line 277
Quoted 7 lines · Ferruh Yigit
app/test-pmd/cmdline.c +2
-0+#ifdef RTE_LIBRTE_IXGBE_PMD "set all queues drop (port_id) (on|off)\n" " Set drop enable bit for all queues.\n\n" "set vf split drop (port_id) (vf_id) (on|off)\n" " Set split drop enable bit for a VF from the PF.\n\n" +#endif
it is not related to i40e. This serie should only be for i40e.
Moreover, it is a strange logic: how will it scale for all PMDs?
Re: [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command
In reply to Ferruh Yigitapp/test-pmd/cmdline.c cmd_vf_rx_vlan_filter_parsed(void *parsed_result, · line 6870
Quoted 10 lines · Ferruh Yigit
app/test-pmd/cmdline.c +10
-0+#ifdef RTE_LIBRTE_IXGBE_PMD +if (strstr (dev_info.driver_name,"ixgbe" ) !=NULL ) + ret =rte_pmd_ixgbe_set_vf_vlan_filter (res->port_id, + res->vlan_id, res->vf_mask, is_add); +#endif +#ifdef RTE_LIBRTE_I40E_PMD +if (strstr (dev_info.driver_name,"i40e" ) !=NULL ) + ret =rte_pmd_i40e_set_vf_vlan_filter (res->port_id, + res->vlan_id, res->vf_mask, is_add); +#endif
That's exactly what we need to avoid, it won't scale to many PMDs.
Quoted 2 lines · Ferruh Yigit
As we need to support the scenario kernel PF + DPDK VF, DPDK follows the interface between kernel PF + kernel VF.
Please, it has to be proven that DPDK provides the same interface that the kernel. It seems insane to duplicate kernel's PF into the DPDK without a strong guarantee that it is a strict same behaviour. For instance,
- what will happen when the DPDK's PF will have a new feature which
is not into the kernel?
- what will happen when the Kernel's PF will have a feature with
different capabilities that the kernel?
Please, make it clear before. Currently, for me it is a nack of this serie.
Thank you,
Vincent
Hi, Vincent,
Quoted 20 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Vincent JARDIN
Sent: Saturday, December 17, 2016 4:36 AM
To: Yigit, Ferruh <[email protected]>; [email protected]
Cc: Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40eQuoted 2 lines · Ferruh Yigit
As we need to support the scenario kernel PF + DPDK VF, DPDK follows the interface between kernel PF + kernel VF.
Please, it has to be proven that DPDK provides the same interface that the kernel. It seems insane to duplicate kernel's PF into the DPDK without a strong guarantee that it is a strict same behaviour. For instance,
- what will happen when the DPDK's PF will have a new feature which
is not into the kernel?
- what will happen when the Kernel's PF will have a feature with
different capabilities that the kernel?
Quoted 2 lines
Please, make it clear before. Currently, for me it is a nack of this serie.
Let me try to explain.
When we DPDK developed i40e drivers several years ago, we found the API and data structures defined in shared code for VF and PF device communication can satisfy DPDK's requirements, so we just followed that API. At that time, we'll try to satisfy 3 scenarios.
1. Linux PF + Linux VF : it's not our scope.
2. Linux PF + DPDK VF: there is no problems observed since we use same API.
3. DPDK PF + DPDK VF: that's fully under control.
The only scenario was not considered is DPDK PF + Linux VF.
Since then, both Linux and DPDK keep developing code. Then, we found it's necessary to extend VF capability (Like promiscuous mode). It will be hard to ask Linux PF to support that service considering upstream effort in Linux world. So, supporting it in scenario of DPDK PF + DPDK VF became best candidate. But how can VF identify who is serving it then decide if extended request can be dispatched? So, DPDK PF will send a special version number for this purpose.
As time passed by, we realized there some use case for DPDK PF + Linux VF and it's not supported yet. Then, we found our implementation in DPDK PF is not complete since we only had considered how to serve DPDK VF at that time. So, we need some improvement on the PF host driver. Besides that, 'send a special version' to VF doesn't work now since Linux VF can't interpret the version info. So, we behave the same as Linux PF driver with sacrifice of extended function in DPDK VF.
Let me summary the chang here.
1. We shared the same interface with Linux driver from beginning.
2. This change will support both Linux VF and DPDK VF.
3. We'll find a way for DPDK VF identifying who is serving it so it can use extended function in future release.
Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
In reply to Vincent JARDINQuoted 10 lines · Vincent JARDIN
app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result, · line 277
Quoted 7 lines · Ferruh Yigit
app/test-pmd/cmdline.c +2
-0+#ifdef RTE_LIBRTE_IXGBE_PMD "set all queues drop (port_id) (on|off)\n" " Set drop enable bit for all queues.\n\n" "set vf split drop (port_id) (vf_id) (on|off)\n" " Set split drop enable bit for a VF from the PF.\n\n" +#endif it is not related to i40e. This serie should only be for i40e.
Please check the patch a little wider, it doesn't introduce the ifdef, instead patch narrows down the scope of ifdef [1], because now some functions are not just for ixgbe, but used both with i40e and ixgbe, so the ifdef moved into the function itself [2].
[1]
-#ifdef RTE_LIBRTE_IXGBE_PMD
"set tx loopback (port_id) (on|off)\n"
" Enable or disable tx loopback.\n\n"
+#ifdef RTE_LIBRTE_IXGBE_PMD
"set all queues drop (port_id) (on|off)\n"
" Set drop enable bit for all queues.\n\n"
"set vf split drop (port_id) (vf_id) (on|off)\n"
" Set split drop enable bit for a VF from the PF.\n\n"
+#endif
"set vf mac antispoof (port_id) (vf_id) (on|off).\n"
" Set MAC antispoof for a VF from the PF.\n\n"
-#endif
[2]
@@ -11187,10 +11242,21 @@ cmd_set_tx_loopback_parsed(
...
+#ifdef RTE_LIBRTE_IXGBE_PMD
+ if (strstr(dev_info.driver_name, "ixgbe") != NULL)
+ ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on);
+#endif
+#ifdef RTE_LIBRTE_I40E_PMD
+ if (strstr(dev_info.driver_name, "i40e") != NULL)
+ ret = rte_pmd_i40e_set_tx_loopback(res->port_id, is_on);
+#endif
Quoted 2 lines
Moreover, it is a strange logic: how will it scale for all PMDs?
It won't.
That is why they are in ifdef.
These are PMD specific APIs, as naming convention shows "rte_pmd_i40e_..."
For the PMD features, which are not generic enough, but hardware is capable and user may want to benefit from, PMD specific APIs exists. Instead of these functions bloat the eth_dev layer, and give a fake sense of abstraction, these APIs moved into PMDs.
And it is always possible to move these into ethdev layer, when multiple PMDs supports same feature.
I agree this is something that needs to keep an eye on it, and be sure if an API is generic, move it into eth_dev layer.
The application that use the PMD specific API, needs to be conditionally compiled because that API may not always exits.
Thanks,
ferruh
Re: [PATCH v5 19/29] app/testpmd: use unicast promiscuous mode on i40e
In reply to Vincent JARDINQuoted 7 lines · Vincent JARDIN
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_vf_mac_addr = { · line 11615
Quoted 4 lines · Ferruh Yigit
app/test-pmd/cmdline.c +4
-0+#ifdef RTE_LIBRTE_I40E_PMD + ret =rte_pmd_i40e_set_vf_unicast_promisc (res->port_id, + res->vf_id, is_on); +#endif Why is an ifdef used here? It won't scale to all PMDs.
As explained in previous e-mail, because these are PMD specific APIs. And it is not expected to scale to all PMDs.
Quoted 3 lines
I means that you are missing an abstraction layer.
Yes, intentionally.
Re: [PATCH v5 23/29] app/testpmd: handle i40e in VF VLAN filter command
In reply to Vincent JARDINQuoted 14 lines · Vincent JARDIN
app/test-pmd/cmdline.c cmd_vf_rx_vlan_filter_parsed(void *parsed_result, · line 6870
Quoted 10 lines · Ferruh Yigit
app/test-pmd/cmdline.c +10
-0+#ifdef RTE_LIBRTE_IXGBE_PMD +if (strstr (dev_info.driver_name,"ixgbe" ) !=NULL ) + ret =rte_pmd_ixgbe_set_vf_vlan_filter (res->port_id, + res->vlan_id, res->vf_mask, is_add); +#endif +#ifdef RTE_LIBRTE_I40E_PMD +if (strstr (dev_info.driver_name,"i40e" ) !=NULL ) + ret =rte_pmd_i40e_set_vf_vlan_filter (res->port_id, + res->vlan_id, res->vf_mask, is_add); +#endif That's exactly what we need to avoid, it won't scale to many PMDs.
For a generic PMD feature, completely agree with you. Application shouldn't know/worry about underlying hardware. eth_dev layer should be used.
But above usage is for an application that knows the hardware, and knowing that it is losing all the benefits of the portability and explicitly including the PMD header to use those PMD specific APIs.
Thanks,
ferruh
2016-12-19 09:01, Chen, Jing D:
Quoted 3 lines
Since then, both Linux and DPDK keep developing code. Then, we found it's necessary to extend VF capability (Like promiscuous mode). It will be hard to ask Linux PF to support that service considering upstream effort in Linux world.
Please, could you clarify this?
Do you mean you cannot change the Linux driver?
Quoted 10 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, December 19, 2016 9:21 PM
To: Chen, Jing D <[email protected]>
Cc: [email protected]; Vincent JARDIN <[email protected]>; Yigit, Ferruh <[email protected]>; Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
Quoted 8 lines
2016-12-19 09:01, Chen, Jing D:
Quoted 3 lines
Since then, both Linux and DPDK keep developing code. Then, we found it's necessary to extend VF capability (Like promiscuous mode). It will be hard to ask Linux PF to support that service considering upstream
effort in Linux world.
Please, could you clarify this?
Do you mean you cannot change the Linux driver?
There are 2 things here. One is to add extended functionality into Linux driver, Another is to have it upstream into kernel world.
The first one can be achieved easier, while later one may be difficult. They will have concern why VM can have such privilege (like promisc mode). But I need to check as I know there is some mechanism now to make a VM privileged.
Quoted 3 lines · Jing D
They will
have concern why VM can have such privilege (like promisc mode). But I need to check as I know there is some mechanism now to make a VM privileged.
From iproute2's man:
<--
trust on|off - trust the specified VF user. This enables that VF user can set a specific feature which may impact security and/or performance. (e.g. VF multicast promiscuous mode) -->
So yes, it is possible to get PF features upstream'd into the kernel without having a specific PF into DPDK.
best regards,
Vincent
Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
In reply to Ferruh YigitQuoted 20 lines · Ferruh Yigit
From: Wenzhuo Lu <[email protected]>
The new VF Daemon (VFD) APIs is implemented on i40e. Change testpmd code to use them, including VF MAC anti-spoofing, VF VLAN anti-spoofing, TX loopback, VF VLAN strip, VF VLAN insert.
Signed-off-by Wenzhuo Lu <[email protected]>Signed-off-by Chen Jing D(Mark) <[email protected]>Signed-off-by Bernard Iremonger <[email protected]>--- app/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 150 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 121 insertions(+), 31 deletions(-)app/test-pmd/Makefile +0
-0
app/test-pmd/Makefile SRCS-y += csumonly.c · line 61
Quoted 4 lines
app/test-pmd/Makefile +1
-0@@ -58,7 +58,9 @@ SRCS-y += csumonly.c SRCS-y += icmpecho.c SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c +_LDLIBS-y += --whole-archive
Hi Wenzhuo,
Following lines are required for shared library, but I guess above line required because they cause problem with static library.
So, instead of adding above line, what do you think wrapping below lines with ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) ?
Quoted 5 lines
app/test-pmd/Makefile +1
-0_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e CFLAGS_cmdline.o := -D_GNU_SOURCE
<...>
Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
Hi Ferruh,
Quoted 30 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Tuesday, December 20, 2016 1:10 AM
To: [email protected]
Cc: Wu, Jingjing; Zhang, Helin; Lu, Wenzhuo; Chen, Jing D; Iremonger, Bernard
Subject: Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40eQuoted 22 lines · Ferruh Yigit
From: Wenzhuo Lu <[email protected]>
The new VF Daemon (VFD) APIs is implemented on i40e. Change testpmd code to use them, including VF MAC anti-spoofing, VF VLAN anti-spoofing, TX loopback, VF VLAN strip, VF VLAN insert.
Signed-off-by Wenzhuo Lu <[email protected]>Signed-off-by Chen Jing D(Mark) <[email protected]>Signed-off-by Bernard Iremonger <[email protected]>--- app/test-pmd/Makefile | 2 + app/test-pmd/cmdline.c | 150 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 121 insertions(+), 31 deletions(-)app/test-pmd/Makefile index renamed from app/test-pmd/Makefile +0
-0891b85a..a0c3366 100644
app/test-pmd/Makefile +0
-0@@ -58,7 +58,9 @@ SRCS-y += csumonly.c SRCS-y += icmpecho.c SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
Quoted 8 lines
app/test-pmd/Makefile SRCS-y += csumonly.c · line 61
Quoted 1 line
app/test-pmd/Makefile +1
-0+_LDLIBS-y += --whole-archiveHi Wenzhuo,
Following lines are required for shared library, but I guess above line required because they cause problem with static library.
So, instead of adding above line, what do you think wrapping below lines with ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) ?
Thanks for your suggestion. It's also a choice. I'll change it.
Quoted 7 lines
Quoted 6 lines
app/test-pmd/Makefile +1
-0_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e CFLAGS_cmdline.o := -D_GNU_SOURCE<...>
Hi,
Quoted 22 lines
-----Original Message-----
From: Vincent JARDIN [mailto:[email protected]]
Sent: Monday, December 19, 2016 9:46 PM
To: Chen, Jing D <[email protected]>; Thomas Monjalon <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40eQuoted 3 lines · Jing D
They will
have concern why VM can have such privilege (like promisc mode). But I need to check as I know there is some mechanism now to make a VM privileged.From iproute2's man:
<--
trust on|off - trust the specified VF user. This enables that VF user can set a specific feature which may impact security and/or performance. (e.g. VF multicast promiscuous mode)
-->
Quoted 2 lines
So yes, it is possible to get PF features upstream'd into the kernel without having a specific PF into DPDK.
That's a collaboration with another team. we'll follow-up that but not guarantee it will happen.
May I ask if my reply make it clear? Still NAC for this patch?
Re: [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
In reply to Ferruh YigitQuoted 10 lines · Ferruh Yigit
From: Qi Zhang <[email protected]>
This patch add support to get/clear VF statistics
from PF side.
Two APIs are added:rte_pmd_i40e_get_vf_stats.rte_pmd_i40e_reset_vf_stats.Signed-off-by Qi Zhang <[email protected]>---
<...>
Quoted 5 lines
drivers/net/i40e/rte_pmd_i40e_version.map +0
-0
drivers/net/i40e/rte_pmd_i40e_version.map DPDK_2.0 { · line 14
Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e_version.map +2
-0@@ -6,7 +6,9 @@ DPDK_2.0 { DPDK_17.02 { global: + rte_pmd_i40e_get_vf_stats; rte_pmd_i40e_ping_vfs; + rte_pmd_i40e_reset_vf_stats; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_mac_addr;
Hi Wenzhuo, Mark,
I think this is the list of all APIs added with this patchset.
Just a question, what do you think following a logic in API naming as:
<name_space>_<object>_<action> ?
So API names become:rte_pmd_i40e_tx_loopback_set;rte_pmd_i40e_vf_broadcast_set;rte_pmd_i40e_vf_mac_addr_set;rte_pmd_i40e_vfs_ping;rte_pmd_i40e_vf_stats_get;rte_pmd_i40e_vf_stats_reset;
After above rename, rte_pmd_i40e_tx_loopback_set() is not giving a hint that this is something related to the PF controlling VF, perhaps we can rename the API ?
Also rte_pmd_i40e_vfs_ping() can become rte_pmd_i40e_vf_ping_all() to be more consistent about _vf_ usage.
Overall, they can be something like:rte_pmd_i40e_vf_broadcast_set;rte_pmd_i40e_vf_mac_addr_set;rte_pmd_i40e_vf_ping_all;rte_pmd_i40e_vf_stats_get;rte_pmd_i40e_vf_stats_reset;rte_pmd_i40e_vf_tx_loopback_set;
What do you think?
Quoted 1 line
Re: [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
Hi Ferruh,
Quoted 70 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Tuesday, December 20, 2016 1:25 PM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>; Zhang, Qi Z <[email protected]>; Lu, Wenzhuo <[email protected]>; Chen, Jing D <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from PFQuoted 9 lines · Ferruh Yigit
From: Qi Zhang <[email protected]>
This patch add support to get/clear VF statistics from PF side. Two APIs are added:
rte_pmd_i40e_get_vf_stats.rte_pmd_i40e_reset_vf_stats.Signed-off-by Qi Zhang <[email protected]>---
<...>
Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e_version.map +0
-0drivers/net/i40e/rte_pmd_i40e_version.map DPDK_2.0 { · line 14
Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e_version.map +2
-0@@ -6,7 +6,9 @@ DPDK_2.0 { DPDK_17.02 { global: + rte_pmd_i40e_get_vf_stats; rte_pmd_i40e_ping_vfs; + rte_pmd_i40e_reset_vf_stats; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_mac_addr;Hi Wenzhuo, Mark,
I think this is the list of all APIs added with this patchset.
Just a question, what do you think following a logic in API naming as:
<name_space>_<object>_<action> ?So API names become:
rte_pmd_i40e_tx_loopback_set;rte_pmd_i40e_vf_broadcast_set;rte_pmd_i40e_vf_mac_addr_set;rte_pmd_i40e_vfs_ping;rte_pmd_i40e_vf_stats_get;rte_pmd_i40e_vf_stats_reset;After above rename,
rte_pmd_i40e_tx_loopback_set()is not giving a hint that this is something related to the PF controlling VF, perhaps we can rename the API ?Also
rte_pmd_i40e_vfs_ping()can becomerte_pmd_i40e_vf_ping_all()to be more consistent about _vf_ usage.Overall, they can be something like:
rte_pmd_i40e_vf_broadcast_set;rte_pmd_i40e_vf_mac_addr_set;rte_pmd_i40e_vf_ping_all;rte_pmd_i40e_vf_stats_get;rte_pmd_i40e_vf_stats_reset;rte_pmd_i40e_vf_tx_loopback_set;
Quoted 2 lines
What do you think?
I think the naming should be consistent with what has already been implemented for the ixgbe PMD.
rte_pmd_ixgbe_set_all_queues_drop_en; rte_pmd_ixgbe_set_tx_loopback; rte_pmd_ixgbe_set_vf_mac_addr; rte_pmd_ixgbe_set_vf_mac_anti_spoof; rte_pmd_ixgbe_set_vf_split_drop_en; rte_pmd_ixgbe_set_vf_vlan_anti_spoof; rte_pmd_ixgbe_set_vf_vlan_insert; rte_pmd_ixgbe_set_vf_vlan_stripq; rte_pmd_ixgbe_set_vf_rate_limit; rte_pmd_ixgbe_set_vf_rx; rte_pmd_ixgbe_set_vf_rxmode; rte_pmd_ixgbe_set_vf_tx; rte_pmd_ixgbe_set_vf_vlan_filter;
Regards,
Bernard.
Quoted 3 lines · Jing D
That's a collaboration with another team. we'll follow-up that but not guarantee it will happen.
May I ask if my reply make it clear? Still NAC for this patch?
Yes still nack, I am not confident with this PF approach since you are breaking Linux PF behavior. It does not provide guarantees with PF. Something is missing to guarantee the compatibilities.
Thank you,
Vincent
Re: [PATCH v5 18/29] app/testpmd: use VFD APIs on i40e
In reply to Ferruh YigitQuoted 4 lines · Ferruh Yigit
And it is always possible to move these into ethdev layer, when multiple PMDs supports same feature.
I agree this is something that needs to keep an eye on it, and be sure if an API is generic, move it intoeth_devlayer.
you are right, you have a good point, it is better to try this approach, and let's generalize later.
thank you for your comments,
Vincent
Quoted 8 lines · Vincent JARDIN
Quoted 3 lines · Jing D
That's a collaboration with another team. we'll follow-up that but not guarantee it will happen.
May I ask if my reply make it clear? Still NAC for this patch?Yes still nack, I am not confident with this PF approach since you are breaking Linux PF behavior. It does not provide guarantees with PF. Something is missing to guarantee the compatibilities.
Hi Vincent, Mark,
What do you think separating the mentioned patch (patch 24/29) from patchset and submit as a standalone patch, so that it can be discussed more without blocking the patchset?
Thanks,
ferruh
Quoted 4 lines
Thank you,
Vincent
Hi all,
Quoted 18 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Tuesday, December 20, 2016 11:32 PM
To: Vincent JARDIN; Chen, Jing D; Thomas Monjalon
Cc: [email protected]; Wu, Jingjing; Zhang, Helin
Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40eQuoted 8 lines · Vincent JARDIN
Quoted 3 lines · Jing D
That's a collaboration with another team. we'll follow-up that but not guarantee it will happen.
May I ask if my reply make it clear? Still NAC for this patch?Yes still nack, I am not confident with this PF approach since you are breaking Linux PF behavior. It does not provide guarantees with PF. Something is missing to guarantee the compatibilities.
Quoted 5 lines
Hi Vincent, Mark,
What do you think separating the mentioned patch (patch 24/29) from patchset and submit as a standalone patch, so that it can be discussed more without blocking the patchset?
+1 :)
Quoted 8 lines
Thanks,
ferruhQuoted 4 lines
Thank you,
Vincent
Re: [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
In reply to Iremonger, BernardHi all,
Quoted 84 lines
-----Original Message-----
From: Iremonger, Bernard
Sent: Tuesday, December 20, 2016 9:40 PM
To: Yigit, Ferruh; [email protected]
Cc: Wu, Jingjing; Zhang, Helin; Zhang, Qi Z; Lu, Wenzhuo; Chen, Jing D
Subject: RE: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from PFHi Ferruh,
Quoted 70 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Tuesday, December 20, 2016 1:25 PM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>; Zhang, Qi Z <[email protected]>; Lu, Wenzhuo <[email protected]>; Chen, Jing D <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from PFQuoted 9 lines · Ferruh Yigit
From: Qi Zhang <[email protected]>
This patch add support to get/clear VF statistics from PF side. Two APIs are added:
rte_pmd_i40e_get_vf_stats.rte_pmd_i40e_reset_vf_stats.Signed-off-by Qi Zhang <[email protected]>---
<...>
Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e_version.map +0
-0drivers/net/i40e/rte_pmd_i40e_version.map DPDK_2.0 { · line 14
Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e_version.map +2
-0@@ -6,7 +6,9 @@ DPDK_2.0 { DPDK_17.02 { global: + rte_pmd_i40e_get_vf_stats; rte_pmd_i40e_ping_vfs; + rte_pmd_i40e_reset_vf_stats; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_mac_addr;Hi Wenzhuo, Mark,
I think this is the list of all APIs added with this patchset.
Just a question, what do you think following a logic in API naming as:
<name_space>_<object>_<action> ?So API names become:
rte_pmd_i40e_tx_loopback_set;rte_pmd_i40e_vf_broadcast_set;rte_pmd_i40e_vf_mac_addr_set;rte_pmd_i40e_vfs_ping;rte_pmd_i40e_vf_stats_get;rte_pmd_i40e_vf_stats_reset;After above rename,
rte_pmd_i40e_tx_loopback_set()is not giving a hint that this is something related to the PF controlling VF, perhaps we can rename the API ?Also
rte_pmd_i40e_vfs_ping()can becomerte_pmd_i40e_vf_ping_all()to be more consistent about _vf_ usage.Overall, they can be something like:
rte_pmd_i40e_vf_broadcast_set;rte_pmd_i40e_vf_mac_addr_set;rte_pmd_i40e_vf_ping_all;rte_pmd_i40e_vf_stats_get;rte_pmd_i40e_vf_stats_reset;rte_pmd_i40e_vf_tx_loopback_set;Quoted 2 lines
What do you think?
I think the naming should be consistent with what has already been implemented for the ixgbe PMD.
Quoted 14 lines
rte_pmd_ixgbe_set_all_queues_drop_en; rte_pmd_ixgbe_set_tx_loopback; rte_pmd_ixgbe_set_vf_mac_addr; rte_pmd_ixgbe_set_vf_mac_anti_spoof; rte_pmd_ixgbe_set_vf_split_drop_en; rte_pmd_ixgbe_set_vf_vlan_anti_spoof; rte_pmd_ixgbe_set_vf_vlan_insert; rte_pmd_ixgbe_set_vf_vlan_stripq; rte_pmd_ixgbe_set_vf_rate_limit; rte_pmd_ixgbe_set_vf_rx; rte_pmd_ixgbe_set_vf_rxmode; rte_pmd_ixgbe_set_vf_tx; rte_pmd_ixgbe_set_vf_vlan_filter;
So, seems better to use the current names. Rework both ixgbe and i40e's later. Not sure if it'll be counted as the ABI change if we change the ixgbe's name.
Quoted 4 lines
Regards,
Bernard.
Hi, Vincent,
Quoted 10 lines
-----Original Message-----
From: Vincent JARDIN [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 11:19 PM
To: Chen, Jing D <[email protected]>; Thomas Monjalon <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40e
Quoted 8 lines
Quoted 3 lines · Jing D
That's a collaboration with another team. we'll follow-up that but not guarantee it will happen.
May I ask if my reply make it clear? Still NAC for this patch?Yes still nack, I am not confident with this PF approach since you are breaking Linux PF behavior. It does not provide guarantees with PF. Something is missing to guarantee the compatibilities.
Let me introduce the rationale of API between PF and VF.
There is a common head file visible to both PF and VF, which includes a set of command and data structures, which is managed by a version number. Below is an example.
Major_verion=1
Minor_verion=1
enum i40e_virtchnl_ops {
CMD_GET_VERSION,
CMD_RESET_VF,
......
}struct i40e_virtchnl_version_info {
u32 major;
u32 minor;
};......
So, both PF and VF strictly follow the spec. VF send request with expected command and data structures to PF host. PF do sanity check and configure, finally applied to HW.
As developing the code, it's possible to have multiple version of API occurred with 'major_verion' or 'minor_version' changed. So, at the initialization stage, VF and PF will use a command 'CMD_GET_VERSION' to negotiate what language (what version of API) they should use and setup conversation.
So, from my perspective, there is no issue here.
In the meanwhile, we have some test models ongoing to validate combination of Linux and DPDK drivers for VF and PF. We'll fully support below 4 cases going forward.
1. DPDK PF + DPDK VF
2. DPDK PF + Linux VF
3. Linux PF + DPDK VF
4. Linux PF + Linux VF (it's not our scope)
After applied this patch, i've done below test without observing compatibility issue.
1. DPDK PF + DPDK VF (middle of 16.11 and 17.02 code base). PF to support API 1.0 while VF
to support API 1.1/1.0
2. DPDK PF + Linux VF 1.5.14. PF to support 1.0, while Linux to support 1.1/1.0
Linux PF + DPDK VF has been tested with 1.0 API long time ago. There is some test activities ongoing.
Finally, please give strong reasons to support your NAC.
Quoted 4 lines · Jing D
In the meanwhile, we have some test models ongoing to validate combination of Linux and DPDK drivers for VF and PF. We'll fully support below 4 cases going forward.
1. DPDK PF + DPDK VF
2. DPDK PF + Linux VF
+ DPDK PF + FreeBSD VF
+ DPDK PF + Windows VF
+ DPDK PF + OS xyz VF
Quoted 2 lines
3. Linux PF + DPDK VF
4. Linux PF + Linux VF (it's not our scope)
So, you confirm the issue: having DPDK becoming a PF, even if SRIOV protocol includes version-ing, it doubles the combinatory cases.
Quoted 10 lines
After applied this patch, i've done below test without observing compatibility issue.
1. DPDK PF + DPDK VF (middle of 16.11 and 17.02 code base). PF to support API 1.0 while VFto support API 1.1/1.02. DPDK PF + Linux VF 1.5.14. PF to support 1.0, while Linux to support 1.1/1.0
Linux PF + DPDK VF has been tested with 1.0 API long time ago. There is some test activities ongoing.
Finally, please give strong reasons to support your NAC.
I feel bad because I do recognize the strong and hard work that you have done on this PF development, but I feel we need first to assess if DPDK should become a PF or not. I know ixgbe did open the path and that they are some historical DPDK PF supports in Intel NICs, but before we generalize it, we have to make sure we are not turning this DataPlane development Kit into a ControlPlane Driver Kit that we are scared to upstream into Linux kernel. Even if "DPDK is not Linux", it does not mean that Linux should be ignored. In case of DPDK on other OS, same, their PF could be extended too.
So currently, yes, I do keep a nack't
Since DPDK PF features can be into Linux PF features too and since Linux (and other hypervisors) has already some tools to manage PF (see iproute2, etc.), why should we have an other management path with DPDK? DPDK is aimed to be a Dataplane Development kit, not a management/control plane driver kit.
Assuming you want to use DPDK PF for dataplane feature, that could be OK then, using:
- configure one VF on the hypervisor from Linux's PF, let's name ifVF_forPFtraffic, see http://dpdk.org/doc/guides/howto/flow_bifurcation.html
- have no (or few IO)s to the PF's queue
- assign the traffic to all VF_forPFtraffic's queues of the hypervisor,
- run DPDK into the hypervisor's VF_forPFtraffic
Doing so, we get the same benefit of running DPDK over PF or running DPDK over VF_forPFtraffic, don't we? It is a benefit of:
http://dpdk.org/doc/guides/howto/flow_bifurcation.html
Thank you,
Vincent
Re: [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
In reply to Lu, WenzhuoQuoted 110 lines
-----Original Message-----
From: Lu, Wenzhuo
Sent: Wednesday, December 21, 2016 12:56 AM
To: Iremonger, Bernard <[email protected]>; Yigit, Ferruh <[email protected]>; [email protected]
Cc: Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>; Zhang, Qi Z <[email protected]>; Chen, Jing D <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from PFHi all,
Quoted 8 lines
-----Original Message-----
From: Iremonger, Bernard
Sent: Tuesday, December 20, 2016 9:40 PM
To: Yigit, Ferruh; [email protected]
Cc: Wu, Jingjing; Zhang, Helin; Zhang, Qi Z; Lu, Wenzhuo; Chen, Jing D
Subject: RE: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from PFQuoted 9 lines
Hi Ferruh,
Quoted 7 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Tuesday, December 20, 2016 1:25 PM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Zhang, Helin <[email protected]>; Zhang, Qi Z <[email protected]>; Lu, Wenzhuo <[email protected]>; Chen, Jing DQuoted 77 lines
Quoted 63 lines
Subject: Re: [dpdk-dev] [PATCH v5 29/29] net/i40e: set/clear VF stats from PF
Quoted 9 lines · Ferruh Yigit
From: Qi Zhang <[email protected]>
This patch add support to get/clear VF statistics from PF side. Two APIs are added:
rte_pmd_i40e_get_vf_stats.rte_pmd_i40e_reset_vf_stats.Signed-off-by Qi Zhang <[email protected]>---
<...>
Quoted 6 lines
drivers/net/i40e/rte_pmd_i40e_version.map +0
-0drivers/net/i40e/rte_pmd_i40e_version.map DPDK_2.0 { · line 14
Quoted 9 lines
drivers/net/i40e/rte_pmd_i40e_version.map +2
-0@@ -6,7 +6,9 @@ DPDK_2.0 { DPDK_17.02 { global: + rte_pmd_i40e_get_vf_stats; rte_pmd_i40e_ping_vfs; + rte_pmd_i40e_reset_vf_stats; rte_pmd_i40e_set_tx_loopback; rte_pmd_i40e_set_vf_broadcast; rte_pmd_i40e_set_vf_mac_addr;Hi Wenzhuo, Mark,
I think this is the list of all APIs added with this patchset.
Just a question, what do you think following a logic in API naming as:
<name_space>_<object>_<action> ?So API names become:
rte_pmd_i40e_tx_loopback_set;rte_pmd_i40e_vf_broadcast_set;rte_pmd_i40e_vf_mac_addr_set;rte_pmd_i40e_vfs_ping;rte_pmd_i40e_vf_stats_get;rte_pmd_i40e_vf_stats_reset;After above rename,
rte_pmd_i40e_tx_loopback_set()is not giving a hint that this is something related to the PF controlling VF, perhaps we can rename the API ?Also
rte_pmd_i40e_vfs_ping()can becomerte_pmd_i40e_vf_ping_all()to be more consistent about _vf_ usage.Overall, they can be something like:
rte_pmd_i40e_vf_broadcast_set;rte_pmd_i40e_vf_mac_addr_set;rte_pmd_i40e_vf_ping_all;rte_pmd_i40e_vf_stats_get;rte_pmd_i40e_vf_stats_reset;rte_pmd_i40e_vf_tx_loopback_set;Quoted 2 lines
What do you think?
I think the naming should be consistent with what has already been implemented for the ixgbe PMD.
rte_pmd_ixgbe_set_all_queues_drop_en; rte_pmd_ixgbe_set_tx_loopback; rte_pmd_ixgbe_set_vf_mac_addr; rte_pmd_ixgbe_set_vf_mac_anti_spoof; rte_pmd_ixgbe_set_vf_split_drop_en; rte_pmd_ixgbe_set_vf_vlan_anti_spoof; rte_pmd_ixgbe_set_vf_vlan_insert; rte_pmd_ixgbe_set_vf_vlan_stripq;
Quoted 9 lines
Quoted 5 lines
rte_pmd_ixgbe_set_vf_rate_limit; rte_pmd_ixgbe_set_vf_rx; rte_pmd_ixgbe_set_vf_rxmode; rte_pmd_ixgbe_set_vf_tx; rte_pmd_ixgbe_set_vf_vlan_filter;So, seems better to use the current names. Rework both ixgbe and i40e's later. Not sure if it'll be counted as the ABI change if we change the ixgbe's name.
A similar naming convention was used originally in the ethdev:rte_eth_dev_set_vf_rxmoderte_eth_dev_set_vf_rxrte_eth_dev_set_vf_txrte_eth_dev_set_vf_vlan_filter rte_eth_dev_set_vf_rate_limit
rte_eth_dev has just been replaced with rte_pmd_<ixgbe|i40e>
Regards,
Bernard.
Vincent,
Sorry, I missed this reply.
Quoted 12 lines · Jing D
Quoted 2 lines
In the meanwhile, we have some test models ongoing to validate combination of Linux and DPDK drivers for VF and PF. We'll fully support
below 4 cases going forward.
Quoted 2 lines
1. DPDK PF + DPDK VF
2. DPDK PF + Linux VF+ DPDK PF + FreeBSD VF
+ DPDK PF + Windows VF
+ DPDK PF + OS xyz VF
If all drivers follow same API spec, what's the problem here? What extra DPDK PF effort you observed?
Quoted 5 lines
Quoted 2 lines
3. Linux PF + DPDK VF
4. Linux PF + Linux VF (it's not our scope)So, you confirm the issue: having DPDK becoming a PF, even if SRIOV protocol includes version-ing, it doubles the combinatory cases.
If extended functions are needed, the answer is yes.
That's not a big problem, right? I have several workarounds/approaches to support extended funcs while following original API spec. I can fix it in this release. In order to have a mature solution, I left it here for further implementation.
Quoted 15 lines
Quoted 3 lines
After applied this patch, i've done below test without observing
compatibility issue.
Quoted 1 line
1. DPDK PF + DPDK VF (middle of 16.11 and 17.02 code base). PF to support
API 1.0 while VF
Quoted 8 lines
to support API 1.1/1.02. DPDK PF + Linux VF 1.5.14. PF to support 1.0, while Linux to support 1.1/1.0
Linux PF + DPDK VF has been tested with 1.0 API long time ago. There is some test activities ongoing.
Finally, please give strong reasons to support your NAC.
Quoted 9 lines
I feel bad because I do recognize the strong and hard work that you have done on this PF development, but I feel we need first to assess if DPDK should become a PF or not. I know ixgbe did open the path and that they are some historical DPDK PF supports in Intel NICs, but before we generalize it, we have to make sure we are not turning this DataPlane development Kit into a ControlPlane Driver Kit that we are scared to upstream into Linux kernel. Even if "DPDK is not Linux", it does not mean that Linux should be ignored. In case of DPDK on other OS, same, their PF could be extended too.
Thanks for the recognition of our work on PF driver. :)
Quoted 7 lines
So currently, yes, I do keep a nack't
Since DPDK PF features can be into Linux PF features too and since Linux (and other hypervisors) has already some tools to manage PF (see iproute2, etc.), why should we have an other management path with DPDK?
DPDK is aimed to be a Dataplane Development kit, not a management/control plane driver kit.
Before we debated on Dataplane and ControPlane, can you answer me a question, why we have generic filter API? Is it a API for dataplane?
I can't imagine that we'll have to say 'you need to use Linux PF' driver when users want to deploy PF + VF cases. Why we can't provide an alternative option. they are not exclusive and users can decide which combination is better for them.
The reason why we developed DPDK PF host driver is we have requirements from users. Our motivation is simple, there are requirements, we satisfy them.
Sorry, you NACK can't convince me.
Quoted 16 lines
Assuming you want to use DPDK PF for dataplane feature, that could be OK then, using:
- configure one VF on the hypervisor from Linux's PF, let's name ifVF_forPFtraffic, see http://dpdk.org/doc/guides/howto/flow_bifurcation.html
- have no (or few IO)s to the PF's queue
- assign the traffic to all VF_forPFtraffic's queues of the hypervisor,
- run DPDK into the hypervisor'sVF_forPFtrafficDoing so, we get the same benefit of running DPDK over PF or running DPDK over
VF_forPFtraffic, don't we? It is a benefit of:
http://dpdk.org/doc/guides/howto/flow_bifurcation.htmlThank you,
Vincent
Quoted 69 lines
Vincent,
Sorry, I missed this reply.
Quoted 12 lines · Jing D
Quoted 2 lines
In the meanwhile, we have some test models ongoing to validate combination of Linux and DPDK drivers for VF and PF. We'll fully support
below 4 cases going forward.
Quoted 2 lines
1. DPDK PF + DPDK VF
2. DPDK PF + Linux VF+ DPDK PF + FreeBSD VF
+ DPDK PF + Windows VF
+ DPDK PF + OS xyz VFIf all drivers follow same API spec, what's the problem here? What extra DPDK PF effort you observed?
Quoted 5 lines
Quoted 2 lines
3. Linux PF + DPDK VF
4. Linux PF + Linux VF (it's not our scope)So, you confirm the issue: having DPDK becoming a PF, even if SRIOV protocol includes version-ing, it doubles the combinatory cases.
If extended functions are needed, the answer is yes.
That's not a big problem, right? I have several workarounds/approaches to support extended funcs while following original API spec. I can fix it in this release. In order to have a mature solution, I left it here for further implementation.Quoted 15 lines
Quoted 3 lines
After applied this patch, i've done below test without observing
compatibility issue.
Quoted 1 line
1. DPDK PF + DPDK VF (middle of 16.11 and 17.02 code base). PF to support
API 1.0 while VF
Quoted 8 lines
to support API 1.1/1.02. DPDK PF + Linux VF 1.5.14. PF to support 1.0, while Linux to support 1.1/1.0
Linux PF + DPDK VF has been tested with 1.0 API long time ago. There is some test activities ongoing.
Finally, please give strong reasons to support your NAC.
Quoted 9 lines
I feel bad because I do recognize the strong and hard work that you have done on this PF development, but I feel we need first to assess if DPDK should become a PF or not. I know ixgbe did open the path and that they are some historical DPDK PF supports in Intel NICs, but before we generalize it, we have to make sure we are not turning this DataPlane development Kit into a ControlPlane Driver Kit that we are scared to upstream into Linux kernel. Even if "DPDK is not Linux", it does not mean that Linux should be ignored. In case of DPDK on other OS, same, their PF could be extended too.
Thanks for the recognition of our work on PF driver. :)
Quoted 7 lines
So currently, yes, I do keep a nack't
Since DPDK PF features can be into Linux PF features too and since Linux (and other hypervisors) has already some tools to manage PF (see iproute2, etc.), why should we have an other management path with DPDK?
DPDK is aimed to be a Dataplane Development kit, not a management/control plane driver kit.Before we debated on Dataplane and ControPlane, can you answer me a question, why we have generic filter API? Is it a API for dataplane?
Quoted 24 lines
I can't imagine that we'll have to say 'you need to use Linux PF' driver when users want to deploy PF + VF cases. Why we can't provide an alternative option. they are not exclusive and users can decide which combination is better for them.
The reason why we developed DPDK PF host driver is we have requirements from users. Our motivation is simple, there are requirements, we satisfy them.Sorry, you NACK can't convince me.
Quoted 16 lines
Assuming you want to use DPDK PF for dataplane feature, that could be OK then, using:
- configure one VF on the hypervisor from Linux's PF, let's name ifVF_forPFtraffic, see http://dpdk.org/doc/guides/howto/flow_bifurcation.html
- have no (or few IO)s to the PF's queue
- assign the traffic to all VF_forPFtraffic's queues of the hypervisor,
- run DPDK into the hypervisor'sVF_forPFtrafficDoing so, we get the same benefit of running DPDK over PF or running DPDK over
VF_forPFtraffic, don't we? It is a benefit of:
http://dpdk.org/doc/guides/howto/flow_bifurcation.htmlThank you,
Vincent
With holidays we are a bit late with our thoughts, but would like to toss them into the mix.
The original NAK is understandable, however having the ability to configure the PF via DPDK is advantageous for several reasons:
1) While some functions may be duplicated and/or available from the kernel driver, it is often not possible to introduce new kernel drivers into production without a large amount of additional testing of the entire platform which can cause a significant delay when introducing a DPDK based product. If the PF control is a part of the DPDK environment, then only the application needs to pass the operational testing before deployment; a much more simple task.
2) If the driver changes are upstreamed into the kernel proper, the difficulty of operational readiness testing increases as a new kernel is introduced, and further undermines the ability to quickly and easily release a DPDK based application into production. While the application may eventually fall back on driver and/or kernel support, this could be years away.
3) As DPDK is being used to configure the NIC, it just seems to make sense, for consistency, that the configuration capabilities should include the ability to configure the PF as is proposed.
We are currently supporting/enhancing one such DPDK application to manage PF and VFs of which the VFs are exposed as SR-IOV devices to
guests:
https://github.com/att/vfd/wiki. As new NICs become available the ability to transition to them is important to DPDK users.
Collectively,
Scott Daniels,
Alex Zelezniak,
Kaustubh Joshi
------------------------------------------------------------------------
E. Scott Daniels
Cloud Software Research
AT&T Labs
daniels at research.att.com
Hi Scott,
Quoted 2 lines · Scott Daniels
With holidays we are a bit late with our thoughts, but would like to toss them into the mix.
Same, I hope I am not missing emails. I do appreciate your arguments, it provides lot of light. See below,
Quoted 10 lines
The original NAK is understandable, however having the ability to configure the PF via DPDK is advantageous for several reasons:
1) While some functions may be duplicated and/or available from the kernel driver, it is often not possible to introduce new kernel drivers into production without a large amount of additional testing of the entire platform which can cause a significant delay when introducing a DPDK based product. If the PF control is a part of the DPDK environment, then only the application needs to pass the operational testing before deployment; a much more simple task.
So we agree: you confirm that your foresee the benefits of using DPDK to *bypass the role of the Kernel being the PF* of reference for the hypervisor.
Quoted 6 lines
2) If the driver changes are upstreamed into the kernel proper, the difficulty of operational readiness testing increases as a new kernel is introduced, and further undermines the ability to quickly and easily release a DPDK based application into production. While the application may eventually fall back on driver and/or kernel support, this could be years away.
I do agree with the benefits of the agilities and the upsides it brings. But they are other options to get the same agility without creating a fragmentation of PFs.
For example, you do not have to update the whole kernel, you can just update the PF kernel module that can be upgraded with the latest needed features.
Quoted 3 lines
3) As DPDK is being used to configure the NIC, it just seems to make sense, for consistency, that the configuration capabilities should include the ability to configure the PF as is proposed.
From this perspective, the kernel modules are fine for the PF: most kernels of hypervisors support it without the need to upgrade their kernels.
To summarize, I understand that you need a flexible way to upgrade PF features without touching/changing the kernel. So let's check the kernel module option? VFD brings some interesting capabilities, could it be a way to push and stimulate the i40e features instead of using DPDK?
https://sourceforge.net/projects/e1000/files/i40e%20stable/
for instance could be better stimulated.
Best regards,
Vincent
Hi, Vincent,
Quoted 55 lines
-----Original Message-----
From: Vincent JARDIN [mailto:[email protected]]
Sent: Tuesday, January 10, 2017 9:30 PM
To: Scott Daniels <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Chen, Jing D <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40eHi Scott,
Quoted 2 lines · Scott Daniels
With holidays we are a bit late with our thoughts, but would like to toss them into the mix.
Same, I hope I am not missing emails. I do appreciate your arguments, it provides lot of light. See below,
Quoted 10 lines
The original NAK is understandable, however having the ability to configure the PF via DPDK is advantageous for several reasons:
1) While some functions may be duplicated and/or available from the kernel driver, it is often not possible to introduce new kernel drivers into production without a large amount of additional testing of the entire platform which can cause a significant delay when introducing a DPDK based product. If the PF control is a part of the DPDK environment, then only the application needs to pass the operational testing before deployment; a much more simple task.
So we agree: you confirm that your foresee the benefits of using DPDK to *bypass the role of the Kernel being the PF* of reference for the hypervisor.
Quoted 6 lines
2) If the driver changes are upstreamed into the kernel proper, the difficulty of operational readiness testing increases as a new kernel is introduced, and further undermines the ability to quickly and easily release a DPDK based application into production. While the application may eventually fall back on driver and/or kernel support, this could be years away.
I do agree with the benefits of the agilities and the upsides it brings. But they are other options to get the same agility without creating a fragmentation of PFs.
For example, you do not have to update the whole kernel, you can just update the PF kernel module that can be upgraded with the latest needed features.
Quoted 3 lines
3) As DPDK is being used to configure the NIC, it just seems to make sense, for consistency, that the configuration capabilities should include the ability to configure the PF as is proposed.
From this perspective, the kernel modules are fine for the PF: most
kernels of hypervisors support it without the need to upgrade their kernels.
Quoted 7 lines
To summarize, I understand that you need a flexible way to upgrade PF features without touching/changing the kernel. So let's check the kernel module option? VFD brings some interesting capabilities, could it be a way to push and stimulate the i40e features instead of using DPDK?
https://sourceforge.net/projects/e1000/files/i40e%20stable/for instance could be better stimulated.
May I ask what if DPDK VF need a new extension function from PF? Then, we'll have to build kernel community expertise and submit patch to Linux PF and wait for merge.
Your proposal indicates DPDK community submitters will have to ask Linux community to authorize if we'll have any requirements in DPDK VF.
Comparing fragmentation, the extra dependency worry me most. Can you imagine how long it will be for any VF features gets ready?
Quoted 65 lines · Jing D
Hi, Vincent,
Quoted 62 lines
-----Original Message-----
From: Vincent JARDIN [mailto:[email protected]]
Sent: Tuesday, January 10, 2017 9:30 PM
To: Scott Daniels <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Chen, Jing D <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 00/29] Support VFD and DPDK PF + kernel VF on i40eHi Scott,
Quoted 2 lines · Scott Daniels
With holidays we are a bit late with our thoughts, but would like to toss them into the mix.
Same, I hope I am not missing emails. I do appreciate your arguments, it provides lot of light. See below,
Quoted 10 lines
The original NAK is understandable, however having the ability to configure the PF via DPDK is advantageous for several reasons:
1) While some functions may be duplicated and/or available from the kernel driver, it is often not possible to introduce new kernel drivers into production without a large amount of additional testing of the entire platform which can cause a significant delay when introducing a DPDK based product. If the PF control is a part of the DPDK environment, then only the application needs to pass the operational testing before deployment; a much more simple task.
So we agree: you confirm that your foresee the benefits of using DPDK to *bypass the role of the Kernel being the PF* of reference for the hypervisor.
Quoted 6 lines
2) If the driver changes are upstreamed into the kernel proper, the difficulty of operational readiness testing increases as a new kernel is introduced, and further undermines the ability to quickly and easily release a DPDK based application into production. While the application may eventually fall back on driver and/or kernel support, this could be years away.
I do agree with the benefits of the agilities and the upsides it brings. But they are other options to get the same agility without creating a fragmentation of PFs.
For example, you do not have to update the whole kernel, you can just update the PF kernel module that can be upgraded with the latest needed features.
Quoted 3 lines
3) As DPDK is being used to configure the NIC, it just seems to make sense, for consistency, that the configuration capabilities should include the ability to configure the PF as is proposed.
From this perspective, the kernel modules are fine for the PF: most
kernels of hypervisors support it without the need to upgrade their kernels.To summarize, I understand that you need a flexible way to upgrade PF features without touching/changing the kernel. So let's check the kernel module option? VFD brings some interesting capabilities, could it be a way to push and stimulate the i40e features instead of using DPDK?
https://sourceforge.net/projects/e1000/files/i40e%20stable/for instance could be better stimulated.
I figured I would weight in with my $0.02.
Quoted 3 lines
May I ask what if DPDK VF need a new extension function from PF? Then, we'll have to build kernel community expertise and submit patch to Linux PF and wait for merge.
Correct, but it is the same story on DPDK repository as well. Either way patch must be generated, tested, submitted and wait until it is merged. At this point I think even the code is very similar sans style and naming conventions for these types of features.
Quoted 3 lines
Your proposal indicates DPDK community submitters will have to ask Linux community to authorize if we'll have any requirements in DPDK VF.
I don't think this is really much of a problem in most cases the same company maintains both DPDK and Linux kernel drivers so hopefully everyone is aligned.
Quoted 5 lines
Comparing fragmentation, the extra dependency worry me most. Can you imagine how long it will be for any VF features gets ready?
The Linux kernel releases every 6-8 weeks roughly depending on the release. In networking stack land features must be submitted for that kernel release before the first RC release.
So although there may be benefits to pushing these features into DPDK vs Linux kernel I don't think actually getting the code in the kernel is one of them.
To the point above about out of tree drivers. Most vendors do keep out of tree drivers with the latest features and fixes that can be supported on older kernels. Unfortunately, many of the interfaces like the type mentioned here would require kernel updates outside the drivers to add message handlers and driver callbacks for the new config messages. So it may not be viable at least unless we restructure some of the kernel to use out of tree drivers in the short term.
So I'm sympathetic to argument (1) here. If _not_ updating the kernel is a hard requirement then we are a bit stuck from using existing/future Linux features. Further this is sort of a rolling problem as well. Today we are missing feature X and we add it and tomorrow we are missing a new feature Y. So if the feature list is not stable with deployment of new kernels its a bit hard to see how the Linux kernel PF model works without above mentioned restructuring. FWIW traditionally the Linux vendors handled this backporting for its customers and provide kernel updates using apt-get/dnf/whatever along with all the sanity testing to ensure they didn't break something along the way. We are slowly getting over this with work in BPF and other subsystems but the VF configuration is still very much hard coded for the moment. I might try to fix this though as a result of this thread.
Open question for me on this though is the PF in these SRIOV cases ever being used by DPDK datapath or is it just being leveraged for configuration with primarily control traffic?
So my take away from this is arguments about its not available in Linux kernel are not really good ones because its easy enough to add and get in stable kernels. But if kernel updates are a challenge then we either need a more robust kernel backporting and out of tree driver effort _or_ push them directly into PF driver of DPDK. I think longterm we can fix this in the kernel with some restructuring and better module updates but in the short term DPDK PMD updates seem to be the only option.
I do think though if this gets pushed into DPDK PMD we shouldn't let the PF Linux driver simply not support the new mailbox messages. This will create one more dependency then I care to worry about. VF<->PF mailbox should work with any combination of VF and PF as long as version requirements are met. I think vendor maintainers can manage this.
I'll comment on the specific features in another email because it is helpful to have a list in public mailing list with features folks are interested in. Any chance we could get a page up with a list of all these and where/when we expect support for them?
Thanks,
John
John,
Thanks for comments. To answer a specific question you raised:
Quoted 3 lines
Open question for me on this though is the PF in these SRIOV cases ever being used by DPDK datapath or is it just being leveraged for configuration with primarily control traffic?
In our case, the answer is yes. We intend to use the PF through DPDK to house a high speed packet mirror function for capturing packet traces from VFs (for ops etc).
However, in theory, this *can* be done through an extra VF as well, so I didn't bring up that particular point as being a deciding factor in this debate.
Quoted 5 lines · John Fastabend
Open question for me on this though is the PF in these SRIOV cases ever being used by DPDK datapath or is it just being leveraged for configuration with primarily control traffic?
Thanks John for the kernel support. I'd like to add one thought on this need from Joshi:
Quoted 1 line
Also, the kernel drivers have no concept of passing VF messages to upstream "decision making” (or policy enforcement) software like VFd.
It shall be possible to define some Netlink or policy management messages over the PF, so a userland process can police and provide the "decision making" in a standard way that would be generic.
Joshi,
John is confirming that the kernel path is possible. Please, if you see other requirements, keep listing them.
Quoted 1 line · KAUSTUBH (KAUSTUBH)
However, in theory, this *can* be done through an extra VF as well, so I didn't bring up that particular point as being a deciding factor in this debate.
It remains an important item: it shows that thru the kernel, all technical requirements are manageable, including the steering of traffic.
I'll continue the comments on the patch on the v9's thread.
http://dpdk.org/ml/archives/dev/2017-January/054953.html
Best regards,
Vincent
2017-01-13 15:04, John Fastabend:
Quoted 4 lines
I'll comment on the specific features in another email because it is helpful to have a list in public mailing list with features folks are interested in. Any chance we could get a page up with a list of all these and where/when we expect support for them?
There could be a support matrix of features with each driver (DPDK and Linux) in this doc:
http://dpdk.org/doc/guides/nics/intel_vf.html
Quoted 11 lines · KAUSTUBH (KAUSTUBH)
John,
Thanks for comments. To answer a specific question you raised:
Quoted 3 lines
Open question for me on this though is the PF in these SRIOV cases ever being used by DPDK datapath or is it just being leveraged for configuration with primarily control traffic?
In our case, the answer is yes. We intend to use the PF through DPDK to house a high speed packet mirror function for capturing packet traces from VFs (for ops etc).
However, in theory, this *can* be done through an extra VF as well, so I didn't bring up that particular point as being a deciding factor in this debate.
Is it valid use case to run DPDK enabled virtual switch on PF? I believe this is something you can't move to an extra VF?
Quoted 6 lines
Quoted 6 lines · John Fastabend
Open question for me on this though is the PF in these SRIOV cases ever being used by DPDK datapath or is it just being leveraged for configuration with primarily control traffic?