[dpdk-dev] [PATCH v1 0/3] Fix PF reset causes VF memory request failure
By triggerring the VF reset from PF reset, echo 1 > /sys/bus/pci/devices/PF-BDF/reset the PCI bus master bit will cleared on VF, so the VF needs to enable this bit before restart. This patch set adds the API to enable PCI bus master. Haiyue Wang (3): bus/pci: enable PCI master in command register net/iavf: enable PCI bus master after reset net/i40e: enable PCI bus master after reset drivers/bus/pci/pci_common.c | 20 drivers/bus/pci/rte_bus_pci.h | 12 drivers/bus/pci/version.map | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 7 ++- drivers/net/iavf/iavf_ethdev.c| 3 +++ lib/librte_pci/rte_pci.h | 4 6 files changed, 46 insertions(+), 1 deletion(-) -- 2.31.1
[dpdk-dev] [PATCH v1 1/3] bus/pci: enable PCI master in command register
This adds the support to set 'Bus Master Enable' bit in the PCI command register. Signed-off-by: Haiyue Wang --- drivers/bus/pci/pci_common.c | 20 drivers/bus/pci/rte_bus_pci.h | 12 drivers/bus/pci/version.map | 1 + lib/librte_pci/rte_pci.h | 4 4 files changed, 37 insertions(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index ee7f966358..b631cb9c7e 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -746,6 +746,26 @@ rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap) return 0; } +int +rte_pci_enable_bus_master(struct rte_pci_device *dev) +{ + uint16_t cmd; + + if (rte_pci_read_config(dev, &cmd, sizeof(cmd), RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in reading PCI command register\n"); + return -1; + } + + cmd |= RTE_PCI_COMMAND_MASTER; + + if (rte_pci_write_config(dev, &cmd, sizeof(cmd), RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in writing PCI command register\n"); + return -1; + } + + return 0; +} + struct rte_pci_bus rte_pci_bus = { .bus = { .scan = rte_pci_scan, diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 64886b4731..83caf477ba 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -249,6 +249,18 @@ void rte_pci_dump(FILE *f); __rte_experimental off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap); +/** + * Enables Bus Master for device's PCI command register. + * + * @param dev + *A pointer to rte_pci_device structure. + * + * @return + * 0 on success, -1 on error in PCI config space read/write. + */ +__rte_experimental +int rte_pci_enable_bus_master(struct rte_pci_device *dev); + /** * Register a PCI driver. * diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map index f33ed0abd1..b271e48a8f 100644 --- a/drivers/bus/pci/version.map +++ b/drivers/bus/pci/version.map @@ -20,5 +20,6 @@ DPDK_21 { EXPERIMENTAL { global: + rte_pci_enable_bus_master; rte_pci_find_ext_capability; }; diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h index a8f8e404a9..1f33d687f4 100644 --- a/lib/librte_pci/rte_pci.h +++ b/lib/librte_pci/rte_pci.h @@ -32,6 +32,10 @@ extern "C" { #define RTE_PCI_VENDOR_ID 0x00/* 16 bits */ #define RTE_PCI_DEVICE_ID 0x02/* 16 bits */ +#define RTE_PCI_COMMAND0x04/* 16 bits */ + +/* PCI Command Register */ +#define RTE_PCI_COMMAND_MASTER 0x4 /* Bus Master Enable */ /* PCI Express capability registers */ #define RTE_PCI_EXP_DEVCTL 8 /* Device Control */ -- 2.31.1
[dpdk-dev] [PATCH v1 2/3] net/iavf: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_ethdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d523a0618c..8c924d21b2 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2255,6 +2255,9 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_free(vf->aq_resp); vf->aq_resp = NULL; + if (vf->vf_reset) + rte_pci_enable_bus_master(pci_dev); + vf->vf_reset = false; return ret; -- 2.31.1
[dpdk-dev] [PATCH v1 3/3] net/i40e: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And align the VF reset event handling in device close module as the AVF driver does. Signed-off-by: Haiyue Wang --- drivers/net/i40e/i40e_ethdev_vf.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 3c258ba7cf..4f1d04eb2b 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1212,7 +1212,6 @@ i40evf_check_vf_reset_done(struct rte_eth_dev *dev) if (i >= MAX_RESET_WAIT_CNT) return -1; - vf->vf_reset = false; vf->pend_msg &= ~PFMSG_RESET_IMPENDING; return 0; @@ -1391,6 +1390,7 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg, switch (pf_msg->event) { case VIRTCHNL_EVENT_RESET_IMPENDING: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event"); + vf->vf_reset = true; rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); break; @@ -2487,6 +2487,11 @@ i40evf_dev_close(struct rte_eth_dev *dev) i40e_shutdown_adminq(hw); i40evf_disable_irq0(hw); + if (vf->vf_reset) + rte_pci_enable_bus_master(RTE_ETH_DEV_TO_PCI(dev)); + + vf->vf_reset = false; + rte_free(vf->vf_res); vf->vf_res = NULL; rte_free(vf->aq_resp); -- 2.31.1
[dpdk-dev] [PATCH v2 0/3] fix PF reset causes VF memory request failure
By triggerring the VF reset from PF reset, echo 1 > /sys/bus/pci/devices/PF-BDF/reset the PCI bus master bit will cleared on VF, so the VF needs to enable this bit before restart. This patch set adds the API to enable PCI bus master. v2: rebase to new librte directory path. Haiyue Wang (3): bus/pci: enable PCI master in command register net/iavf: enable PCI bus master after reset net/i40e: enable PCI bus master after reset drivers/bus/pci/pci_common.c | 20 drivers/bus/pci/rte_bus_pci.h | 12 drivers/bus/pci/version.map | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 7 ++- drivers/net/iavf/iavf_ethdev.c| 3 +++ lib/pci/rte_pci.h | 4 6 files changed, 46 insertions(+), 1 deletion(-) -- 2.31.1
[dpdk-dev] [PATCH v2 1/3] bus/pci: enable PCI master in command register
This adds the support to set 'Bus Master Enable' bit in the PCI command register. Signed-off-by: Haiyue Wang Tested-by: Qi Zhang --- drivers/bus/pci/pci_common.c | 20 drivers/bus/pci/rte_bus_pci.h | 12 drivers/bus/pci/version.map | 1 + lib/pci/rte_pci.h | 4 4 files changed, 37 insertions(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index ee7f96635..b631cb9c7 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -746,6 +746,26 @@ rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap) return 0; } +int +rte_pci_enable_bus_master(struct rte_pci_device *dev) +{ + uint16_t cmd; + + if (rte_pci_read_config(dev, &cmd, sizeof(cmd), RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in reading PCI command register\n"); + return -1; + } + + cmd |= RTE_PCI_COMMAND_MASTER; + + if (rte_pci_write_config(dev, &cmd, sizeof(cmd), RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in writing PCI command register\n"); + return -1; + } + + return 0; +} + struct rte_pci_bus rte_pci_bus = { .bus = { .scan = rte_pci_scan, diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 64886b473..83caf477b 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -249,6 +249,18 @@ void rte_pci_dump(FILE *f); __rte_experimental off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap); +/** + * Enables Bus Master for device's PCI command register. + * + * @param dev + *A pointer to rte_pci_device structure. + * + * @return + * 0 on success, -1 on error in PCI config space read/write. + */ +__rte_experimental +int rte_pci_enable_bus_master(struct rte_pci_device *dev); + /** * Register a PCI driver. * diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map index f33ed0abd..b271e48a8 100644 --- a/drivers/bus/pci/version.map +++ b/drivers/bus/pci/version.map @@ -20,5 +20,6 @@ DPDK_21 { EXPERIMENTAL { global: + rte_pci_enable_bus_master; rte_pci_find_ext_capability; }; diff --git a/lib/pci/rte_pci.h b/lib/pci/rte_pci.h index a8f8e404a..1f33d687f 100644 --- a/lib/pci/rte_pci.h +++ b/lib/pci/rte_pci.h @@ -32,6 +32,10 @@ extern "C" { #define RTE_PCI_VENDOR_ID 0x00/* 16 bits */ #define RTE_PCI_DEVICE_ID 0x02/* 16 bits */ +#define RTE_PCI_COMMAND0x04/* 16 bits */ + +/* PCI Command Register */ +#define RTE_PCI_COMMAND_MASTER 0x4 /* Bus Master Enable */ /* PCI Express capability registers */ #define RTE_PCI_EXP_DEVCTL 8 /* Device Control */ -- 2.31.1
[dpdk-dev] [PATCH v2 2/3] net/iavf: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. Signed-off-by: Haiyue Wang Tested-by: Qi Zhang --- drivers/net/iavf/iavf_ethdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d523a0618..8c924d21b 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2255,6 +2255,9 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_free(vf->aq_resp); vf->aq_resp = NULL; + if (vf->vf_reset) + rte_pci_enable_bus_master(pci_dev); + vf->vf_reset = false; return ret; -- 2.31.1
[dpdk-dev] [PATCH v2 3/3] net/i40e: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And align the VF reset event handling in device close module as the AVF driver does. Signed-off-by: Haiyue Wang Tested-by: Qi Zhang --- drivers/net/i40e/i40e_ethdev_vf.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 3c258ba7c..4f1d04eb2 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1212,7 +1212,6 @@ i40evf_check_vf_reset_done(struct rte_eth_dev *dev) if (i >= MAX_RESET_WAIT_CNT) return -1; - vf->vf_reset = false; vf->pend_msg &= ~PFMSG_RESET_IMPENDING; return 0; @@ -1391,6 +1390,7 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg, switch (pf_msg->event) { case VIRTCHNL_EVENT_RESET_IMPENDING: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event"); + vf->vf_reset = true; rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); break; @@ -2487,6 +2487,11 @@ i40evf_dev_close(struct rte_eth_dev *dev) i40e_shutdown_adminq(hw); i40evf_disable_irq0(hw); + if (vf->vf_reset) + rte_pci_enable_bus_master(RTE_ETH_DEV_TO_PCI(dev)); + + vf->vf_reset = false; + rte_free(vf->vf_res); vf->vf_res = NULL; rte_free(vf->aq_resp); -- 2.31.1
[dpdk-dev] [PATCH v3 0/3] fix PF reset causes VF memory request failure
By triggerring the VF reset from PF reset, echo 1 > /sys/bus/pci/devices/PF-BDF/reset the PCI bus master bit will cleared on VF, so the VF needs to enable this bit before restart. This patch set adds the API to enable PCI bus master. v3: added the missed annotate symbol add time v2: rebase to new librte directory path. Haiyue Wang (3): bus/pci: enable PCI master in command register net/iavf: enable PCI bus master after reset net/i40e: enable PCI bus master after reset drivers/bus/pci/pci_common.c | 20 drivers/bus/pci/rte_bus_pci.h | 12 drivers/bus/pci/version.map | 3 +++ drivers/net/i40e/i40e_ethdev_vf.c | 7 ++- drivers/net/iavf/iavf_ethdev.c| 3 +++ lib/pci/rte_pci.h | 4 6 files changed, 48 insertions(+), 1 deletion(-) -- 2.31.1
[dpdk-dev] [PATCH v3 3/3] net/i40e: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And align the VF reset event handling in device close module as the AVF driver does. Signed-off-by: Haiyue Wang Tested-by: Qi Zhang --- drivers/net/i40e/i40e_ethdev_vf.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 3c258ba7c..4f1d04eb2 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1212,7 +1212,6 @@ i40evf_check_vf_reset_done(struct rte_eth_dev *dev) if (i >= MAX_RESET_WAIT_CNT) return -1; - vf->vf_reset = false; vf->pend_msg &= ~PFMSG_RESET_IMPENDING; return 0; @@ -1391,6 +1390,7 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg, switch (pf_msg->event) { case VIRTCHNL_EVENT_RESET_IMPENDING: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event"); + vf->vf_reset = true; rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); break; @@ -2487,6 +2487,11 @@ i40evf_dev_close(struct rte_eth_dev *dev) i40e_shutdown_adminq(hw); i40evf_disable_irq0(hw); + if (vf->vf_reset) + rte_pci_enable_bus_master(RTE_ETH_DEV_TO_PCI(dev)); + + vf->vf_reset = false; + rte_free(vf->vf_res); vf->vf_res = NULL; rte_free(vf->aq_resp); -- 2.31.1
[dpdk-dev] [PATCH v3 2/3] net/iavf: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. Signed-off-by: Haiyue Wang Tested-by: Qi Zhang --- drivers/net/iavf/iavf_ethdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d523a0618..8c924d21b 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2255,6 +2255,9 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_free(vf->aq_resp); vf->aq_resp = NULL; + if (vf->vf_reset) + rte_pci_enable_bus_master(pci_dev); + vf->vf_reset = false; return ret; -- 2.31.1
[dpdk-dev] [PATCH v3 1/3] bus/pci: enable PCI master in command register
This adds the support to set 'Bus Master Enable' bit in the PCI command register. Signed-off-by: Haiyue Wang Tested-by: Qi Zhang --- drivers/bus/pci/pci_common.c | 20 drivers/bus/pci/rte_bus_pci.h | 12 drivers/bus/pci/version.map | 3 +++ lib/pci/rte_pci.h | 4 4 files changed, 39 insertions(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index ee7f96635..b631cb9c7 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -746,6 +746,26 @@ rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap) return 0; } +int +rte_pci_enable_bus_master(struct rte_pci_device *dev) +{ + uint16_t cmd; + + if (rte_pci_read_config(dev, &cmd, sizeof(cmd), RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in reading PCI command register\n"); + return -1; + } + + cmd |= RTE_PCI_COMMAND_MASTER; + + if (rte_pci_write_config(dev, &cmd, sizeof(cmd), RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in writing PCI command register\n"); + return -1; + } + + return 0; +} + struct rte_pci_bus rte_pci_bus = { .bus = { .scan = rte_pci_scan, diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 64886b473..83caf477b 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -249,6 +249,18 @@ void rte_pci_dump(FILE *f); __rte_experimental off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap); +/** + * Enables Bus Master for device's PCI command register. + * + * @param dev + *A pointer to rte_pci_device structure. + * + * @return + * 0 on success, -1 on error in PCI config space read/write. + */ +__rte_experimental +int rte_pci_enable_bus_master(struct rte_pci_device *dev); + /** * Register a PCI driver. * diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map index f33ed0abd..9dbec12a0 100644 --- a/drivers/bus/pci/version.map +++ b/drivers/bus/pci/version.map @@ -21,4 +21,7 @@ EXPERIMENTAL { global: rte_pci_find_ext_capability; + + # added in 21.05 + rte_pci_enable_bus_master; }; diff --git a/lib/pci/rte_pci.h b/lib/pci/rte_pci.h index a8f8e404a..1f33d687f 100644 --- a/lib/pci/rte_pci.h +++ b/lib/pci/rte_pci.h @@ -32,6 +32,10 @@ extern "C" { #define RTE_PCI_VENDOR_ID 0x00/* 16 bits */ #define RTE_PCI_DEVICE_ID 0x02/* 16 bits */ +#define RTE_PCI_COMMAND0x04/* 16 bits */ + +/* PCI Command Register */ +#define RTE_PCI_COMMAND_MASTER 0x4 /* Bus Master Enable */ /* PCI Express capability registers */ #define RTE_PCI_EXP_DEVCTL 8 /* Device Control */ -- 2.31.1
[dpdk-dev] [PATCH v4 0/3] fix PF reset causes VF memory request failure
By triggerring the VF reset from PF reset, echo 1 > /sys/bus/pci/devices/PF-BDF/reset the PCI bus master bit will cleared on VF, so the VF needs to enable this bit before restart. This patch set adds the API to enable PCI bus master. v4: change the API to set type, so can enable or disable v3: added the missed annotate symbol add time v2: rebase to new librte directory path. Haiyue Wang (3): bus/pci: set PCI master in command register net/iavf: enable PCI bus master after reset net/i40e: enable PCI bus master after reset drivers/bus/pci/pci_common.c | 28 drivers/bus/pci/rte_bus_pci.h | 14 ++ drivers/bus/pci/version.map | 3 +++ drivers/net/i40e/i40e_ethdev_vf.c | 7 ++- drivers/net/iavf/iavf_ethdev.c| 3 +++ lib/pci/rte_pci.h | 4 6 files changed, 58 insertions(+), 1 deletion(-) -- 2.31.1
[dpdk-dev] [PATCH v4 1/3] bus/pci: set PCI master in command register
Add the API to set 'Bus Master Enable' bit to be enabled or disabled in the PCI command register. Signed-off-by: Haiyue Wang --- drivers/bus/pci/pci_common.c | 28 drivers/bus/pci/rte_bus_pci.h | 14 ++ drivers/bus/pci/version.map | 3 +++ lib/pci/rte_pci.h | 4 4 files changed, 49 insertions(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index ee7f96635..35d7d092d 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -746,6 +746,34 @@ rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap) return 0; } +int +rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable) +{ + uint16_t old_cmd, cmd; + + if (rte_pci_read_config(dev, &old_cmd, sizeof(old_cmd), + RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in reading PCI command register\n"); + return -1; + } + + if (enable) + cmd = old_cmd | RTE_PCI_COMMAND_MASTER; + else + cmd = old_cmd & ~RTE_PCI_COMMAND_MASTER; + + if (cmd == old_cmd) + return 0; + + if (rte_pci_write_config(dev, &cmd, sizeof(cmd), +RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in writing PCI command register\n"); + return -1; + } + + return 0; +} + struct rte_pci_bus rte_pci_bus = { .bus = { .scan = rte_pci_scan, diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 64886b473..976c33c92 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -249,6 +249,20 @@ void rte_pci_dump(FILE *f); __rte_experimental off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap); +/** + * Enables/Disables Bus Master for device's PCI command register. + * + * @param dev + *A pointer to rte_pci_device structure. + * @param enable + *Enable or disable Bus Master. + * + * @return + * 0 on success, -1 on error in PCI config space read/write. + */ +__rte_experimental +int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable); + /** * Register a PCI driver. * diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map index f33ed0abd..c6e5f797c 100644 --- a/drivers/bus/pci/version.map +++ b/drivers/bus/pci/version.map @@ -21,4 +21,7 @@ EXPERIMENTAL { global: rte_pci_find_ext_capability; + + # added in 21.05 + rte_pci_set_bus_master; }; diff --git a/lib/pci/rte_pci.h b/lib/pci/rte_pci.h index a8f8e404a..1f33d687f 100644 --- a/lib/pci/rte_pci.h +++ b/lib/pci/rte_pci.h @@ -32,6 +32,10 @@ extern "C" { #define RTE_PCI_VENDOR_ID 0x00/* 16 bits */ #define RTE_PCI_DEVICE_ID 0x02/* 16 bits */ +#define RTE_PCI_COMMAND0x04/* 16 bits */ + +/* PCI Command Register */ +#define RTE_PCI_COMMAND_MASTER 0x4 /* Bus Master Enable */ /* PCI Express capability registers */ #define RTE_PCI_EXP_DEVCTL 8 /* Device Control */ -- 2.31.1
[dpdk-dev] [PATCH v4 2/3] net/iavf: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_ethdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d523a0618..9a0a20a29 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2255,6 +2255,9 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_free(vf->aq_resp); vf->aq_resp = NULL; + if (vf->vf_reset) + rte_pci_set_bus_master(pci_dev, true); + vf->vf_reset = false; return ret; -- 2.31.1
[dpdk-dev] [PATCH v4 3/3] net/i40e: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And align the VF reset event handling in device close module as the AVF driver does. Signed-off-by: Haiyue Wang --- drivers/net/i40e/i40e_ethdev_vf.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 3c258ba7c..8b041e94c 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1212,7 +1212,6 @@ i40evf_check_vf_reset_done(struct rte_eth_dev *dev) if (i >= MAX_RESET_WAIT_CNT) return -1; - vf->vf_reset = false; vf->pend_msg &= ~PFMSG_RESET_IMPENDING; return 0; @@ -1391,6 +1390,7 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg, switch (pf_msg->event) { case VIRTCHNL_EVENT_RESET_IMPENDING: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event"); + vf->vf_reset = true; rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); break; @@ -2487,6 +2487,11 @@ i40evf_dev_close(struct rte_eth_dev *dev) i40e_shutdown_adminq(hw); i40evf_disable_irq0(hw); + if (vf->vf_reset) + rte_pci_set_bus_master(RTE_ETH_DEV_TO_PCI(dev), true); + + vf->vf_reset = false; + rte_free(vf->vf_res); vf->vf_res = NULL; rte_free(vf->aq_resp); -- 2.31.1
[dpdk-dev] [PATCH v5 0/3] fix PF reset causes VF memory request failure
By triggerring the VF reset from PF reset, echo 1 > /sys/bus/pci/devices/PF-BDF/reset the PCI bus master bit will cleared on VF, so the VF needs to enable this bit before restart. This patch set adds the API to enable PCI bus master. v5: error handling if bus master enable failed v4: change the API to set type, so can enable or disable v3: added the missed annotate symbol add time v2: rebase to new librte directory path Haiyue Wang (3): bus/pci: set PCI master in command register net/iavf: enable PCI bus master after reset net/i40e: enable PCI bus master after reset drivers/bus/pci/pci_common.c | 28 drivers/bus/pci/rte_bus_pci.h | 14 ++ drivers/bus/pci/version.map | 3 +++ drivers/net/i40e/i40e_ethdev_vf.c | 6 +- drivers/net/iavf/iavf_ethdev.c| 3 ++- lib/pci/rte_pci.h | 4 6 files changed, 56 insertions(+), 2 deletions(-) -- 2.31.1
[dpdk-dev] [PATCH v5 1/3] bus/pci: set PCI master in command register
Add the API to set 'Bus Master Enable' bit to be enabled or disabled in the PCI command register. Signed-off-by: Haiyue Wang Acked-by: Ray Kinsella --- drivers/bus/pci/pci_common.c | 28 drivers/bus/pci/rte_bus_pci.h | 14 ++ drivers/bus/pci/version.map | 3 +++ lib/pci/rte_pci.h | 4 4 files changed, 49 insertions(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index ee7f96635..35d7d092d 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -746,6 +746,34 @@ rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap) return 0; } +int +rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable) +{ + uint16_t old_cmd, cmd; + + if (rte_pci_read_config(dev, &old_cmd, sizeof(old_cmd), + RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in reading PCI command register\n"); + return -1; + } + + if (enable) + cmd = old_cmd | RTE_PCI_COMMAND_MASTER; + else + cmd = old_cmd & ~RTE_PCI_COMMAND_MASTER; + + if (cmd == old_cmd) + return 0; + + if (rte_pci_write_config(dev, &cmd, sizeof(cmd), +RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in writing PCI command register\n"); + return -1; + } + + return 0; +} + struct rte_pci_bus rte_pci_bus = { .bus = { .scan = rte_pci_scan, diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 64886b473..976c33c92 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -249,6 +249,20 @@ void rte_pci_dump(FILE *f); __rte_experimental off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap); +/** + * Enables/Disables Bus Master for device's PCI command register. + * + * @param dev + *A pointer to rte_pci_device structure. + * @param enable + *Enable or disable Bus Master. + * + * @return + * 0 on success, -1 on error in PCI config space read/write. + */ +__rte_experimental +int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable); + /** * Register a PCI driver. * diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map index f33ed0abd..c6e5f797c 100644 --- a/drivers/bus/pci/version.map +++ b/drivers/bus/pci/version.map @@ -21,4 +21,7 @@ EXPERIMENTAL { global: rte_pci_find_ext_capability; + + # added in 21.05 + rte_pci_set_bus_master; }; diff --git a/lib/pci/rte_pci.h b/lib/pci/rte_pci.h index a8f8e404a..1f33d687f 100644 --- a/lib/pci/rte_pci.h +++ b/lib/pci/rte_pci.h @@ -32,6 +32,10 @@ extern "C" { #define RTE_PCI_VENDOR_ID 0x00/* 16 bits */ #define RTE_PCI_DEVICE_ID 0x02/* 16 bits */ +#define RTE_PCI_COMMAND0x04/* 16 bits */ + +/* PCI Command Register */ +#define RTE_PCI_COMMAND_MASTER 0x4 /* Bus Master Enable */ /* PCI Express capability registers */ #define RTE_PCI_EXP_DEVCTL 8 /* Device Control */ -- 2.31.1
[dpdk-dev] [PATCH v5 2/3] net/iavf: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And if failed, the device or system may be in an invalid state, so keep the VF reset state to mark it as I/O error. Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_ethdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index c06873d26..0084a083b 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2356,7 +2356,8 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_free(vf->aq_resp); vf->aq_resp = NULL; - vf->vf_reset = false; + if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true)) + vf->vf_reset = false; return ret; } -- 2.31.1
[dpdk-dev] [PATCH v5 3/3] net/i40e: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And if failed, the device or system may be in an invalid state, so keep the VF reset state to mark it as I/O error. Signed-off-by: Haiyue Wang --- drivers/net/i40e/i40e_ethdev_vf.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index cb898bdb6..bded64842 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1213,7 +1213,6 @@ i40evf_check_vf_reset_done(struct rte_eth_dev *dev) if (i >= MAX_RESET_WAIT_CNT) return -1; - vf->vf_reset = false; vf->pend_msg &= ~PFMSG_RESET_IMPENDING; return 0; @@ -1392,6 +1391,7 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg, switch (pf_msg->event) { case VIRTCHNL_EVENT_RESET_IMPENDING: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event"); + vf->vf_reset = true; rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); break; @@ -2490,6 +2490,10 @@ i40evf_dev_close(struct rte_eth_dev *dev) i40e_shutdown_adminq(hw); i40evf_disable_irq0(hw); + if (vf->vf_reset && + !rte_pci_set_bus_master(RTE_ETH_DEV_TO_PCI(dev), true)) + vf->vf_reset = false; + rte_free(vf->vf_res); vf->vf_res = NULL; rte_free(vf->aq_resp); -- 2.31.1
[dpdk-dev] [PATCH v1] net/ice: enable to set HW debug mask
The HW debug mask is always zero, so user can't enable the related debug function like ICE_DBG_XXX etc. Add the devarg 'hw_debug_mask' to set the function like for ICE_DBG_NVM: -a :88:00.0,hw_debug_mask=0x80 --log-level=pmd.net.ice.driver:8 Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_ethdev.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 09e38590e5..5a18663430 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -26,11 +26,13 @@ #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" #define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support" #define ICE_PROTO_XTR_ARG "proto_xtr" +#define ICE_HW_DEBUG_MASK_ARG "hw_debug_mask" static const char * const ice_valid_args[] = { ICE_SAFE_MODE_SUPPORT_ARG, ICE_PIPELINE_MODE_SUPPORT_ARG, ICE_PROTO_XTR_ARG, + ICE_HW_DEBUG_MASK_ARG, NULL }; @@ -1836,6 +1838,25 @@ parse_bool(const char *key, const char *value, void *args) return 0; } +static int +parse_u64(const char *key, const char *value, void *args) +{ + u64 *num = (u64 *)args; + u64 tmp; + + errno = 0; + tmp = strtoull(value, NULL, 16); + if (errno) { + PMD_DRV_LOG(WARNING, "%s: \"%s\" is not a valid u64", + key, value); + return -1; + } + + *num = tmp; + + return 0; +} + static int ice_parse_devargs(struct rte_eth_dev *dev) { struct ice_adapter *ad = @@ -1872,6 +1893,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev) if (ret) goto bail; + ret = rte_kvargs_process(kvlist, ICE_HW_DEBUG_MASK_ARG, +&parse_u64, &ad->hw.debug_mask); + if (ret) + goto bail; + bail: rte_kvargs_free(kvlist); return ret; @@ -5306,6 +5332,7 @@ RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map); RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_PMD_REGISTER_PARAM_STRING(net_ice, + ICE_HW_DEBUG_MASK_ARG "=0xXXX" ICE_PROTO_XTR_ARG "=[queue:]" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>"); -- 2.32.0
[dpdk-dev] [PATCH v2] net/ice: enable to set HW debug mask
The HW debug mask is always zero, so user can't enable the related debug function like ICE_DBG_XXX etc, add the devarg 'hw_debug_mask' to set the debug mask log output at runtime. Signed-off-by: Haiyue Wang --- v2: Add the doc in ice.rst --- doc/guides/nics/ice.rst | 8 drivers/net/ice/ice_ethdev.c | 27 +++ 2 files changed, 35 insertions(+) diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index b691008add..22a19b8bba 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -209,6 +209,14 @@ Runtime Config Options The ``rte_net_ice_dump_proto_xtr_metadata`` routine shows how to access the protocol extraction result in ``struct rte_mbuf``. +- ``Hardware debug mask log support`` (default ``0``) + + User can enable the related hardware debug mask such as ICE_DBG_NVM:: + +-a :88:00.0,hw_debug_mask=0x80 --log-level=pmd.net.ice.driver:8 + + These ICE_DBG_XXX are defined in ``drivers/net/ice/base/ice_type.h``. + Driver compilation and testing -- diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 09e38590e5..5a18663430 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -26,11 +26,13 @@ #define ICE_SAFE_MODE_SUPPORT_ARG "safe-mode-support" #define ICE_PIPELINE_MODE_SUPPORT_ARG "pipeline-mode-support" #define ICE_PROTO_XTR_ARG "proto_xtr" +#define ICE_HW_DEBUG_MASK_ARG "hw_debug_mask" static const char * const ice_valid_args[] = { ICE_SAFE_MODE_SUPPORT_ARG, ICE_PIPELINE_MODE_SUPPORT_ARG, ICE_PROTO_XTR_ARG, + ICE_HW_DEBUG_MASK_ARG, NULL }; @@ -1836,6 +1838,25 @@ parse_bool(const char *key, const char *value, void *args) return 0; } +static int +parse_u64(const char *key, const char *value, void *args) +{ + u64 *num = (u64 *)args; + u64 tmp; + + errno = 0; + tmp = strtoull(value, NULL, 16); + if (errno) { + PMD_DRV_LOG(WARNING, "%s: \"%s\" is not a valid u64", + key, value); + return -1; + } + + *num = tmp; + + return 0; +} + static int ice_parse_devargs(struct rte_eth_dev *dev) { struct ice_adapter *ad = @@ -1872,6 +1893,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev) if (ret) goto bail; + ret = rte_kvargs_process(kvlist, ICE_HW_DEBUG_MASK_ARG, +&parse_u64, &ad->hw.debug_mask); + if (ret) + goto bail; + bail: rte_kvargs_free(kvlist); return ret; @@ -5306,6 +5332,7 @@ RTE_PMD_REGISTER_PCI(net_ice, rte_ice_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_ice, pci_id_ice_map); RTE_PMD_REGISTER_KMOD_DEP(net_ice, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_PMD_REGISTER_PARAM_STRING(net_ice, + ICE_HW_DEBUG_MASK_ARG "=0xXXX" ICE_PROTO_XTR_ARG "=[queue:]" ICE_SAFE_MODE_SUPPORT_ARG "=<0|1>" ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>"); -- 2.32.0
[dpdk-dev] [PATCH v1] net/ixgbe: fix Rx errors statistics for UDP checksum
Restrict the "remove l3_l4_xsum_errors from rx_errors" to 82599 only for hardware errata. Fixes: 256ff05a9cae ("ixgbe: fix Rx errors statistics for UDP checksum") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4ee709b17..ff65145f5 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3344,6 +3344,13 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) hw_stats->fccrc + hw_stats->fclast; + /* +* 82599 errata, UDP frames with a 0 checksum can be marked as checksum +* errors. +*/ + if (hw->mac.type != ixgbe_mac_82599EB) + stats->ierrors += hw_stats->xec; + /* Tx Errors */ stats->oerrors = 0; return 0; -- 2.31.1
[dpdk-dev] [PATCH v1] net/ice: update QinQ switch filter handling
The hardware oueter/inner VLAN protocol types are now updated to map to new interface VLAN protocol types, so update the application to use new VLAN protocol types when the rte_flow is QinQ filter type. Signed-off-by: Haiyue Wang --- Depends-on: series-16315 ("base code update batch 2") --- drivers/net/ice/ice_switch_filter.c | 36 ++--- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 6f9e861d08..0bf3660677 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -389,12 +389,17 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], bool profile_rule = 0; bool nvgre_valid = 0; bool vxlan_valid = 0; + bool qinq_valid = 0; bool ipv6_valid = 0; bool ipv4_valid = 0; bool udp_valid = 0; bool tcp_valid = 0; uint16_t j, t = 0; + if (*tun_type == ICE_SW_TUN_AND_NON_TUN_QINQ || + *tun_type == ICE_NON_TUN_QINQ) + qinq_valid = 1; + for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { if (item->last) { @@ -932,22 +937,25 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], return 0; } - if (!outer_vlan_valid && - (*tun_type == ICE_SW_TUN_AND_NON_TUN_QINQ || -*tun_type == ICE_NON_TUN_QINQ)) - outer_vlan_valid = 1; - else if (!inner_vlan_valid && -(*tun_type == ICE_SW_TUN_AND_NON_TUN_QINQ || - *tun_type == ICE_NON_TUN_QINQ)) - inner_vlan_valid = 1; - else if (!inner_vlan_valid) - inner_vlan_valid = 1; + if (qinq_valid) { + if (!outer_vlan_valid) + outer_vlan_valid = 1; + else + inner_vlan_valid = 1; + } if (vlan_spec && vlan_mask) { - if (outer_vlan_valid && !inner_vlan_valid) { - list[t].type = ICE_VLAN_EX; - input_set |= ICE_INSET_VLAN_OUTER; - } else if (inner_vlan_valid) { + if (qinq_valid) { + if (!inner_vlan_valid) { + list[t].type = ICE_VLAN_EX; + input_set |= + ICE_INSET_VLAN_OUTER; + } else { + list[t].type = ICE_VLAN_IN; + input_set |= + ICE_INSET_VLAN_INNER; + } + } else { list[t].type = ICE_VLAN_OFOS; input_set |= ICE_INSET_VLAN_INNER; } -- 2.31.1
[PATCH v1] doc: fix KNI PMD name typo
The KNI PMD name should be "net_kni". Fixes: 75e2bc54c018 ("net/kni: add KNI PMD") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- doc/guides/nics/kni.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/guides/nics/kni.rst b/doc/guides/nics/kni.rst index 37c5411a32..2a23bb3f3b 100644 --- a/doc/guides/nics/kni.rst +++ b/doc/guides/nics/kni.rst @@ -33,7 +33,7 @@ Usage EAL ``--vdev`` argument can be used to create KNI device instance, like:: -dpdk-testpmd --vdev=net_kni0 --vdev=net_kn1 -- -i +dpdk-testpmd --vdev=net_kni0 --vdev=net_kni1 -- -i Above command will create ``kni0`` and ``kni1`` Linux network interfaces, those interfaces can be controlled by standard Linux tools. -- 2.34.1
[PATCH v1] net/af_xdp: make umem configure code more readable
The below compile time defined style make the code not so readable, the first function end block is after "#endif" segment. #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) xdp_umem_configure() { #else xdp_umem_configure() { #endif 'shared code block' } Signed-off-by: Haiyue Wang --- drivers/net/af_xdp/rte_eth_af_xdp.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 1b6192fa44..802f912cb7 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1078,6 +1078,12 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, __atomic_store_n(&umem->refcnt, 1, __ATOMIC_RELEASE); } + return umem; + +err: + xdp_umem_destroy(umem); + return NULL; +} #else static struct xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, @@ -1138,13 +1144,13 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, } umem->mz = mz; -#endif return umem; err: xdp_umem_destroy(umem); return NULL; } +#endif static int load_custom_xdp_prog(const char *prog_path, int if_index, struct bpf_map **map) -- 2.35.1
[dpdk-dev] [PATCH v1] net/ice: fix memzone leak when device init failed
When flow engine initialization or FXP resource reset failed, it needs to free the memory zone and unregister the interrupt callback. Bugzilla ID: 752 Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine") Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling") Fixes: 7edc7158d771 ("net/ice: cleanup RSS/FDIR profile on device init") Cc: sta...@dpdk.org Reported-by: David Marchand Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_ethdev.c | 10 -- drivers/net/ice/ice_fdir_filter.c | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 64ee569525..8d62b84805 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -2139,20 +2139,26 @@ ice_dev_init(struct rte_eth_dev *dev) ret = ice_flow_init(ad); if (ret) { PMD_INIT_LOG(ERR, "Failed to initialize flow"); - return ret; + goto err_flow_init; } } ret = ice_reset_fxp_resource(hw); if (ret) { PMD_INIT_LOG(ERR, "Failed to reset fxp resource"); - return ret; + goto err_flow_init; } pf->supported_rxdid = ice_get_supported_rxdid(hw); return 0; +err_flow_init: + ice_flow_uninit(ad); + rte_intr_disable(intr_handle); + ice_pf_disable_irq0(hw); + rte_intr_callback_unregister(intr_handle, +ice_interrupt_handler, dev); err_pf_setup: ice_res_pool_destroy(&pf->msix_pool); err_msix_pool_init: diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 82adb1fc8b..7ba65b9b04 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -651,8 +651,10 @@ ice_fdir_teardown(struct ice_pf *pf) ice_tx_queue_release(pf->fdir.txq); pf->fdir.txq = NULL; + rte_eth_dma_zone_free(eth_dev, "fdir_tx_ring", ICE_FDIR_QUEUE_ID); ice_rx_queue_release(pf->fdir.rxq); pf->fdir.rxq = NULL; + rte_eth_dma_zone_free(eth_dev, "fdir_rx_ring", ICE_FDIR_QUEUE_ID); ice_fdir_prof_rm_all(pf); ice_fdir_prof_free(hw); ice_release_vsi(vsi); -- 2.32.0
[PATCH v1] app/testpmd: avoid the process ID out of range
The 'proc-id' should be less than 'num-procs', if not, exit the testpmd and show the error message. Fixes: a550baf24af9 ("app/testpmd: support multi-process") Signed-off-by: Haiyue Wang --- app/test-pmd/parameters.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 0974b0a38f..5251722d0f 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -1527,6 +1527,12 @@ launch_args_parse(int argc, char** argv) rte_exit(EXIT_FAILURE, "Command line is incorrect\n"); } + if (proc_id >= (int)num_procs) + rte_exit(EXIT_FAILURE, +"The multi-process option '%s(%d)' should be less than '%s(%u)'\n", +PARAM_PROC_ID, proc_id, +PARAM_NUM_PROCS, num_procs); + /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; tx_mode.offloads = tx_offloads; -- 2.33.1
[PATCH v1] net/iavf: remove the extra symbol '+'
This extra symbol '+' should be added when patch was reapplied, and the compiler treats it as unsigned type, so the code still runs well. Fixes: 84108425054a ("net/iavf: support asynchronous virtual channel message") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_vchnl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 145b059837..8fdd6f6d91 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -502,7 +502,7 @@ iavf_get_vf_resource(struct iavf_adapter *adapter) VIRTCHNL_VF_OFFLOAD_VLAN_V2 | VIRTCHNL_VF_LARGE_NUM_QPAIRS | VIRTCHNL_VF_OFFLOAD_QOS | -+ VIRTCHNL_VF_OFFLOAD_INLINE_IPSEC_CRYPTO; + VIRTCHNL_VF_OFFLOAD_INLINE_IPSEC_CRYPTO; args.in_args = (uint8_t *)∩︀ args.in_args_size = sizeof(caps); -- 2.34.1
[dpdk-dev] [PATCH v1] net/ice: drain out DCF AdminQ command queue
The virtchnl command message response is handled by matchiing the opcode only for limitation. The DCF AdminQ command with buffer data needs two virtchnl commands, one is to handle the AdminQ header, the other is to handle AdminQ buffer. If the AdminQ header command gets the failure response, the AdminQ buffer command needs to wait for the buffer message response until timeout to drain out the virtchnl command queue, since both of them are sent to PF, the PF will handle them one by one, and send back the response. If not, it will cause the next AdminQ command failure with the stall response. Fixes: daa714d55c72 ("net/ice: handle AdminQ command by DCF") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_dcf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 4a9af3292c..a211797d9e 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -506,7 +506,6 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc, do { if ((!desc_cmd.pending && !buff_cmd.pending) || - (!desc_cmd.pending && desc_cmd.v_ret != IAVF_SUCCESS) || (!buff_cmd.pending && buff_cmd.v_ret != IAVF_SUCCESS)) break; -- 2.30.0
[dpdk-dev] [PATCH v2] net/ice: drain out DCF AdminQ command queue
The virtchnl command message response is handled by matching the opcode only for limitation. The DCF AdminQ command with buffer data needs two virtchnl commands, one is to handle the AdminQ header, the other is to handle AdminQ buffer. If the AdminQ header command gets the failure response, the AdminQ buffer command needs to wait for the buffer message response until timeout to drain out the virtchnl command queue, since both of them are sent to PF, the PF will handle them one by one, and send back the response. If not, it will cause the next AdminQ command failure with the stall response. Fixes: daa714d55c72 ("net/ice: handle AdminQ command by DCF") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- v2: Fix the commit message typo : 'matchiing' should be 'matching' --- drivers/net/ice/ice_dcf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 4a9af3292c..a211797d9e 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -506,7 +506,6 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc, do { if ((!desc_cmd.pending && !buff_cmd.pending) || - (!desc_cmd.pending && desc_cmd.v_ret != IAVF_SUCCESS) || (!buff_cmd.pending && buff_cmd.v_ret != IAVF_SUCCESS)) break; -- 2.30.0
[dpdk-dev] [PATCH v3] net/ice: drain out DCF AdminQ command queue
The virtchnl message is handled one by one by checking opcode to match the response for the request. The DCF AdminQ command with buffer needs two virtchnl commands, one is to handle the AdminQ descriptor, the other is to the handle AdminQ buffer. If both of them are sent to PF successfully, it needs to wait two responses from PF, even if the AdminQ descriptor command gets the failure response. Since PF will handle them one by one, and send back the response for each. If not wait for the buffer message response until timeout to drain out the virtchnl command queue, it will cause the next AdminQ command with buffer to get the stall buffer response from previous. Fixes: daa714d55c72 ("net/ice: handle AdminQ command by DCF") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- v3: Reword the commit message, and remove the no needed checking. v2: Fix the commit message typo : 'matchiing' should be 'matching' --- drivers/net/ice/ice_dcf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 4a9af3292c..d947d02c5b 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -505,9 +505,7 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc, } do { - if ((!desc_cmd.pending && !buff_cmd.pending) || - (!desc_cmd.pending && desc_cmd.v_ret != IAVF_SUCCESS) || - (!buff_cmd.pending && buff_cmd.v_ret != IAVF_SUCCESS)) + if (!desc_cmd.pending && !buff_cmd.pending) break; rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME); -- 2.30.0
[dpdk-dev] [PATCH v1] net/iavf: fix unsupported VLAN offload requested
If the underlying PF doesn't support a specific ethertype or the ability to toggle VLAN insertion and/or stripping, then the VF prevents sending an invalid message to the PF. Fixes: 1c301e8c3cff ("net/iavf: support new VLAN capabilities") Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_vchnl.c | 36 --- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index c82925eceb..9b8c4d113a 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -528,23 +528,21 @@ int iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable) { struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); - struct virtchnl_vlan_supported_caps *supported_caps; + struct virtchnl_vlan_supported_caps *stripping_caps; struct virtchnl_vlan_setting vlan_strip; struct iavf_cmd_info args; - uint32_t stripping_caps; uint32_t *ethertype; int ret; - supported_caps = &vf->vlan_v2_caps.offloads.stripping_support; - if (supported_caps->outer) { - stripping_caps = supported_caps->outer; + stripping_caps = &vf->vlan_v2_caps.offloads.stripping_support; + + if ((stripping_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) && + (stripping_caps->outer & VIRTCHNL_VLAN_TOGGLE)) ethertype = &vlan_strip.outer_ethertype_setting; - } else { - stripping_caps = supported_caps->inner; + else if ((stripping_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100) && +(stripping_caps->inner & VIRTCHNL_VLAN_TOGGLE)) ethertype = &vlan_strip.inner_ethertype_setting; - } - - if (!(stripping_caps & VIRTCHNL_VLAN_ETHERTYPE_8100)) + else return -ENOTSUP; memset(&vlan_strip, 0, sizeof(vlan_strip)); @@ -570,23 +568,21 @@ int iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable) { struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); - struct virtchnl_vlan_supported_caps *supported_caps; + struct virtchnl_vlan_supported_caps *insertion_caps; struct virtchnl_vlan_setting vlan_insert; struct iavf_cmd_info args; - uint32_t insertion_caps; uint32_t *ethertype; int ret; - supported_caps = &vf->vlan_v2_caps.offloads.insertion_support; - if (supported_caps->outer) { - insertion_caps = supported_caps->outer; + insertion_caps = &vf->vlan_v2_caps.offloads.insertion_support; + + if ((insertion_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) && + (insertion_caps->outer & VIRTCHNL_VLAN_TOGGLE)) ethertype = &vlan_insert.outer_ethertype_setting; - } else { - insertion_caps = supported_caps->inner; + else if ((insertion_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100) && +(insertion_caps->inner & VIRTCHNL_VLAN_TOGGLE)) ethertype = &vlan_insert.inner_ethertype_setting; - } - - if (!(insertion_caps & VIRTCHNL_VLAN_ETHERTYPE_8100)) + else return -ENOTSUP; memset(&vlan_insert, 0, sizeof(vlan_insert)); -- 2.30.0
[dpdk-dev] [PATCH v1] net/iavf: support to config VLAN filter
Add the VLAN filtering enable/disable configuration according to the VF successfully negotiated that capability with PF. Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf.h| 1 + drivers/net/iavf/iavf_ethdev.c | 7 ++ drivers/net/iavf/iavf_vchnl.c | 40 ++ 3 files changed, 48 insertions(+) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index c934d2e614..9d84e2604d 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -314,6 +314,7 @@ int iavf_configure_queues(struct iavf_adapter *adapter, int iavf_get_supported_rxdid(struct iavf_adapter *adapter); int iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable); int iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable); +int iavf_config_vlan_filter_v2(struct iavf_adapter *adapter, bool enable); int iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add); int iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter); diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index cf6ea0b15c..8e741031ec 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -1086,6 +1086,13 @@ iavf_dev_vlan_offload_set_v2(struct rte_eth_dev *dev, int mask) enable = !!(rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER); iavf_iterate_vlan_filters_v2(dev, enable); + + err = iavf_config_vlan_filter_v2(adapter, enable); + /* If not support, the filtering is already disabled by PF */ + if (err == -ENOTSUP && !enable) + err = 0; + if (err) + return -EIO; } if (mask & ETH_VLAN_STRIP_MASK) { diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 9b8c4d113a..7af143a21b 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -604,6 +604,46 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable) return ret; } +int +iavf_config_vlan_filter_v2(struct iavf_adapter *adapter, bool enable) +{ + struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); + struct virtchnl_vlan_supported_caps *filtering_caps; + struct virtchnl_vlan_setting vlan_filter; + struct iavf_cmd_info args; + uint32_t *ethertype; + int ret; + + filtering_caps = &vf->vlan_v2_caps.filtering.filtering_support; + + if ((filtering_caps->outer & VIRTCHNL_VLAN_ETHERTYPE_8100) && + (filtering_caps->outer & VIRTCHNL_VLAN_TOGGLE)) + ethertype = &vlan_filter.outer_ethertype_setting; + else if ((filtering_caps->inner & VIRTCHNL_VLAN_ETHERTYPE_8100) && +(filtering_caps->inner & VIRTCHNL_VLAN_TOGGLE)) + ethertype = &vlan_filter.inner_ethertype_setting; + else + return -ENOTSUP; + + memset(&vlan_filter, 0, sizeof(vlan_filter)); + vlan_filter.vport_id = vf->vsi_res->vsi_id; + *ethertype = VIRTCHNL_VLAN_ETHERTYPE_8100; + + args.ops = enable ? VIRTCHNL_OP_ENABLE_VLAN_FILTERING_V2 : + VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2; + args.in_args = (uint8_t *)&vlan_filter; + args.in_args_size = sizeof(vlan_filter); + args.out_buffer = vf->aq_resp; + args.out_size = IAVF_AQ_BUF_SZ; + ret = iavf_execute_vf_cmd(adapter, &args); + if (ret) + PMD_DRV_LOG(ERR, "fail to execute command %s", + enable ? "VIRTCHNL_OP_ENABLE_VLAN_FILTERING_V2" : +"VIRTCHNL_OP_DISABLE_VLAN_FILTERING_V2"); + + return ret; +} + int iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add) { -- 2.30.0
[dpdk-dev] [PATCH v1] net/iavf: adjust the VLAN failure handling
Change the fatal returning to print the error message only, so that the VF device can continue to be configured. Fixes: 1c301e8c3cff ("net/iavf: support new VLAN capabilities") Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_ethdev.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 8e741031ec..af655084d2 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -429,10 +429,8 @@ iavf_dev_configure(struct rte_eth_dev *dev) } ret = iavf_dev_init_vlan(dev); - if (ret) { + if (ret) PMD_DRV_LOG(ERR, "configure VLAN failed: %d", ret); - return -1; - } if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RSS_PF) { if (iavf_init_rss(ad) != 0) { -- 2.30.0
[dpdk-dev] [PATCH v1] net/ice/base: don't set VLAN mode in DCF mode
The PF will set the VLAN mode globally, DCF just needs to get the VLAN mode. Signed-off-by: Haiyue Wang --- drivers/net/ice/base/ice_vlan_mode.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ice/base/ice_vlan_mode.c b/drivers/net/ice/base/ice_vlan_mode.c index 2e4c3f62c4..460c4f902b 100644 --- a/drivers/net/ice/base/ice_vlan_mode.c +++ b/drivers/net/ice/base/ice_vlan_mode.c @@ -354,6 +354,12 @@ static enum ice_status ice_set_svm(struct ice_hw *hw) */ enum ice_status ice_set_vlan_mode(struct ice_hw *hw) { + /* DCF only has the ability to query the VLAN mode. Setting the VLAN +* mode is done by the PF. +*/ + if (hw->dcf_enabled) + return ICE_SUCCESS; + if (!ice_is_dvm_supported(hw)) return ICE_SUCCESS; -- 2.30.0
[dpdk-dev] [PATCH v1] net/ixgbe: adjust error for UDP with zero checksum
There is an 82599 errata that UDP frames with a zero checksum are incorrectly marked as checksum invalid by the hardware. This was leading to misleading PKT_RX_L4_CKSUM_BAD flag. This patch adds a test around this checksum error flag set for this condition. 1. UDP Test sendp(Ether()/IP()/UDP(chksum=0)/Raw("a"*100), iface="ens802f0") port 0/queue 0: received 1 packets ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD 2. TCP Test sendp(Ether()/IP()/TCP(chksum=0)/Raw("a"*100), iface="ens802f0") port 0/queue 0: received 1 packets ol_flags: PKT_RX_L4_CKSUM_BAD PKT_RX_IP_CKSUM_GOOD Bugzilla ID: 629 Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- doc/guides/nics/ixgbe.rst | 6 drivers/net/ixgbe/ixgbe_rxtx.c | 27 +++--- drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 49 -- 4 files changed, 70 insertions(+), 14 deletions(-) diff --git a/doc/guides/nics/ixgbe.rst b/doc/guides/nics/ixgbe.rst index 696cbd93b..de210b7b8 100644 --- a/doc/guides/nics/ixgbe.rst +++ b/doc/guides/nics/ixgbe.rst @@ -287,6 +287,12 @@ the VFs which are required.:: Currently hot-plugging of representor ports is not supported so all required representors must be specified on the creation of the PF. +Limitations or Known issues +--- +The 82599 hardware errata: UDP frames with a zero checksum can be marked as +checksum errors. To support zero checksum, the UDP checksum is always marked +as good. + Supported Chipsets and NICs --- diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index c1f0c446a..550e3f390 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1466,7 +1466,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status, uint64_t vlan_flags) } static inline uint64_t -rx_desc_error_to_pkt_flags(uint32_t rx_status) +rx_desc_error_to_pkt_flags(uint32_t rx_status, uint16_t pkt_info, + uint8_t rx_udp_csum_zero_err) { uint64_t pkt_flags; @@ -1480,6 +1481,12 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_GOOD, PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD }; + + if ((rx_status & IXGBE_RXDADV_ERR_TCPE) && + (pkt_info & IXGBE_RXDADV_PKTTYPE_UDP) && + rx_udp_csum_zero_err) + rx_status &= ~IXGBE_RXDADV_ERR_TCPE; + pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; @@ -1569,7 +1576,9 @@ ixgbe_rx_scan_hw_ring(struct ixgbe_rx_queue *rxq) /* convert descriptor fields to rte mbuf flags */ pkt_flags = rx_desc_status_to_pkt_flags(s[j], vlan_flags); - pkt_flags |= rx_desc_error_to_pkt_flags(s[j]); + pkt_flags |= rx_desc_error_to_pkt_flags(s[j], + (uint16_t)pkt_info[j], + rxq->rx_udp_csum_zero_err); pkt_flags |= ixgbe_rxd_pkt_info_to_pkt_flags ((uint16_t)pkt_info[j]); mb->ol_flags = pkt_flags; @@ -1902,7 +1911,9 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan); pkt_flags = rx_desc_status_to_pkt_flags(staterr, vlan_flags); - pkt_flags = pkt_flags | rx_desc_error_to_pkt_flags(staterr); + pkt_flags = pkt_flags | + rx_desc_error_to_pkt_flags(staterr, (uint16_t)pkt_info, + rxq->rx_udp_csum_zero_err); pkt_flags = pkt_flags | ixgbe_rxd_pkt_info_to_pkt_flags((uint16_t)pkt_info); rxm->ol_flags = pkt_flags; @@ -1995,7 +2006,8 @@ ixgbe_fill_cluster_head_buf( head->vlan_tci = rte_le_to_cpu_16(desc->wb.upper.vlan); pkt_info = rte_le_to_cpu_32(desc->wb.lower.lo_dword.data); pkt_flags = rx_desc_status_to_pkt_flags(staterr, rxq->vlan_flags); - pkt_flags |= rx_desc_error_to_pkt_flags(staterr); + pkt_flags |= rx_desc_error_to_pkt_flags(staterr, (uint16_t)pkt_info, + rxq->rx_udp_csum_zero_err); pkt_flags |= ixgbe_rxd_pkt_info_to_pkt_flags((uint16_t)pkt_info); head->ol_flags = pkt_flags; head->packet_type = @@ -3116,6 +3128,13 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, else rxq->pkt_type_mask = IXGBE_PACKET_TYPE_MASK_82599; + /* +* 82599 errata, UDP frames with a 0 checksum can be marked as checksum +
[dpdk-dev] [PATCH v2] net/ixgbe: fix UDP zero checksum error
There is an 82599 errata that UDP frames with a zero checksum are incorrectly marked as checksum invalid by the hardware. This was leading to misleading PKT_RX_L4_CKSUM_BAD flag. This patch changes the bad UDP checksum to PKT_RX_L4_CKSUM_UNKNOWN, so the software application will then have to recompute the checksum itself if needed. Bugzilla ID: 629 Fixes: af75078fece3 ("first public release") Cc: sta...@dpdk.org Reported-by: Paolo Valerio Signed-off-by: Haiyue Wang --- v2: Change the always GOOD checksum to UNKOWN if BAD. --- doc/guides/nics/ixgbe.rst | 7 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 30 drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 32 +++--- 4 files changed, 64 insertions(+), 7 deletions(-) diff --git a/doc/guides/nics/ixgbe.rst b/doc/guides/nics/ixgbe.rst index 696cbd93ba..41b07b9aff 100644 --- a/doc/guides/nics/ixgbe.rst +++ b/doc/guides/nics/ixgbe.rst @@ -287,6 +287,13 @@ the VFs which are required.:: Currently hot-plugging of representor ports is not supported so all required representors must be specified on the creation of the PF. +Limitations or Known issues +--- +The 82599 hardware errata: UDP frames with a zero checksum can be marked as +checksum errors. To support UDP zero checksum, the bad UDP checksum is marked +as PKT_RX_L4_CKSUM_UNKNOWN, so the application will recompute the checksum to +validate it again. + Supported Chipsets and NICs --- diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 72d27f35ca..950b7894e0 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1466,7 +1466,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status, uint64_t vlan_flags) } static inline uint64_t -rx_desc_error_to_pkt_flags(uint32_t rx_status) +rx_desc_error_to_pkt_flags(uint32_t rx_status, uint16_t pkt_info, + uint8_t rx_udp_csum_zero_err) { uint64_t pkt_flags; @@ -1483,6 +1484,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + /* Mask out the bad UDP checksum error if the hardware has UDP zero +* checksum error issue, so that the software application will then +* have to recompute the checksum itself if needed. +*/ + if ((rx_status & IXGBE_RXDADV_ERR_TCPE) && + (pkt_info & IXGBE_RXDADV_PKTTYPE_UDP) && + rx_udp_csum_zero_err) + pkt_flags &= ~PKT_RX_L4_CKSUM_BAD; + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { pkt_flags |= PKT_RX_EIP_CKSUM_BAD; @@ -1569,7 +1579,9 @@ ixgbe_rx_scan_hw_ring(struct ixgbe_rx_queue *rxq) /* convert descriptor fields to rte mbuf flags */ pkt_flags = rx_desc_status_to_pkt_flags(s[j], vlan_flags); - pkt_flags |= rx_desc_error_to_pkt_flags(s[j]); + pkt_flags |= rx_desc_error_to_pkt_flags(s[j], + (uint16_t)pkt_info[j], + rxq->rx_udp_csum_zero_err); pkt_flags |= ixgbe_rxd_pkt_info_to_pkt_flags ((uint16_t)pkt_info[j]); mb->ol_flags = pkt_flags; @@ -1902,7 +1914,9 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan); pkt_flags = rx_desc_status_to_pkt_flags(staterr, vlan_flags); - pkt_flags = pkt_flags | rx_desc_error_to_pkt_flags(staterr); + pkt_flags = pkt_flags | + rx_desc_error_to_pkt_flags(staterr, (uint16_t)pkt_info, + rxq->rx_udp_csum_zero_err); pkt_flags = pkt_flags | ixgbe_rxd_pkt_info_to_pkt_flags((uint16_t)pkt_info); rxm->ol_flags = pkt_flags; @@ -1995,7 +2009,8 @@ ixgbe_fill_cluster_head_buf( head->vlan_tci = rte_le_to_cpu_16(desc->wb.upper.vlan); pkt_info = rte_le_to_cpu_32(desc->wb.lower.lo_dword.data); pkt_flags = rx_desc_status_to_pkt_flags(staterr, rxq->vlan_flags); - pkt_flags |= rx_desc_error_to_pkt_flags(staterr); + pkt_flags |= rx_desc_error_to_pkt_flags(staterr, (uint16_t)pkt_info, + rxq->rx_udp_csum_zero_err); pkt_flags |= ixgbe_rxd_pkt_info_to_pkt_flags((uint16_t)pkt_info); head->ol_flags = pkt_flags; head->packet_type = @@ -3116,6 +3131,13 @@ ixgbe_dev_rx_queue_setup(str
[dpdk-dev] [PATCH v1] net/ice: update VLAN strip set in double VLAN mode
Since commit 14e7a4b37b4f ("net/ice/base: support configuring device in double VLAN mode"), the VLAN strip design is changed, double VLAN mode is not enabled by updating the VSI setting, it depends on the DDP and FW running support. Also, in double VLAN mode, the VLAN strip is applied on outer, since the VLAN filter is outer; in single VLAN mode, the VLAN strip is applied on inner, since the VLAN filter is inner. Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_ethdev.c | 297 +++ 1 file changed, 131 insertions(+), 166 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 02a25e8d2a..cb2c0cf449 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -68,8 +68,6 @@ static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = { .ol_flag = &rte_net_ice_dynflag_proto_xtr_ip_offset_mask }, }; -#define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100 - #define ICE_OS_DEFAULT_PKG_NAME"ICE OS Default Package" #define ICE_COMMS_PKG_NAME "ICE COMMS Package" #define ICE_MAX_RES_DESC_NUM1024 @@ -1122,127 +1120,6 @@ ice_remove_all_mac_vlan_filters(struct ice_vsi *vsi) return ret; } -static int -ice_vsi_config_qinq_insertion(struct ice_vsi *vsi, bool on) -{ - struct ice_hw *hw = ICE_VSI_TO_HW(vsi); - struct ice_vsi_ctx ctxt; - uint8_t qinq_flags; - int ret = 0; - - /* Check if it has been already on or off */ - if (vsi->info.valid_sections & - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) { - if (on) { - if ((vsi->info.outer_vlan_flags & -ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST) == - ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST) - return 0; /* already on */ - } else { - if (!(vsi->info.outer_vlan_flags & - ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST)) - return 0; /* already off */ - } - } - - if (on) - qinq_flags = ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST; - else - qinq_flags = 0; - /* clear global insertion and use per packet insertion */ - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT); - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST); - vsi->info.outer_vlan_flags |= qinq_flags; - /* use default vlan type 0x8100 */ - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_TAG_TYPE_M); - vsi->info.outer_vlan_flags |= ICE_DFLT_OUTER_TAG_TYPE << -ICE_AQ_VSI_OUTER_TAG_TYPE_S; - (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); - ctxt.info.valid_sections = - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); - ctxt.vsi_num = vsi->vsi_id; - ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL); - if (ret) { - PMD_DRV_LOG(INFO, - "Update VSI failed to %s qinq stripping", - on ? "enable" : "disable"); - return -EINVAL; - } - - vsi->info.valid_sections |= - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); - - return ret; -} - -static int -ice_vsi_config_qinq_stripping(struct ice_vsi *vsi, bool on) -{ - struct ice_hw *hw = ICE_VSI_TO_HW(vsi); - struct ice_vsi_ctx ctxt; - uint8_t qinq_flags; - int ret = 0; - - /* Check if it has been already on or off */ - if (vsi->info.valid_sections & - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) { - if (on) { - if ((vsi->info.outer_vlan_flags & -ICE_AQ_VSI_OUTER_VLAN_EMODE_M) == - ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW) - return 0; /* already on */ - } else { - if ((vsi->info.outer_vlan_flags & -ICE_AQ_VSI_OUTER_VLAN_EMODE_M) == - ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH) - return 0; /* already off */ - } - } - - if (on) - qinq_flags = ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW; - else - qinq_flags = ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH; - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_VLAN_EMODE_M); - vsi->info.outer_vlan_flags |= qinq_flags; - /* use default vlan type 0x8100 */ - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_TAG_TYPE
[dpdk-dev] [PATCH v2] net/ice: fix VLAN strip show in double VLAN mode
In double VLAN mode, the VLAN strip is applied on outer, since the VLAN filter is outer; in single VLAN mode, the VLAN strip is applied on inner for the VLAN filter is inner. So it needs to adjust the strip setting according to current VLAN mode. Fixes: 14e7a4b37b4f ("net/ice/base: support configuring device in double VLAN mode") Signed-off-by: Haiyue Wang --- v2: Add the missed fix tag, and update the commit message. --- drivers/net/ice/ice_ethdev.c | 297 +++ 1 file changed, 131 insertions(+), 166 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 02a25e8d2a..cb2c0cf449 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -68,8 +68,6 @@ static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = { .ol_flag = &rte_net_ice_dynflag_proto_xtr_ip_offset_mask }, }; -#define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100 - #define ICE_OS_DEFAULT_PKG_NAME"ICE OS Default Package" #define ICE_COMMS_PKG_NAME "ICE COMMS Package" #define ICE_MAX_RES_DESC_NUM1024 @@ -1122,127 +1120,6 @@ ice_remove_all_mac_vlan_filters(struct ice_vsi *vsi) return ret; } -static int -ice_vsi_config_qinq_insertion(struct ice_vsi *vsi, bool on) -{ - struct ice_hw *hw = ICE_VSI_TO_HW(vsi); - struct ice_vsi_ctx ctxt; - uint8_t qinq_flags; - int ret = 0; - - /* Check if it has been already on or off */ - if (vsi->info.valid_sections & - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) { - if (on) { - if ((vsi->info.outer_vlan_flags & -ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST) == - ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST) - return 0; /* already on */ - } else { - if (!(vsi->info.outer_vlan_flags & - ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST)) - return 0; /* already off */ - } - } - - if (on) - qinq_flags = ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST; - else - qinq_flags = 0; - /* clear global insertion and use per packet insertion */ - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT); - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST); - vsi->info.outer_vlan_flags |= qinq_flags; - /* use default vlan type 0x8100 */ - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_TAG_TYPE_M); - vsi->info.outer_vlan_flags |= ICE_DFLT_OUTER_TAG_TYPE << -ICE_AQ_VSI_OUTER_TAG_TYPE_S; - (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); - ctxt.info.valid_sections = - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); - ctxt.vsi_num = vsi->vsi_id; - ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL); - if (ret) { - PMD_DRV_LOG(INFO, - "Update VSI failed to %s qinq stripping", - on ? "enable" : "disable"); - return -EINVAL; - } - - vsi->info.valid_sections |= - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); - - return ret; -} - -static int -ice_vsi_config_qinq_stripping(struct ice_vsi *vsi, bool on) -{ - struct ice_hw *hw = ICE_VSI_TO_HW(vsi); - struct ice_vsi_ctx ctxt; - uint8_t qinq_flags; - int ret = 0; - - /* Check if it has been already on or off */ - if (vsi->info.valid_sections & - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) { - if (on) { - if ((vsi->info.outer_vlan_flags & -ICE_AQ_VSI_OUTER_VLAN_EMODE_M) == - ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW) - return 0; /* already on */ - } else { - if ((vsi->info.outer_vlan_flags & -ICE_AQ_VSI_OUTER_VLAN_EMODE_M) == - ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH) - return 0; /* already off */ - } - } - - if (on) - qinq_flags = ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW; - else - qinq_flags = ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH; - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_VLAN_EMODE_M); - vsi->info.outer_vlan_flags |= qinq_flags; - /* use default vlan type 0x8100 */ - vsi->info.outer_vlan_flags &= ~(ICE_AQ_VSI_OUTER_TAG_TYPE_M); - vsi-&
[dpdk-dev] [PATCH v1] net/ice: fix VLAN 0 adding based on VLAN mode
In Single VLAN Mode, single VLAN filters via ICE_SW_LKUP_VLAN are based on the inner VLAN ID, so the VLAN TPID (i.e. 0x8100 or 0x888a8) doesn't matter. In Double VLAN Mode, outer/single VLAN filters via ICE_SW_LKUP_VLAN are based on the outer/single VLAN ID + VLAN TPID. For both modes, adding a VLAN 0 + no VLAN TPID filter to handle untagged traffic when VLAN pruning is enabled. Also, this handles VLAN 0 priority tagged traffic in Single VLAN Mode, since the VLAN TPID is not part of filtering. If Double VLAN Mode is enabled then an explicit VLAN 0 + VLAN TPID filter needs to be added to allow VLAN 0 priority tagged traffic in DVM, since the VLAN TPID is part of filtering. Fixes: 14e7a4b37b4f ("net/ice/base: support configuring device in double VLAN mode") Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_ethdev.c | 136 +-- drivers/net/ice/ice_ethdev.h | 10 ++- 2 files changed, 123 insertions(+), 23 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index cb2c0cf449..e18bc7529a 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -948,12 +948,13 @@ ice_remove_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) /* Find out specific VLAN filter */ static struct ice_vlan_filter * -ice_find_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) +ice_find_vlan_filter(struct ice_vsi *vsi, struct ice_vlan *vlan) { struct ice_vlan_filter *f; TAILQ_FOREACH(f, &vsi->vlan_list, next) { - if (vlan_id == f->vlan_info.vlan_id) + if (vlan->tpid == f->vlan_info.vlan.tpid && + vlan->vid == f->vlan_info.vlan.vid) return f; } @@ -961,7 +962,7 @@ ice_find_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) } static int -ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) +ice_add_vlan_filter(struct ice_vsi *vsi, struct ice_vlan *vlan) { struct ice_fltr_list_entry *v_list_itr = NULL; struct ice_vlan_filter *f; @@ -969,13 +970,13 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) struct ice_hw *hw; int ret = 0; - if (!vsi || vlan_id > RTE_ETHER_MAX_VLAN_ID) + if (!vsi || vlan->vid > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; hw = ICE_VSI_TO_HW(vsi); /* If it's added and configured, return. */ - f = ice_find_vlan_filter(vsi, vlan_id); + f = ice_find_vlan_filter(vsi, vlan); if (f) { PMD_DRV_LOG(INFO, "This VLAN filter already exists."); return 0; @@ -992,7 +993,9 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) ret = -ENOMEM; goto DONE; } - v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan_id; + v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan->vid; + v_list_itr->fltr_info.l_data.vlan.tpid = vlan->tpid; + v_list_itr->fltr_info.l_data.vlan.tpid_valid = true; v_list_itr->fltr_info.src_id = ICE_SRC_ID_VSI; v_list_itr->fltr_info.fltr_act = ICE_FWD_TO_VSI; v_list_itr->fltr_info.lkup_type = ICE_SW_LKUP_VLAN; @@ -1016,7 +1019,8 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) ret = -ENOMEM; goto DONE; } - f->vlan_info.vlan_id = vlan_id; + f->vlan_info.vlan.tpid = vlan->tpid; + f->vlan_info.vlan.vid = vlan->vid; TAILQ_INSERT_TAIL(&vsi->vlan_list, f, next); vsi->vlan_num++; @@ -1028,7 +1032,7 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) } static int -ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) +ice_remove_vlan_filter(struct ice_vsi *vsi, struct ice_vlan *vlan) { struct ice_fltr_list_entry *v_list_itr = NULL; struct ice_vlan_filter *f; @@ -1036,17 +1040,13 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) struct ice_hw *hw; int ret = 0; - /** -* Vlan 0 is the generic filter for untagged packets -* and can't be removed. -*/ - if (!vsi || vlan_id == 0 || vlan_id > RTE_ETHER_MAX_VLAN_ID) + if (!vsi || vlan->vid > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; hw = ICE_VSI_TO_HW(vsi); /* Can't find it, return an error */ - f = ice_find_vlan_filter(vsi, vlan_id); + f = ice_find_vlan_filter(vsi, vlan); if (!f) return -EINVAL; @@ -1059,7 +1059,9 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) goto DONE; } - v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan_id; + v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan->vid; + v_list_itr->fltr_info.l_data.vlan.tpid = vlan->tpid; + v_list_i
[dpdk-dev] [PATCH v2] net/ice: fix VLAN 0 adding based on VLAN mode
In Single VLAN Mode, single VLAN filters via ICE_SW_LKUP_VLAN are based on the inner VLAN ID, so the VLAN TPID (i.e. 0x8100 or 0x888a8) doesn't matter. In Double VLAN Mode, outer/single VLAN filters via ICE_SW_LKUP_VLAN are based on the outer/single VLAN ID + VLAN TPID. For both modes, adding a VLAN 0 + no VLAN TPID filter to handle untagged traffic when VLAN pruning is enabled. Also, this handles VLAN 0 priority tagged traffic in Single VLAN Mode, since the VLAN TPID is not part of filtering. If Double VLAN Mode is enabled then an explicit VLAN 0 + VLAN TPID filter needs to be added to allow VLAN 0 priority tagged traffic in DVM, since the VLAN TPID is part of filtering. Fixes: 14e7a4b37b4f ("net/ice/base: support configuring device in double VLAN mode") Signed-off-by: Haiyue Wang --- v2: Change the log level from ERR to DEBUG, since this is not fatal error. --- drivers/net/ice/ice_ethdev.c | 136 +-- drivers/net/ice/ice_ethdev.h | 10 ++- 2 files changed, 123 insertions(+), 23 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index cb2c0cf449..dfd99ace94 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -948,12 +948,13 @@ ice_remove_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) /* Find out specific VLAN filter */ static struct ice_vlan_filter * -ice_find_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) +ice_find_vlan_filter(struct ice_vsi *vsi, struct ice_vlan *vlan) { struct ice_vlan_filter *f; TAILQ_FOREACH(f, &vsi->vlan_list, next) { - if (vlan_id == f->vlan_info.vlan_id) + if (vlan->tpid == f->vlan_info.vlan.tpid && + vlan->vid == f->vlan_info.vlan.vid) return f; } @@ -961,7 +962,7 @@ ice_find_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) } static int -ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) +ice_add_vlan_filter(struct ice_vsi *vsi, struct ice_vlan *vlan) { struct ice_fltr_list_entry *v_list_itr = NULL; struct ice_vlan_filter *f; @@ -969,13 +970,13 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) struct ice_hw *hw; int ret = 0; - if (!vsi || vlan_id > RTE_ETHER_MAX_VLAN_ID) + if (!vsi || vlan->vid > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; hw = ICE_VSI_TO_HW(vsi); /* If it's added and configured, return. */ - f = ice_find_vlan_filter(vsi, vlan_id); + f = ice_find_vlan_filter(vsi, vlan); if (f) { PMD_DRV_LOG(INFO, "This VLAN filter already exists."); return 0; @@ -992,7 +993,9 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) ret = -ENOMEM; goto DONE; } - v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan_id; + v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan->vid; + v_list_itr->fltr_info.l_data.vlan.tpid = vlan->tpid; + v_list_itr->fltr_info.l_data.vlan.tpid_valid = true; v_list_itr->fltr_info.src_id = ICE_SRC_ID_VSI; v_list_itr->fltr_info.fltr_act = ICE_FWD_TO_VSI; v_list_itr->fltr_info.lkup_type = ICE_SW_LKUP_VLAN; @@ -1016,7 +1019,8 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) ret = -ENOMEM; goto DONE; } - f->vlan_info.vlan_id = vlan_id; + f->vlan_info.vlan.tpid = vlan->tpid; + f->vlan_info.vlan.vid = vlan->vid; TAILQ_INSERT_TAIL(&vsi->vlan_list, f, next); vsi->vlan_num++; @@ -1028,7 +1032,7 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) } static int -ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) +ice_remove_vlan_filter(struct ice_vsi *vsi, struct ice_vlan *vlan) { struct ice_fltr_list_entry *v_list_itr = NULL; struct ice_vlan_filter *f; @@ -1036,17 +1040,13 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) struct ice_hw *hw; int ret = 0; - /** -* Vlan 0 is the generic filter for untagged packets -* and can't be removed. -*/ - if (!vsi || vlan_id == 0 || vlan_id > RTE_ETHER_MAX_VLAN_ID) + if (!vsi || vlan->vid > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; hw = ICE_VSI_TO_HW(vsi); /* Can't find it, return an error */ - f = ice_find_vlan_filter(vsi, vlan_id); + f = ice_find_vlan_filter(vsi, vlan); if (!f) return -EINVAL; @@ -1059,7 +1059,9 @@ ice_remove_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) goto DONE; } - v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan_id; + v_list_itr->fltr_info.l_data.vlan.vlan_id = vlan-
[dpdk-dev] [PATCH v3] net/ixgbe: fix UDP zero checksum error
There is an 82599 errata that UDP frames with a zero checksum are incorrectly marked as checksum invalid by the hardware. This was leading to misleading PKT_RX_L4_CKSUM_BAD flag. This patch changes the bad UDP checksum to PKT_RX_L4_CKSUM_UNKNOWN, so the software application will then have to recompute the checksum itself if needed. Bugzilla ID: 629 Fixes: af75078fece3 ("first public release") Cc: sta...@dpdk.org Reported-by: Paolo Valerio Signed-off-by: Haiyue Wang --- v3: Update the hardware errata doc name and session v2: Change the always GOOD checksum to UNKOWN if BAD. --- doc/guides/nics/ixgbe.rst | 10 drivers/net/ixgbe/ixgbe_rxtx.c | 30 drivers/net/ixgbe/ixgbe_rxtx.h | 2 ++ drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 32 +++--- 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/doc/guides/nics/ixgbe.rst b/doc/guides/nics/ixgbe.rst index 696cbd93ba..4c644c0e68 100644 --- a/doc/guides/nics/ixgbe.rst +++ b/doc/guides/nics/ixgbe.rst @@ -257,6 +257,16 @@ RSS isn't supported when QinQ is enabled Due to FW limitation, IXGBE doesn't support RSS when QinQ is enabled currently. +UDP with zero checksum is reported as error +~~~ + +Intel 82599 10 Gigabit Ethernet Controller Specification Update (Revision 2.87) +Errata: 44 Integrity Error Reported for IPv4/UDP Packets With Zero Checksum + +To support UDP zero checksum, the zero and bad UDP checksum packet is marked as +PKT_RX_L4_CKSUM_UNKNOWN, so the application needs to recompute the checksum to +validate it. + Inline crypto processing support diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 72d27f35ca..950b7894e0 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1466,7 +1466,8 @@ rx_desc_status_to_pkt_flags(uint32_t rx_status, uint64_t vlan_flags) } static inline uint64_t -rx_desc_error_to_pkt_flags(uint32_t rx_status) +rx_desc_error_to_pkt_flags(uint32_t rx_status, uint16_t pkt_info, + uint8_t rx_udp_csum_zero_err) { uint64_t pkt_flags; @@ -1483,6 +1484,15 @@ rx_desc_error_to_pkt_flags(uint32_t rx_status) pkt_flags = error_to_pkt_flags_map[(rx_status >> IXGBE_RXDADV_ERR_CKSUM_BIT) & IXGBE_RXDADV_ERR_CKSUM_MSK]; + /* Mask out the bad UDP checksum error if the hardware has UDP zero +* checksum error issue, so that the software application will then +* have to recompute the checksum itself if needed. +*/ + if ((rx_status & IXGBE_RXDADV_ERR_TCPE) && + (pkt_info & IXGBE_RXDADV_PKTTYPE_UDP) && + rx_udp_csum_zero_err) + pkt_flags &= ~PKT_RX_L4_CKSUM_BAD; + if ((rx_status & IXGBE_RXD_STAT_OUTERIPCS) && (rx_status & IXGBE_RXDADV_ERR_OUTERIPER)) { pkt_flags |= PKT_RX_EIP_CKSUM_BAD; @@ -1569,7 +1579,9 @@ ixgbe_rx_scan_hw_ring(struct ixgbe_rx_queue *rxq) /* convert descriptor fields to rte mbuf flags */ pkt_flags = rx_desc_status_to_pkt_flags(s[j], vlan_flags); - pkt_flags |= rx_desc_error_to_pkt_flags(s[j]); + pkt_flags |= rx_desc_error_to_pkt_flags(s[j], + (uint16_t)pkt_info[j], + rxq->rx_udp_csum_zero_err); pkt_flags |= ixgbe_rxd_pkt_info_to_pkt_flags ((uint16_t)pkt_info[j]); mb->ol_flags = pkt_flags; @@ -1902,7 +1914,9 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rxm->vlan_tci = rte_le_to_cpu_16(rxd.wb.upper.vlan); pkt_flags = rx_desc_status_to_pkt_flags(staterr, vlan_flags); - pkt_flags = pkt_flags | rx_desc_error_to_pkt_flags(staterr); + pkt_flags = pkt_flags | + rx_desc_error_to_pkt_flags(staterr, (uint16_t)pkt_info, + rxq->rx_udp_csum_zero_err); pkt_flags = pkt_flags | ixgbe_rxd_pkt_info_to_pkt_flags((uint16_t)pkt_info); rxm->ol_flags = pkt_flags; @@ -1995,7 +2009,8 @@ ixgbe_fill_cluster_head_buf( head->vlan_tci = rte_le_to_cpu_16(desc->wb.upper.vlan); pkt_info = rte_le_to_cpu_32(desc->wb.lower.lo_dword.data); pkt_flags = rx_desc_status_to_pkt_flags(staterr, rxq->vlan_flags); - pkt_flags |= rx_desc_error_to_pkt_flags(staterr); + pkt_flags |= rx_desc_error_to_pkt_flags(staterr, (uint16_t)pkt_info, + rxq->rx_udp_csum_zero_err); pkt_flags |= ixgbe_rxd_pkt_info_to_p
[dpdk-dev] [PATCH v1 1/4] common/iavf: add QFI fields for GTPU UL and DL
From: Junfeng Guo Add virtchnl fields QFI of GTPU UL/DL for AVF FDIR. Signed-off-by: Junfeng Guo Signed-off-by: Haiyue Wang --- drivers/common/iavf/virtchnl.h | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index 1cf0866124..9fa5e3e891 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -1642,6 +1642,11 @@ enum virtchnl_proto_hdr_field { /* IPv6 Extension Fragment */ VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG_PKID = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG), + /* GTPU_DWN/UP */ + VIRTCHNL_PROTO_HDR_GTPU_DWN_QFI = + PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_DWN), + VIRTCHNL_PROTO_HDR_GTPU_UP_QFI = + PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP), }; struct virtchnl_proto_hdr { -- 2.33.0
[dpdk-dev] [PATCH v1 2/4] common/iavf: add proto hdr field support for L4 checksum
From: Alvin Zhang Add TCP/UDP/SCTP header checksum field selectors. Signed-off-by: Alvin Zhang Signed-off-by: Haiyue Wang --- drivers/common/iavf/virtchnl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index 9fa5e3e891..c56c668cff 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -1598,14 +1598,17 @@ enum virtchnl_proto_hdr_field { VIRTCHNL_PROTO_HDR_TCP_SRC_PORT = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_TCP), VIRTCHNL_PROTO_HDR_TCP_DST_PORT, + VIRTCHNL_PROTO_HDR_TCP_CHKSUM, /* UDP */ VIRTCHNL_PROTO_HDR_UDP_SRC_PORT = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_UDP), VIRTCHNL_PROTO_HDR_UDP_DST_PORT, + VIRTCHNL_PROTO_HDR_UDP_CHKSUM, /* SCTP */ VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_SCTP), VIRTCHNL_PROTO_HDR_SCTP_DST_PORT, + VIRTCHNL_PROTO_HDR_SCTP_CHKSUM, /* GTPU_IP */ VIRTCHNL_PROTO_HDR_GTPU_IP_TEID = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_IP), -- 2.33.0
[dpdk-dev] [PATCH v1 3/4] common/iavf: remove the FDIR query opcode
The VIRTCHNL_OP_QUERY_FDIR_FILTER opcode is not used, so remove it. Signed-off-by: Haiyue Wang --- drivers/common/iavf/virtchnl.h | 38 -- 1 file changed, 38 deletions(-) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index c56c668cff..83f51d889f 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -146,7 +146,6 @@ enum virtchnl_ops { VIRTCHNL_OP_DEL_RSS_CFG = 46, VIRTCHNL_OP_ADD_FDIR_FILTER = 47, VIRTCHNL_OP_DEL_FDIR_FILTER = 48, - VIRTCHNL_OP_QUERY_FDIR_FILTER = 49, VIRTCHNL_OP_GET_MAX_RSS_QREGION = 50, VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS = 51, VIRTCHNL_OP_ADD_VLAN_V2 = 52, @@ -244,8 +243,6 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode) return "VIRTCHNL_OP_ADD_FDIR_FILTER"; case VIRTCHNL_OP_DEL_FDIR_FILTER: return "VIRTCHNL_OP_DEL_FDIR_FILTER"; - case VIRTCHNL_OP_QUERY_FDIR_FILTER: - return "VIRTCHNL_OP_QUERY_FDIR_FILTER"; case VIRTCHNL_OP_GET_MAX_RSS_QREGION: return "VIRTCHNL_OP_GET_MAX_RSS_QREGION"; case VIRTCHNL_OP_ENABLE_QUEUES_V2: @@ -1733,20 +1730,6 @@ struct virtchnl_fdir_rule { VIRTCHNL_CHECK_STRUCT_LEN(2604, virtchnl_fdir_rule); -/* query information to retrieve fdir rule counters. - * PF will fill out this structure to reset counter. - */ -struct virtchnl_fdir_query_info { - u32 match_packets_valid:1; - u32 match_bytes_valid:1; - u32 reserved:30; /* Reserved, must be zero. */ - u32 pad; - u64 matched_packets; /* Number of packets for this rule. */ - u64 matched_bytes; /* Number of bytes through this rule. */ -}; - -VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_fdir_query_info); - /* Status returned to VF after VF requests FDIR commands * VIRTCHNL_FDIR_SUCCESS * VF FDIR related request is successfully done by PF @@ -1879,24 +1862,6 @@ struct virtchnl_queue_tc_mapping { VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_tc_mapping); -/* VIRTCHNL_OP_QUERY_FDIR_FILTER - * VF sends this request to PF by filling out vsi_id, - * flow_id and reset_counter. PF will return query_info - * and query_status to VF. - */ -struct virtchnl_fdir_query { - u16 vsi_id; /* INPUT */ - u16 pad1[3]; - u32 flow_id; /* INPUT */ - u32 reset_counter:1; /* INPUT */ - struct virtchnl_fdir_query_info query_info; /* OUTPUT */ - - /* see enum virtchnl_fdir_prgm_status; OUTPUT */ - s32 status; - u32 pad2; -}; - -VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_fdir_query); /* TX and RX queue types are valid in legacy as well as split queue models. * With Split Queue model, 2 additional types are introduced - TX_COMPLETION @@ -2254,9 +2219,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode, case VIRTCHNL_OP_DEL_FDIR_FILTER: valid_len = sizeof(struct virtchnl_fdir_del); break; - case VIRTCHNL_OP_QUERY_FDIR_FILTER: - valid_len = sizeof(struct virtchnl_fdir_query); - break; case VIRTCHNL_OP_GET_QOS_CAPS: break; case VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP: -- 2.33.0
[dpdk-dev] [PATCH v1 4/4] common/iavf: update the driver version
Update the driver version to trace the change. Signed-off-by: Haiyue Wang --- drivers/common/iavf/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/iavf/README b/drivers/common/iavf/README index 611fdcea94..89bdbc827e 100644 --- a/drivers/common/iavf/README +++ b/drivers/common/iavf/README @@ -6,7 +6,7 @@ Intel® IAVF driver = This directory contains source code of FreeBSD IAVF driver of version -cid-avf.2021.04.29.tar.gz released by the team which develops +cid-avf.2021.08.16.tar.gz released by the team which develops basic drivers for any IAVF NIC. The directory of base/ contains the original source package. -- 2.33.0
[dpdk-dev] [PATCH v1 0/3] Promote some API to stable
According to DPDK ABI Policy, section 3.5.3. https://doc.dpdk.org/guides/contributing/abi_policy.html Promote some API reported by DPDK Symbol Bot to stable. Haiyue Wang (3): net/ixgbe: promote some API to stable net/ice: promote some API to stable ethdev: promote burst mode API to stable drivers/net/ice/rte_pmd_ice.h | 3 --- drivers/net/ice/version.map | 11 --- drivers/net/ixgbe/rte_pmd_ixgbe.h | 5 - drivers/net/ixgbe/version.map | 10 +- lib/ethdev/rte_ethdev.h | 2 -- lib/ethdev/version.map| 4 ++-- 6 files changed, 11 insertions(+), 24 deletions(-) -- 2.33.0
[dpdk-dev] [PATCH v1 1/3] net/ixgbe: promote some API to stable
The DPDK Symbol Bot reports: Please note the symbols listed below have expired. In line with the DPDK ABI policy, they should be scheduled for removal, in the next DPDK release. Symbol rte_pmd_ixgbe_mdio_lock rte_pmd_ixgbe_mdio_unlock rte_pmd_ixgbe_mdio_unlocked_read rte_pmd_ixgbe_mdio_unlocked_write rte_pmd_ixgbe_upd_fctrl_sbp Signed-off-by: Haiyue Wang --- drivers/net/ixgbe/rte_pmd_ixgbe.h | 5 - drivers/net/ixgbe/version.map | 10 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h index 90fc8160b1..7fcdbe7452 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h @@ -586,7 +586,6 @@ int rte_pmd_ixgbe_bypass_wd_reset(uint16_t port); * - (-ENODEV) if *port* invalid. * - (IXGBE_ERR_SWFW_SYNC) If sw/fw semaphore acquisition failed */ -__rte_experimental int rte_pmd_ixgbe_mdio_lock(uint16_t port); @@ -600,7 +599,6 @@ rte_pmd_ixgbe_mdio_lock(uint16_t port); * - (-ENOTSUP) if hardware doesn't support. * - (-ENODEV) if *port* invalid. */ -__rte_experimental int rte_pmd_ixgbe_mdio_unlock(uint16_t port); @@ -622,7 +620,6 @@ rte_pmd_ixgbe_mdio_unlock(uint16_t port); * - (-ENODEV) if *port* invalid. * - (IXGBE_ERR_PHY) If PHY read command failed */ -__rte_experimental int rte_pmd_ixgbe_mdio_unlocked_read(uint16_t port, uint32_t reg_addr, uint32_t dev_type, uint16_t *phy_data); @@ -646,7 +643,6 @@ rte_pmd_ixgbe_mdio_unlocked_read(uint16_t port, uint32_t reg_addr, * - (-ENODEV) if *port* invalid. * - (IXGBE_ERR_PHY) If PHY read command failed */ -__rte_experimental int rte_pmd_ixgbe_mdio_unlocked_write(uint16_t port, uint32_t reg_addr, uint32_t dev_type, uint16_t phy_data); @@ -725,7 +721,6 @@ enum { * - (-ENODEV) if *port* invalid. * - (-ENOTSUP) if hardware doesn't support this feature. */ -__rte_experimental int rte_pmd_ixgbe_upd_fctrl_sbp(uint16_t port, int enable); diff --git a/drivers/net/ixgbe/version.map b/drivers/net/ixgbe/version.map index bca5cc5826..f0f29d8749 100644 --- a/drivers/net/ixgbe/version.map +++ b/drivers/net/ixgbe/version.map @@ -16,6 +16,10 @@ DPDK_22 { rte_pmd_ixgbe_macsec_enable; rte_pmd_ixgbe_macsec_select_rxsa; rte_pmd_ixgbe_macsec_select_txsa; + rte_pmd_ixgbe_mdio_lock; + rte_pmd_ixgbe_mdio_unlock; + rte_pmd_ixgbe_mdio_unlocked_read; + rte_pmd_ixgbe_mdio_unlocked_write; rte_pmd_ixgbe_ping_vf; rte_pmd_ixgbe_set_all_queues_drop_en; rte_pmd_ixgbe_set_tc_bw_alloc; @@ -31,6 +35,7 @@ DPDK_22 { rte_pmd_ixgbe_set_vf_vlan_filter; rte_pmd_ixgbe_set_vf_vlan_insert; rte_pmd_ixgbe_set_vf_vlan_stripq; + rte_pmd_ixgbe_upd_fctrl_sbp; local: *; }; @@ -40,9 +45,4 @@ EXPERIMENTAL { rte_pmd_ixgbe_get_fdir_info; rte_pmd_ixgbe_get_fdir_stats; - rte_pmd_ixgbe_mdio_lock; - rte_pmd_ixgbe_mdio_unlock; - rte_pmd_ixgbe_mdio_unlocked_read; - rte_pmd_ixgbe_mdio_unlocked_write; - rte_pmd_ixgbe_upd_fctrl_sbp; }; -- 2.33.0
[dpdk-dev] [PATCH v1 2/3] net/ice: promote some API to stable
The DPDK Symbol Bot reports: Please note the symbols listed below have expired. In line with the DPDK ABI policy, they should be scheduled for removal, in the next DPDK release. Symbol rte_net_ice_dynfield_proto_xtr_metadata_offs rte_net_ice_dynflag_proto_xtr_vlan_mask rte_net_ice_dynflag_proto_xtr_ipv4_mask rte_net_ice_dynflag_proto_xtr_ipv6_mask rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask rte_net_ice_dynflag_proto_xtr_tcp_mask Signed-off-by: Haiyue Wang --- drivers/net/ice/rte_pmd_ice.h | 3 --- drivers/net/ice/version.map | 11 --- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ice/rte_pmd_ice.h b/drivers/net/ice/rte_pmd_ice.h index 9a436a140b..c0f19fcc89 100644 --- a/drivers/net/ice/rte_pmd_ice.h +++ b/drivers/net/ice/rte_pmd_ice.h @@ -149,7 +149,6 @@ extern uint64_t rte_net_ice_dynflag_proto_xtr_ip_offset_mask; * @return * True if registered, false otherwise. */ -__rte_experimental static __rte_always_inline int rte_net_ice_dynf_proto_xtr_metadata_avail(void) { @@ -164,7 +163,6 @@ rte_net_ice_dynf_proto_xtr_metadata_avail(void) * @return * The saved protocol extraction metadata. */ -__rte_experimental static __rte_always_inline uint32_t rte_net_ice_dynf_proto_xtr_metadata_get(struct rte_mbuf *m) { @@ -177,7 +175,6 @@ rte_net_ice_dynf_proto_xtr_metadata_get(struct rte_mbuf *m) * @param m *The pointer to the mbuf. */ -__rte_experimental static inline void rte_net_ice_dump_proto_xtr_metadata(struct rte_mbuf *m) { diff --git a/drivers/net/ice/version.map b/drivers/net/ice/version.map index cc837f1c00..1a633fd95e 100644 --- a/drivers/net/ice/version.map +++ b/drivers/net/ice/version.map @@ -1,16 +1,13 @@ DPDK_22 { - local: *; -}; - -EXPERIMENTAL { global: - # added in 19.11 rte_net_ice_dynfield_proto_xtr_metadata_offs; - rte_net_ice_dynflag_proto_xtr_vlan_mask; + rte_net_ice_dynflag_proto_xtr_ip_offset_mask; rte_net_ice_dynflag_proto_xtr_ipv4_mask; rte_net_ice_dynflag_proto_xtr_ipv6_mask; rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask; rte_net_ice_dynflag_proto_xtr_tcp_mask; - rte_net_ice_dynflag_proto_xtr_ip_offset_mask; + rte_net_ice_dynflag_proto_xtr_vlan_mask; + + local: *; }; -- 2.33.0
[dpdk-dev] [PATCH v1 3/3] ethdev: promote burst mode API to stable
The DPDK Symbol Bot reports: Please note the symbols listed below have expired. In line with the DPDK ABI policy, they should be scheduled for removal, in the next DPDK release. Symbol rte_eth_rx_burst_mode_get rte_eth_tx_burst_mode_get Signed-off-by: Haiyue Wang --- lib/ethdev/rte_ethdev.h | 2 -- lib/ethdev/version.map | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index d2b27c351f..3277e8f8fb 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -4361,7 +4361,6 @@ int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, * - -ENOTSUP: routine is not supported by the device PMD. * - -EINVAL: The queue_id is out of range. */ -__rte_experimental int rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode); @@ -4383,7 +4382,6 @@ int rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id, * - -ENOTSUP: routine is not supported by the device PMD. * - -EINVAL: The queue_id is out of range. */ -__rte_experimental int rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode); diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 3eece75b72..6a12b0664a 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -87,6 +87,7 @@ DPDK_22 { rte_eth_promiscuous_get; rte_eth_remove_rx_callback; rte_eth_remove_tx_callback; + rte_eth_rx_burst_mode_get; rte_eth_rx_queue_info_get; rte_eth_rx_queue_setup; rte_eth_set_queue_rate_limit; @@ -104,6 +105,7 @@ DPDK_22 { rte_eth_tx_buffer_drop_callback; rte_eth_tx_buffer_init; rte_eth_tx_buffer_set_err_callback; + rte_eth_tx_burst_mode_get; rte_eth_tx_done_cleanup; rte_eth_tx_queue_info_get; rte_eth_tx_queue_setup; @@ -166,9 +168,7 @@ EXPERIMENTAL { # added in 19.11 rte_eth_dev_hairpin_capability_get; - rte_eth_rx_burst_mode_get; rte_eth_rx_hairpin_queue_setup; - rte_eth_tx_burst_mode_get; rte_eth_tx_hairpin_queue_setup; rte_flow_dynf_metadata_offs; rte_flow_dynf_metadata_mask; -- 2.33.0
[dpdk-dev] [PATCH v2 0/4] iavf base code update
v2: update the commit message. Alvin Zhang (1): common/iavf: add proto hdr field support for L4 checksum Haiyue Wang (2): common/iavf: remove the FDIR query opcode common/iavf: update the driver version Junfeng Guo (1): common/iavf: add QFI fields for GTPU UL and DL drivers/common/iavf/README | 2 +- drivers/common/iavf/virtchnl.h | 46 ++ 2 files changed, 9 insertions(+), 39 deletions(-) -- 2.33.0
[dpdk-dev] [PATCH v2 1/4] common/iavf: add QFI fields for GTPU UL and DL
From: Junfeng Guo The QFI is 6-bit "QoS Flow Identifier" within the GTPU Extension Header. Add virtchnl fields QFI of GTPU UL/DL for supporting the AVF FDIR. Signed-off-by: Junfeng Guo Signed-off-by: Haiyue Wang --- drivers/common/iavf/virtchnl.h | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index 1cf0866124..9fa5e3e891 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -1642,6 +1642,11 @@ enum virtchnl_proto_hdr_field { /* IPv6 Extension Fragment */ VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG_PKID = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG), + /* GTPU_DWN/UP */ + VIRTCHNL_PROTO_HDR_GTPU_DWN_QFI = + PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_DWN), + VIRTCHNL_PROTO_HDR_GTPU_UP_QFI = + PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP), }; struct virtchnl_proto_hdr { -- 2.33.0
[dpdk-dev] [PATCH v2 2/4] common/iavf: add proto hdr field support for L4 checksum
From: Alvin Zhang Add TCP/UDP/SCTP header checksum field selectors, they can be used in creating FDIR or RSS rules related to TCP/UDP/SCTP header checksum. Signed-off-by: Alvin Zhang Signed-off-by: Haiyue Wang --- drivers/common/iavf/virtchnl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index 9fa5e3e891..c56c668cff 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -1598,14 +1598,17 @@ enum virtchnl_proto_hdr_field { VIRTCHNL_PROTO_HDR_TCP_SRC_PORT = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_TCP), VIRTCHNL_PROTO_HDR_TCP_DST_PORT, + VIRTCHNL_PROTO_HDR_TCP_CHKSUM, /* UDP */ VIRTCHNL_PROTO_HDR_UDP_SRC_PORT = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_UDP), VIRTCHNL_PROTO_HDR_UDP_DST_PORT, + VIRTCHNL_PROTO_HDR_UDP_CHKSUM, /* SCTP */ VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_SCTP), VIRTCHNL_PROTO_HDR_SCTP_DST_PORT, + VIRTCHNL_PROTO_HDR_SCTP_CHKSUM, /* GTPU_IP */ VIRTCHNL_PROTO_HDR_GTPU_IP_TEID = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_IP), -- 2.33.0
[dpdk-dev] [PATCH v2 3/4] common/iavf: remove the FDIR query opcode
The VIRTCHNL_OP_QUERY_FDIR_FILTER opcode is not used, so remove it. Signed-off-by: Haiyue Wang Acked-by: Qi Zhang --- drivers/common/iavf/virtchnl.h | 38 -- 1 file changed, 38 deletions(-) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index c56c668cff..83f51d889f 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -146,7 +146,6 @@ enum virtchnl_ops { VIRTCHNL_OP_DEL_RSS_CFG = 46, VIRTCHNL_OP_ADD_FDIR_FILTER = 47, VIRTCHNL_OP_DEL_FDIR_FILTER = 48, - VIRTCHNL_OP_QUERY_FDIR_FILTER = 49, VIRTCHNL_OP_GET_MAX_RSS_QREGION = 50, VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS = 51, VIRTCHNL_OP_ADD_VLAN_V2 = 52, @@ -244,8 +243,6 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode) return "VIRTCHNL_OP_ADD_FDIR_FILTER"; case VIRTCHNL_OP_DEL_FDIR_FILTER: return "VIRTCHNL_OP_DEL_FDIR_FILTER"; - case VIRTCHNL_OP_QUERY_FDIR_FILTER: - return "VIRTCHNL_OP_QUERY_FDIR_FILTER"; case VIRTCHNL_OP_GET_MAX_RSS_QREGION: return "VIRTCHNL_OP_GET_MAX_RSS_QREGION"; case VIRTCHNL_OP_ENABLE_QUEUES_V2: @@ -1733,20 +1730,6 @@ struct virtchnl_fdir_rule { VIRTCHNL_CHECK_STRUCT_LEN(2604, virtchnl_fdir_rule); -/* query information to retrieve fdir rule counters. - * PF will fill out this structure to reset counter. - */ -struct virtchnl_fdir_query_info { - u32 match_packets_valid:1; - u32 match_bytes_valid:1; - u32 reserved:30; /* Reserved, must be zero. */ - u32 pad; - u64 matched_packets; /* Number of packets for this rule. */ - u64 matched_bytes; /* Number of bytes through this rule. */ -}; - -VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_fdir_query_info); - /* Status returned to VF after VF requests FDIR commands * VIRTCHNL_FDIR_SUCCESS * VF FDIR related request is successfully done by PF @@ -1879,24 +1862,6 @@ struct virtchnl_queue_tc_mapping { VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_tc_mapping); -/* VIRTCHNL_OP_QUERY_FDIR_FILTER - * VF sends this request to PF by filling out vsi_id, - * flow_id and reset_counter. PF will return query_info - * and query_status to VF. - */ -struct virtchnl_fdir_query { - u16 vsi_id; /* INPUT */ - u16 pad1[3]; - u32 flow_id; /* INPUT */ - u32 reset_counter:1; /* INPUT */ - struct virtchnl_fdir_query_info query_info; /* OUTPUT */ - - /* see enum virtchnl_fdir_prgm_status; OUTPUT */ - s32 status; - u32 pad2; -}; - -VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_fdir_query); /* TX and RX queue types are valid in legacy as well as split queue models. * With Split Queue model, 2 additional types are introduced - TX_COMPLETION @@ -2254,9 +2219,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode, case VIRTCHNL_OP_DEL_FDIR_FILTER: valid_len = sizeof(struct virtchnl_fdir_del); break; - case VIRTCHNL_OP_QUERY_FDIR_FILTER: - valid_len = sizeof(struct virtchnl_fdir_query); - break; case VIRTCHNL_OP_GET_QOS_CAPS: break; case VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP: -- 2.33.0
[dpdk-dev] [PATCH v2 4/4] common/iavf: update the driver version
Update the driver version to trace the change. Signed-off-by: Haiyue Wang Acked-by: Qi Zhang --- drivers/common/iavf/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/iavf/README b/drivers/common/iavf/README index 611fdcea94..89bdbc827e 100644 --- a/drivers/common/iavf/README +++ b/drivers/common/iavf/README @@ -6,7 +6,7 @@ Intel® IAVF driver = This directory contains source code of FreeBSD IAVF driver of version -cid-avf.2021.04.29.tar.gz released by the team which develops +cid-avf.2021.08.16.tar.gz released by the team which develops basic drivers for any IAVF NIC. The directory of base/ contains the original source package. -- 2.33.0
[dpdk-dev] [PATCH v2] ethdev: promote burst mode API to stable
The DPDK Symbol Bot reports: Please note the symbols listed below have expired. In line with the DPDK ABI policy, they should be scheduled for removal, in the next DPDK release. Symbol rte_eth_rx_burst_mode_get rte_eth_tx_burst_mode_get Signed-off-by: Haiyue Wang Acked-by: Ferruh Yigit Acked-by: Ray Kinsella --- v2: Drop the PMD API promote to stable --- lib/ethdev/rte_ethdev.h | 2 -- lib/ethdev/version.map | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index d2b27c351f..3277e8f8fb 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -4361,7 +4361,6 @@ int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, * - -ENOTSUP: routine is not supported by the device PMD. * - -EINVAL: The queue_id is out of range. */ -__rte_experimental int rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode); @@ -4383,7 +4382,6 @@ int rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id, * - -ENOTSUP: routine is not supported by the device PMD. * - -EINVAL: The queue_id is out of range. */ -__rte_experimental int rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode); diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 3eece75b72..6a12b0664a 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -87,6 +87,7 @@ DPDK_22 { rte_eth_promiscuous_get; rte_eth_remove_rx_callback; rte_eth_remove_tx_callback; + rte_eth_rx_burst_mode_get; rte_eth_rx_queue_info_get; rte_eth_rx_queue_setup; rte_eth_set_queue_rate_limit; @@ -104,6 +105,7 @@ DPDK_22 { rte_eth_tx_buffer_drop_callback; rte_eth_tx_buffer_init; rte_eth_tx_buffer_set_err_callback; + rte_eth_tx_burst_mode_get; rte_eth_tx_done_cleanup; rte_eth_tx_queue_info_get; rte_eth_tx_queue_setup; @@ -166,9 +168,7 @@ EXPERIMENTAL { # added in 19.11 rte_eth_dev_hairpin_capability_get; - rte_eth_rx_burst_mode_get; rte_eth_rx_hairpin_queue_setup; - rte_eth_tx_burst_mode_get; rte_eth_tx_hairpin_queue_setup; rte_flow_dynf_metadata_offs; rte_flow_dynf_metadata_mask; -- 2.33.0
[dpdk-dev] [PATCH v3 0/4] iavf base code update
v3: adjust the commit title. v2: update the commit message. Alvin Zhang (1): common/iavf: enable hash calculation based on L4 checksum Haiyue Wang (2): common/iavf: remove the FDIR query opcode common/iavf: update the driver version Junfeng Guo (1): common/iavf: add QFI fields for GTPU UL and DL drivers/common/iavf/README | 2 +- drivers/common/iavf/virtchnl.h | 46 ++ 2 files changed, 9 insertions(+), 39 deletions(-) -- 2.33.0
[dpdk-dev] [PATCH v3 1/4] common/iavf: add QFI fields for GTPU UL and DL
From: Junfeng Guo The QFI is 6-bit "QoS Flow Identifier" within the GTPU Extension Header. Add virtchnl fields QFI of GTPU UL/DL for supporting the AVF FDIR. Signed-off-by: Junfeng Guo Signed-off-by: Haiyue Wang --- drivers/common/iavf/virtchnl.h | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index 1cf0866124..9fa5e3e891 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -1642,6 +1642,11 @@ enum virtchnl_proto_hdr_field { /* IPv6 Extension Fragment */ VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG_PKID = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG), + /* GTPU_DWN/UP */ + VIRTCHNL_PROTO_HDR_GTPU_DWN_QFI = + PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_DWN), + VIRTCHNL_PROTO_HDR_GTPU_UP_QFI = + PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP), }; struct virtchnl_proto_hdr { -- 2.33.0
[dpdk-dev] [PATCH v3 2/4] common/iavf: enable hash calculation based on L4 checksum
From: Alvin Zhang Add TCP/UDP/SCTP header checksum field selectors, they can be used in creating FDIR or RSS rules related to TCP/UDP/SCTP header checksum. Signed-off-by: Alvin Zhang Signed-off-by: Haiyue Wang --- drivers/common/iavf/virtchnl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index 9fa5e3e891..c56c668cff 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -1598,14 +1598,17 @@ enum virtchnl_proto_hdr_field { VIRTCHNL_PROTO_HDR_TCP_SRC_PORT = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_TCP), VIRTCHNL_PROTO_HDR_TCP_DST_PORT, + VIRTCHNL_PROTO_HDR_TCP_CHKSUM, /* UDP */ VIRTCHNL_PROTO_HDR_UDP_SRC_PORT = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_UDP), VIRTCHNL_PROTO_HDR_UDP_DST_PORT, + VIRTCHNL_PROTO_HDR_UDP_CHKSUM, /* SCTP */ VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_SCTP), VIRTCHNL_PROTO_HDR_SCTP_DST_PORT, + VIRTCHNL_PROTO_HDR_SCTP_CHKSUM, /* GTPU_IP */ VIRTCHNL_PROTO_HDR_GTPU_IP_TEID = PROTO_HDR_FIELD_START(VIRTCHNL_PROTO_HDR_GTPU_IP), -- 2.33.0
[dpdk-dev] [PATCH v3 3/4] common/iavf: remove the FDIR query opcode
The VIRTCHNL_OP_QUERY_FDIR_FILTER opcode is not used, so remove it. Signed-off-by: Haiyue Wang Acked-by: Qi Zhang --- drivers/common/iavf/virtchnl.h | 38 -- 1 file changed, 38 deletions(-) diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h index c56c668cff..83f51d889f 100644 --- a/drivers/common/iavf/virtchnl.h +++ b/drivers/common/iavf/virtchnl.h @@ -146,7 +146,6 @@ enum virtchnl_ops { VIRTCHNL_OP_DEL_RSS_CFG = 46, VIRTCHNL_OP_ADD_FDIR_FILTER = 47, VIRTCHNL_OP_DEL_FDIR_FILTER = 48, - VIRTCHNL_OP_QUERY_FDIR_FILTER = 49, VIRTCHNL_OP_GET_MAX_RSS_QREGION = 50, VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS = 51, VIRTCHNL_OP_ADD_VLAN_V2 = 52, @@ -244,8 +243,6 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode) return "VIRTCHNL_OP_ADD_FDIR_FILTER"; case VIRTCHNL_OP_DEL_FDIR_FILTER: return "VIRTCHNL_OP_DEL_FDIR_FILTER"; - case VIRTCHNL_OP_QUERY_FDIR_FILTER: - return "VIRTCHNL_OP_QUERY_FDIR_FILTER"; case VIRTCHNL_OP_GET_MAX_RSS_QREGION: return "VIRTCHNL_OP_GET_MAX_RSS_QREGION"; case VIRTCHNL_OP_ENABLE_QUEUES_V2: @@ -1733,20 +1730,6 @@ struct virtchnl_fdir_rule { VIRTCHNL_CHECK_STRUCT_LEN(2604, virtchnl_fdir_rule); -/* query information to retrieve fdir rule counters. - * PF will fill out this structure to reset counter. - */ -struct virtchnl_fdir_query_info { - u32 match_packets_valid:1; - u32 match_bytes_valid:1; - u32 reserved:30; /* Reserved, must be zero. */ - u32 pad; - u64 matched_packets; /* Number of packets for this rule. */ - u64 matched_bytes; /* Number of bytes through this rule. */ -}; - -VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_fdir_query_info); - /* Status returned to VF after VF requests FDIR commands * VIRTCHNL_FDIR_SUCCESS * VF FDIR related request is successfully done by PF @@ -1879,24 +1862,6 @@ struct virtchnl_queue_tc_mapping { VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_queue_tc_mapping); -/* VIRTCHNL_OP_QUERY_FDIR_FILTER - * VF sends this request to PF by filling out vsi_id, - * flow_id and reset_counter. PF will return query_info - * and query_status to VF. - */ -struct virtchnl_fdir_query { - u16 vsi_id; /* INPUT */ - u16 pad1[3]; - u32 flow_id; /* INPUT */ - u32 reset_counter:1; /* INPUT */ - struct virtchnl_fdir_query_info query_info; /* OUTPUT */ - - /* see enum virtchnl_fdir_prgm_status; OUTPUT */ - s32 status; - u32 pad2; -}; - -VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_fdir_query); /* TX and RX queue types are valid in legacy as well as split queue models. * With Split Queue model, 2 additional types are introduced - TX_COMPLETION @@ -2254,9 +2219,6 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode, case VIRTCHNL_OP_DEL_FDIR_FILTER: valid_len = sizeof(struct virtchnl_fdir_del); break; - case VIRTCHNL_OP_QUERY_FDIR_FILTER: - valid_len = sizeof(struct virtchnl_fdir_query); - break; case VIRTCHNL_OP_GET_QOS_CAPS: break; case VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP: -- 2.33.0
[dpdk-dev] [PATCH v3 4/4] common/iavf: update the driver version
Update the driver version to trace the change. Signed-off-by: Haiyue Wang Acked-by: Qi Zhang --- drivers/common/iavf/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/iavf/README b/drivers/common/iavf/README index 611fdcea94..89bdbc827e 100644 --- a/drivers/common/iavf/README +++ b/drivers/common/iavf/README @@ -6,7 +6,7 @@ Intel® IAVF driver = This directory contains source code of FreeBSD IAVF driver of version -cid-avf.2021.04.29.tar.gz released by the team which develops +cid-avf.2021.08.16.tar.gz released by the team which develops basic drivers for any IAVF NIC. The directory of base/ contains the original source package. -- 2.33.0
[dpdk-dev] [PATCH v1] net/ice: remove the redundant function type
The function 'ice_is_profile_rule' is defined as 'ice_is_prof_rule' in base code, which has the exactly same function body. So remove the 'ice_is_profile_rule', use the 'ice_is_prof_rule' instead. Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_switch_filter.c | 22 +- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index bc7771abd5..0bf3660677 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1534,26 +1534,6 @@ ice_switch_check_action(const struct rte_flow_action *actions, return 0; } -static bool -ice_is_profile_rule(enum ice_sw_tunnel_type tun_type) -{ - switch (tun_type) { - case ICE_SW_TUN_PROFID_IPV6_ESP: - case ICE_SW_TUN_PROFID_IPV6_AH: - case ICE_SW_TUN_PROFID_MAC_IPV6_L2TPV3: - case ICE_SW_TUN_PROFID_IPV6_NAT_T: - case ICE_SW_TUN_PROFID_IPV4_PFCP_NODE: - case ICE_SW_TUN_PROFID_IPV4_PFCP_SESSION: - case ICE_SW_TUN_PROFID_IPV6_PFCP_NODE: - case ICE_SW_TUN_PROFID_IPV6_PFCP_SESSION: - return true; - default: - break; - } - - return false; -} - static int ice_switch_parse_pattern_action(struct ice_adapter *ad, struct ice_pattern_match_item *array, @@ -1633,7 +1613,7 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad, inputset = ice_switch_inset_get (pattern, error, list, &lkups_num, &tun_type); - if ((!inputset && !ice_is_profile_rule(tun_type)) || + if ((!inputset && !ice_is_prof_rule(tun_type)) || (inputset & ~pattern_match_item->input_set_mask_o)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, -- 2.31.1
[PATCH v1] ethdev: beautify the Rx desc number check indent
Align to Tx desc number check indent, which may help to understand Rx descriptor limits member in the alignment comparison view. And remove the extra empty line. Signed-off-by: Haiyue Wang --- lib/ethdev/rte_ethdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 70c850a2f1..54f1e14c6b 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -1799,9 +1799,8 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, } if (nb_rx_desc > dev_info.rx_desc_lim.nb_max || - nb_rx_desc < dev_info.rx_desc_lim.nb_min || - nb_rx_desc % dev_info.rx_desc_lim.nb_align != 0) { - + nb_rx_desc < dev_info.rx_desc_lim.nb_min || + nb_rx_desc % dev_info.rx_desc_lim.nb_align != 0) { RTE_ETHDEV_LOG(ERR, "Invalid value for nb_rx_desc(=%hu), should be: <= %hu, >= %hu, and a product of %hu\n", nb_rx_desc, dev_info.rx_desc_lim.nb_max, -- 2.35.1
[PATCH v1] graph: remove the useless duplicate name check
The node clone API parameter 'name' is the new node's postfix name, not the final node name, so it makes no sense to check it. And the new name will be checked duplicate when calling API '__rte_node_register'. Signed-off-by: Haiyue Wang --- lib/graph/node.c | 4 1 file changed, 4 deletions(-) diff --git a/lib/graph/node.c b/lib/graph/node.c index 79230035a2..ae6eadb260 100644 --- a/lib/graph/node.c +++ b/lib/graph/node.c @@ -150,10 +150,6 @@ node_clone(struct node *node, const char *name) goto fail; } - /* Check for duplicate name */ - if (node_has_duplicate_entry(name)) - goto fail; - reg = calloc(1, sizeof(*reg) + (sizeof(char *) * node->nb_edges)); if (reg == NULL) { rte_errno = ENOMEM; -- 2.35.1
[PATCH v2] graph: remove the useless duplicate name check
The node clone API parameter 'name' is the new node's postfix name, not the final node name, so it makes no sense to check it. And the new name will be checked duplicate when calling API '__rte_node_register'. And update the test case to call clone API twice to check the real name duplicate. Signed-off-by: Haiyue Wang --- v2: update the test case. --- app/test/test_graph.c | 10 +- lib/graph/node.c | 4 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index 35e1a95b89..692360eccd 100644 --- a/app/test/test_graph.c +++ b/app/test/test_graph.c @@ -545,13 +545,21 @@ test_node_clone(void) { test_main_t *tm = &test_main; uint32_t node_id, dummy_id; + uint32_t dummy_id_clone; int i; node_id = rte_node_from_name("test_node00"); tm->test_node[0].idx = node_id; +#define TEST_NODE_CLONE_NAME "test_node00" + dummy_id_clone = rte_node_clone(node_id, TEST_NODE_CLONE_NAME); + if (rte_node_is_invalid(dummy_id_clone)) { + printf("Got invalid id when clone, Expecting fail\n"); + return -1; + } + /* Clone with same name, should fail */ - dummy_id = rte_node_clone(node_id, "test_node00"); + dummy_id = rte_node_clone(node_id, TEST_NODE_CLONE_NAME); if (!rte_node_is_invalid(dummy_id)) { printf("Got valid id when clone with same name, Expecting fail\n"); return -1; diff --git a/lib/graph/node.c b/lib/graph/node.c index 79230035a2..ae6eadb260 100644 --- a/lib/graph/node.c +++ b/lib/graph/node.c @@ -150,10 +150,6 @@ node_clone(struct node *node, const char *name) goto fail; } - /* Check for duplicate name */ - if (node_has_duplicate_entry(name)) - goto fail; - reg = calloc(1, sizeof(*reg) + (sizeof(char *) * node->nb_edges)); if (reg == NULL) { rte_errno = ENOMEM; -- 2.35.1
[PATCH v3] graph: remove the useless duplicate name check
The node clone API parameter 'name' is the new node's postfix name, not the final node name, so it makes no sense to check it. And the new name will be checked duplicate when calling API '__rte_node_register'. And update the test case to call clone API twice to check the real name duplicate. Signed-off-by: Haiyue Wang --- v3: No need to define another node id var. v2: update the test case. --- app/test/test_graph.c | 6 ++ lib/graph/node.c | 4 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index 35e1a95b89..1a2d1e6fab 100644 --- a/app/test/test_graph.c +++ b/app/test/test_graph.c @@ -550,6 +550,12 @@ test_node_clone(void) node_id = rte_node_from_name("test_node00"); tm->test_node[0].idx = node_id; + dummy_id = rte_node_clone(node_id, "test_node00"); + if (rte_node_is_invalid(dummy_id)) { + printf("Got invalid id when clone, Expecting fail\n"); + return -1; + } + /* Clone with same name, should fail */ dummy_id = rte_node_clone(node_id, "test_node00"); if (!rte_node_is_invalid(dummy_id)) { diff --git a/lib/graph/node.c b/lib/graph/node.c index 79230035a2..ae6eadb260 100644 --- a/lib/graph/node.c +++ b/lib/graph/node.c @@ -150,10 +150,6 @@ node_clone(struct node *node, const char *name) goto fail; } - /* Check for duplicate name */ - if (node_has_duplicate_entry(name)) - goto fail; - reg = calloc(1, sizeof(*reg) + (sizeof(char *) * node->nb_edges)); if (reg == NULL) { rte_errno = ENOMEM; -- 2.35.1
[PATCH v1] lib: remove x86 atomic header loop include
Remove the x86 top atomic header include from the architecture related header file, since this x86 top atomic header file has included them. Signed-off-by: Haiyue Wang --- lib/eal/x86/include/rte_atomic_32.h | 1 - lib/eal/x86/include/rte_atomic_64.h | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/eal/x86/include/rte_atomic_32.h b/lib/eal/x86/include/rte_atomic_32.h index f63b7fa275..c885a66e0c 100644 --- a/lib/eal/x86/include/rte_atomic_32.h +++ b/lib/eal/x86/include/rte_atomic_32.h @@ -17,7 +17,6 @@ #include #include -#include /*- 64 bit atomic operations -*/ diff --git a/lib/eal/x86/include/rte_atomic_64.h b/lib/eal/x86/include/rte_atomic_64.h index cfe7067ddd..0edee86272 100644 --- a/lib/eal/x86/include/rte_atomic_64.h +++ b/lib/eal/x86/include/rte_atomic_64.h @@ -19,7 +19,6 @@ #include #include #include -#include /*- 64 bit atomic operations -*/ -- 2.35.1
[dpdk-dev] [PATCH v1] net/iavf: fix RSS key access out of index
The array rss_key has size 'vf->vf_res->rss_key_size', the array index should be less than that. Cc: sta...@dpdk.org Fixes: 69dd4c3d0898 ("net/avf: enable queue and device") Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d688c31cfb..cb38fe81e1 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -366,7 +366,7 @@ iavf_init_rss(struct iavf_adapter *adapter) /* configure RSS key */ if (!rss_conf->rss_key) { /* Calculate the default hash key */ - for (i = 0; i <= vf->vf_res->rss_key_size; i++) + for (i = 0; i < vf->vf_res->rss_key_size; i++) vf->rss_key[i] = (uint8_t)rte_rand(); } else rte_memcpy(vf->rss_key, rss_conf->rss_key, -- 2.31.1
[dpdk-dev] [PATCH v6 0/3] fix PF reset causes VF memory request failure
By triggerring the VF reset from PF reset, echo 1 > /sys/bus/pci/devices/PF-BDF/reset the PCI bus master bit will cleared on VF, so the VF needs to enable this bit before restart. This patch set adds the API to enable PCI bus master. v6: update the annotate symbol version, and add some comments in source code v5: error handling if bus master enable failed v4: change the API to set type, so can enable or disable v3: added the missed annotate symbol add time v2: rebase to new librte directory path Haiyue Wang (3): bus/pci: set PCI master in command register net/iavf: enable PCI bus master after reset net/i40e: enable PCI bus master after reset drivers/bus/pci/pci_common.c | 28 drivers/bus/pci/rte_bus_pci.h | 14 ++ drivers/bus/pci/version.map | 3 +++ drivers/net/i40e/i40e_ethdev_vf.c | 13 - drivers/net/iavf/iavf_ethdev.c| 10 +- lib/pci/rte_pci.h | 4 6 files changed, 70 insertions(+), 2 deletions(-) -- 2.31.1
[dpdk-dev] [PATCH v6 1/3] bus/pci: set PCI master in command register
Add the API to set 'Bus Master Enable' bit to be enabled or disabled in the PCI command register. Signed-off-by: Haiyue Wang Acked-by: Ray Kinsella --- drivers/bus/pci/pci_common.c | 28 drivers/bus/pci/rte_bus_pci.h | 14 ++ drivers/bus/pci/version.map | 3 +++ lib/pci/rte_pci.h | 4 4 files changed, 49 insertions(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index ee7f966358..35d7d092d1 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -746,6 +746,34 @@ rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap) return 0; } +int +rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable) +{ + uint16_t old_cmd, cmd; + + if (rte_pci_read_config(dev, &old_cmd, sizeof(old_cmd), + RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in reading PCI command register\n"); + return -1; + } + + if (enable) + cmd = old_cmd | RTE_PCI_COMMAND_MASTER; + else + cmd = old_cmd & ~RTE_PCI_COMMAND_MASTER; + + if (cmd == old_cmd) + return 0; + + if (rte_pci_write_config(dev, &cmd, sizeof(cmd), +RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in writing PCI command register\n"); + return -1; + } + + return 0; +} + struct rte_pci_bus rte_pci_bus = { .bus = { .scan = rte_pci_scan, diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 64886b4731..976c33c921 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -249,6 +249,20 @@ void rte_pci_dump(FILE *f); __rte_experimental off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap); +/** + * Enables/Disables Bus Master for device's PCI command register. + * + * @param dev + *A pointer to rte_pci_device structure. + * @param enable + *Enable or disable Bus Master. + * + * @return + * 0 on success, -1 on error in PCI config space read/write. + */ +__rte_experimental +int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable); + /** * Register a PCI driver. * diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map index f33ed0abd1..00fac8864c 100644 --- a/drivers/bus/pci/version.map +++ b/drivers/bus/pci/version.map @@ -21,4 +21,7 @@ EXPERIMENTAL { global: rte_pci_find_ext_capability; + + # added in 21.08 + rte_pci_set_bus_master; }; diff --git a/lib/pci/rte_pci.h b/lib/pci/rte_pci.h index a8f8e404a9..1f33d687f4 100644 --- a/lib/pci/rte_pci.h +++ b/lib/pci/rte_pci.h @@ -32,6 +32,10 @@ extern "C" { #define RTE_PCI_VENDOR_ID 0x00/* 16 bits */ #define RTE_PCI_DEVICE_ID 0x02/* 16 bits */ +#define RTE_PCI_COMMAND0x04/* 16 bits */ + +/* PCI Command Register */ +#define RTE_PCI_COMMAND_MASTER 0x4 /* Bus Master Enable */ /* PCI Express capability registers */ #define RTE_PCI_EXP_DEVCTL 8 /* Device Control */ -- 2.31.1
[dpdk-dev] [PATCH v6 2/3] net/iavf: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And if failed, the device or system may be in an invalid state, so keep the VF reset state to mark it as I/O error. Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_ethdev.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d688c31cfb..a7ef7a6d4d 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2356,7 +2356,15 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_free(vf->aq_resp); vf->aq_resp = NULL; - vf->vf_reset = false; + /* +* If the VF is reset via VFLR, the device will be knocked out of bus +* master mode, and the driver will fail to recover from the reset. Fix +* this by enabling bus mastering after every reset. In a non-VFLR case, +* the bus master bit will not be disabled, and this call will have no +* effect. +*/ + if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true)) + vf->vf_reset = false; return ret; } -- 2.31.1
[dpdk-dev] [PATCH v6 3/3] net/i40e: enable PCI bus master after reset
The VF reset can be triggerred by the PF reset event, in this case, the PCI bus master will be cleared, then the VF is not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And if failed, the device or system may be in an invalid state, so keep the VF reset state to mark it as I/O error. Signed-off-by: Haiyue Wang --- drivers/net/i40e/i40e_ethdev_vf.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index cb898bdb68..385ebedcd3 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1213,7 +1213,6 @@ i40evf_check_vf_reset_done(struct rte_eth_dev *dev) if (i >= MAX_RESET_WAIT_CNT) return -1; - vf->vf_reset = false; vf->pend_msg &= ~PFMSG_RESET_IMPENDING; return 0; @@ -1392,6 +1391,7 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg, switch (pf_msg->event) { case VIRTCHNL_EVENT_RESET_IMPENDING: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event"); + vf->vf_reset = true; rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); break; @@ -2468,6 +2468,7 @@ i40evf_dev_close(struct rte_eth_dev *dev) { 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 rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); int ret; if (rte_eal_process_type() != RTE_PROC_PRIMARY) @@ -2490,6 +2491,16 @@ i40evf_dev_close(struct rte_eth_dev *dev) i40e_shutdown_adminq(hw); i40evf_disable_irq0(hw); + /* +* If the VF is reset via VFLR, the device will be knocked out of bus +* master mode, and the driver will fail to recover from the reset. Fix +* this by enabling bus mastering after every reset. In a non-VFLR case, +* the bus master bit will not be disabled, and this call will have no +* effect. +*/ + if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true)) + vf->vf_reset = false; + rte_free(vf->vf_res); vf->vf_res = NULL; rte_free(vf->aq_resp); -- 2.31.1
[dpdk-dev] [PATCH v7 0/3] fix PF reset causes VF memory request failure
Trigger the VF reset from PF reset, echo 1 > /sys/bus/pci/devices/PF-BDF/reset the PCI bus master bit will cleared on VF, so the VF needs to enable this bit before restart. This patch set adds the API to enable PCI bus master. v7: fix the commit message typo, and update some description. v6: update the annotate symbol version, and add some comments in source code v5: error handling if bus master enable failed v4: change the API to set type, so can enable or disable v3: added the missed annotate symbol add time v2: rebase to new librte directory path Haiyue Wang (3): bus/pci: set PCI master in command register net/iavf: enable PCI bus master after reset net/i40e: enable PCI bus master after reset drivers/bus/pci/pci_common.c | 28 drivers/bus/pci/rte_bus_pci.h | 14 ++ drivers/bus/pci/version.map | 3 +++ drivers/net/i40e/i40e_ethdev_vf.c | 13 - drivers/net/iavf/iavf_ethdev.c| 10 +- lib/pci/rte_pci.h | 4 6 files changed, 70 insertions(+), 2 deletions(-) -- 2.31.1
[dpdk-dev] [PATCH v7 1/3] bus/pci: set PCI master in command register
Add the API to set 'Bus Master Enable' bit to be enabled or disabled in the PCI command register. Signed-off-by: Haiyue Wang Acked-by: Ray Kinsella --- drivers/bus/pci/pci_common.c | 28 drivers/bus/pci/rte_bus_pci.h | 14 ++ drivers/bus/pci/version.map | 3 +++ lib/pci/rte_pci.h | 4 4 files changed, 49 insertions(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index ee7f966358..35d7d092d1 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -746,6 +746,34 @@ rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap) return 0; } +int +rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable) +{ + uint16_t old_cmd, cmd; + + if (rte_pci_read_config(dev, &old_cmd, sizeof(old_cmd), + RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in reading PCI command register\n"); + return -1; + } + + if (enable) + cmd = old_cmd | RTE_PCI_COMMAND_MASTER; + else + cmd = old_cmd & ~RTE_PCI_COMMAND_MASTER; + + if (cmd == old_cmd) + return 0; + + if (rte_pci_write_config(dev, &cmd, sizeof(cmd), +RTE_PCI_COMMAND) < 0) { + RTE_LOG(ERR, EAL, "error in writing PCI command register\n"); + return -1; + } + + return 0; +} + struct rte_pci_bus rte_pci_bus = { .bus = { .scan = rte_pci_scan, diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 64886b4731..976c33c921 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -249,6 +249,20 @@ void rte_pci_dump(FILE *f); __rte_experimental off_t rte_pci_find_ext_capability(struct rte_pci_device *dev, uint32_t cap); +/** + * Enables/Disables Bus Master for device's PCI command register. + * + * @param dev + *A pointer to rte_pci_device structure. + * @param enable + *Enable or disable Bus Master. + * + * @return + * 0 on success, -1 on error in PCI config space read/write. + */ +__rte_experimental +int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable); + /** * Register a PCI driver. * diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map index f33ed0abd1..00fac8864c 100644 --- a/drivers/bus/pci/version.map +++ b/drivers/bus/pci/version.map @@ -21,4 +21,7 @@ EXPERIMENTAL { global: rte_pci_find_ext_capability; + + # added in 21.08 + rte_pci_set_bus_master; }; diff --git a/lib/pci/rte_pci.h b/lib/pci/rte_pci.h index a8f8e404a9..1f33d687f4 100644 --- a/lib/pci/rte_pci.h +++ b/lib/pci/rte_pci.h @@ -32,6 +32,10 @@ extern "C" { #define RTE_PCI_VENDOR_ID 0x00/* 16 bits */ #define RTE_PCI_DEVICE_ID 0x02/* 16 bits */ +#define RTE_PCI_COMMAND0x04/* 16 bits */ + +/* PCI Command Register */ +#define RTE_PCI_COMMAND_MASTER 0x4 /* Bus Master Enable */ /* PCI Express capability registers */ #define RTE_PCI_EXP_DEVCTL 8 /* Device Control */ -- 2.31.1
[dpdk-dev] [PATCH v7 2/3] net/iavf: enable PCI bus master after reset
The VF reset can be triggered by the PF reset event, then the PCI bus master will be cleared, the VF will be not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And if failed, the device or system may be in an invalid state, so keep the VF reset state to mark it as I/O error. Signed-off-by: Haiyue Wang --- drivers/net/iavf/iavf_ethdev.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d688c31cfb..a7ef7a6d4d 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -2356,7 +2356,15 @@ iavf_dev_close(struct rte_eth_dev *dev) rte_free(vf->aq_resp); vf->aq_resp = NULL; - vf->vf_reset = false; + /* +* If the VF is reset via VFLR, the device will be knocked out of bus +* master mode, and the driver will fail to recover from the reset. Fix +* this by enabling bus mastering after every reset. In a non-VFLR case, +* the bus master bit will not be disabled, and this call will have no +* effect. +*/ + if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true)) + vf->vf_reset = false; return ret; } -- 2.31.1
[dpdk-dev] [PATCH v7 3/3] net/i40e: enable PCI bus master after reset
The VF reset can be triggered by the PF reset event, then the PCI bus master will be cleared, the VF will be not allowed to issue any Memory or I/O Requests. So after the reset event is detected, always enable the PCI bus master. And if failed, the device or system may be in an invalid state, so keep the VF reset state to mark it as I/O error. Signed-off-by: Haiyue Wang --- drivers/net/i40e/i40e_ethdev_vf.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index cb898bdb68..385ebedcd3 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1213,7 +1213,6 @@ i40evf_check_vf_reset_done(struct rte_eth_dev *dev) if (i >= MAX_RESET_WAIT_CNT) return -1; - vf->vf_reset = false; vf->pend_msg &= ~PFMSG_RESET_IMPENDING; return 0; @@ -1392,6 +1391,7 @@ i40evf_handle_pf_event(struct rte_eth_dev *dev, uint8_t *msg, switch (pf_msg->event) { case VIRTCHNL_EVENT_RESET_IMPENDING: PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event"); + vf->vf_reset = true; rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET, NULL); break; @@ -2468,6 +2468,7 @@ i40evf_dev_close(struct rte_eth_dev *dev) { 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 rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); int ret; if (rte_eal_process_type() != RTE_PROC_PRIMARY) @@ -2490,6 +2491,16 @@ i40evf_dev_close(struct rte_eth_dev *dev) i40e_shutdown_adminq(hw); i40evf_disable_irq0(hw); + /* +* If the VF is reset via VFLR, the device will be knocked out of bus +* master mode, and the driver will fail to recover from the reset. Fix +* this by enabling bus mastering after every reset. In a non-VFLR case, +* the bus master bit will not be disabled, and this call will have no +* effect. +*/ + if (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true)) + vf->vf_reset = false; + rte_free(vf->vf_res); vf->vf_res = NULL; rte_free(vf->aq_resp); -- 2.31.1
[PATCH v1 1/3] maintainers: update for Intel e1000
Simei and Wenjun have been appointed the new maintainers for the e1000 PMD. Update the MAINTAINERS file to reflect this. Signed-off-by: Haiyue Wang --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 15008c03bc..9d098161b2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -698,7 +698,8 @@ F: doc/guides/nics/hinic.rst F: doc/guides/nics/features/hinic.ini Intel e1000 -M: Haiyue Wang +M: Simei Su +M: Wenjun Wu T: git://dpdk.org/next/dpdk-next-net-intel F: drivers/net/e1000/ F: doc/guides/nics/e1000em.rst -- 2.35.1
[PATCH v1 2/3] maintainers: update for Intel ixgbe
Qiming and Wenjun have been appointed the new maintainers for the ixgbe PMD. Update the MAINTAINERS file to reflect this. Signed-off-by: Haiyue Wang --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 9d098161b2..513748b45b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -708,7 +708,8 @@ F: doc/guides/nics/features/e1000.ini F: doc/guides/nics/features/igb*.ini Intel ixgbe -M: Haiyue Wang +M: Qiming Yang +M: Wenjun Wu T: git://dpdk.org/next/dpdk-next-net-intel F: drivers/net/ixgbe/ F: doc/guides/nics/ixgbe.rst -- 2.35.1
[PATCH v1 3/3] maintainers: update for Intel igc
Junfeng and Simei have been appointed the new maintainers for the igc PMD. Update the MAINTAINERS file to reflect this. Signed-off-by: Haiyue Wang --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 513748b45b..21c581dc61 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -749,7 +749,8 @@ F: doc/guides/nics/ice.rst F: doc/guides/nics/features/ice.ini Intel igc -M: Haiyue Wang +M: Junfeng Guo +M: Simei Su T: git://dpdk.org/next/dpdk-next-net-intel F: drivers/net/igc/ F: doc/guides/nics/igc.rst -- 2.35.1
[PATCH v1] ring: correct the comment and figure description
The index description isn't right, correct it as the Programmer's guide said. Also correct the guide's figure description about 'Dequeue First Step'. Signed-off-by: Haiyue Wang --- doc/guides/prog_guide/ring_lib.rst | 2 +- lib/ring/rte_ring_core.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/guides/prog_guide/ring_lib.rst b/doc/guides/prog_guide/ring_lib.rst index 54e0bb4b68..515a715266 100644 --- a/doc/guides/prog_guide/ring_lib.rst +++ b/doc/guides/prog_guide/ring_lib.rst @@ -172,7 +172,7 @@ If there are not enough objects in the ring (this is detected by checking prod_t .. figure:: img/ring-dequeue1.* - Dequeue last step + Dequeue first step Dequeue Second Step diff --git a/lib/ring/rte_ring_core.h b/lib/ring/rte_ring_core.h index 1252ca9546..82b237091b 100644 --- a/lib/ring/rte_ring_core.h +++ b/lib/ring/rte_ring_core.h @@ -111,8 +111,8 @@ struct rte_ring_hts_headtail { * An RTE ring structure. * * The producer and the consumer have a head and a tail index. The particularity - * of these index is that they are not between 0 and size(ring). These indexes - * are between 0 and 2^32, and we mask their value when we access the ring[] + * of these index is that they are not between 0 and size(ring)-1. These indexes + * are between 0 and 2^32 -1, and we mask their value when we access the ring[] * field. Thanks to this assumption, we can do subtractions between 2 index * values in a modulo-32bit base: that's why the overflow of the indexes is not * a problem. -- 2.35.1
[dpdk-dev] [PATCH v1] net/ice: refactor dynamic mbuf in data extraction
Current dynamic mbuf design is that the driver will register the needed field and flags at the device probing time, this will make iavf PMD use different names to register the dynamic mbuf field and flags, but both of them use the exactly same protocol extraction metadata. This will run out of the limited dynamic mbuf resource, meanwhile, the application has to handle the dynamic mbuf separately. For making things simple and consistent, refactor dynamic mbuf in data extraction handling: the PMD just lookups the same name at the queue setup time after the application registers it. In other words, make the dynamic mbuf string name as API, not the data object which is defined in each PMD. Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_ethdev.c | 104 ++-- drivers/net/ice/ice_ethdev.h | 1 + drivers/net/ice/ice_rxtx.c| 49 drivers/net/ice/ice_rxtx.h| 1 + drivers/net/ice/rte_pmd_ice.h | 219 +- drivers/net/ice/version.map | 13 -- 6 files changed, 68 insertions(+), 319 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 51b99c6506..ec27089cfa 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -32,42 +32,6 @@ static const char * const ice_valid_args[] = { NULL }; -static const struct rte_mbuf_dynfield ice_proto_xtr_metadata_param = { - .name = "ice_dynfield_proto_xtr_metadata", - .size = sizeof(uint32_t), - .align = __alignof__(uint32_t), - .flags = 0, -}; - -struct proto_xtr_ol_flag { - const struct rte_mbuf_dynflag param; - uint64_t *ol_flag; - bool required; -}; - -static bool ice_proto_xtr_hw_support[PROTO_XTR_MAX]; - -static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = { - [PROTO_XTR_VLAN] = { - .param = { .name = "ice_dynflag_proto_xtr_vlan" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_vlan_mask }, - [PROTO_XTR_IPV4] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv4" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv4_mask }, - [PROTO_XTR_IPV6] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv6" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_mask }, - [PROTO_XTR_IPV6_FLOW] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv6_flow" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask }, - [PROTO_XTR_TCP] = { - .param = { .name = "ice_dynflag_proto_xtr_tcp" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_tcp_mask }, - [PROTO_XTR_IP_OFFSET] = { - .param = { .name = "ice_dynflag_proto_xtr_ip_offset" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ip_offset_mask }, -}; - #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100 #define ICE_OS_DEFAULT_PKG_NAME"ICE OS Default Package" @@ -542,7 +506,7 @@ handle_proto_xtr_arg(__rte_unused const char *key, const char *value, } static void -ice_check_proto_xtr_support(struct ice_hw *hw) +ice_check_proto_xtr_support(struct ice_pf *pf, struct ice_hw *hw) { #define FLX_REG(val, fld, idx) \ (((val) & GLFLXP_RXDID_FLX_WRD_##idx##_##fld##_M) >> \ @@ -587,7 +551,7 @@ ice_check_proto_xtr_support(struct ice_hw *hw) if (FLX_REG(v, PROT_MDID, 4) == xtr_sets[i].protid_0 && FLX_REG(v, RXDID_OPCODE, 4) == xtr_sets[i].opcode) - ice_proto_xtr_hw_support[i] = true; + pf->hw_proto_xtr_ena[i] = 1; } if (xtr_sets[i].protid_1 != ICE_PROT_ID_INVAL) { @@ -595,7 +559,7 @@ ice_check_proto_xtr_support(struct ice_hw *hw) if (FLX_REG(v, PROT_MDID, 5) == xtr_sets[i].protid_1 && FLX_REG(v, RXDID_OPCODE, 5) == xtr_sets[i].opcode) - ice_proto_xtr_hw_support[i] = true; + pf->hw_proto_xtr_ena[i] = 1; } } } @@ -1429,9 +1393,6 @@ ice_init_proto_xtr(struct rte_eth_dev *dev) ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct ice_hw *hw = ICE_PF_TO_HW(pf); - const struct proto_xtr_ol_flag *ol_flag; - bool proto_xtr_enable = false; - int offset; uint16_t i; pf->proto_xtr = rte_zmalloc(NULL, pf->lan_nb_qps, 0); @@ -1440,65 +1401,20 @@ ice_init_proto_xtr(struct rte_eth_dev *dev) return; } + ice_check_proto_xtr_support(pf, hw); + for (i = 0; i < pf->lan_nb_qps; i++) { pf-
[dpdk-dev] [PATCH v2] net/ice: refactor the protocol extraction design
Change the protocol extraction dynamic mbuf usage from regiser API to lookup API, so the application can decide to read the metadata or not at the run time, in other words, PMD will check this at Rx queue start time. This design makes the API simple now: it just needs to export the name string, not the whole dynamic mbuf data objects. Signed-off-by: Haiyue Wang --- v2: update the commit message, doc; and add the error handling for dynamic mbuf lookup. Also keep the metadata format defination. --- doc/guides/nics/ice.rst | 16 ++-- drivers/net/ice/ice_ethdev.c | 117 +-- drivers/net/ice/ice_ethdev.h | 1 + drivers/net/ice/ice_rxtx.c| 62 drivers/net/ice/ice_rxtx.h| 1 + drivers/net/ice/rte_pmd_ice.h | 171 +++--- drivers/net/ice/version.map | 13 --- 7 files changed, 106 insertions(+), 275 deletions(-) diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index a2aea12333..9878b665b3 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -156,19 +156,17 @@ Runtime Config Options +++ | IPHDR2 | IPHDR1 | +++ - | IPv6 HDR Offset | IPv4 HDR Offset | + | Reserved | IP Header Offset | +++ - IPHDR1 - Outer/Single IPv4 Header offset. + IPHDR1 - Outer/Single IPv4/IPv6 Header offset. - IPHDR2 - Outer/Single IPv6 Header offset. + IPHDR2 - Reserved. - Use ``rte_net_ice_dynf_proto_xtr_metadata_get`` to access the protocol - extraction metadata, and use ``RTE_PKT_RX_DYNF_PROTO_XTR_*`` to get the - metadata type of ``struct rte_mbuf::ol_flags``. - - The ``rte_net_ice_dump_proto_xtr_metadata`` routine shows how to - access the protocol extraction result in ``struct rte_mbuf``. + The dynamic mbuf field for metadata uses "rte_pmd_dynfield_proto_xtr_metadata" + name with 4 byte size. And the related dynamic mbuf flag uses the name format + "rte_pmd_dynflag_proto_xtr_*" which ends with the protocol extraction devargs + name such as "ip_offset". Driver compilation and testing -- diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 51b99c6506..9e7d71ae4d 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -32,42 +32,6 @@ static const char * const ice_valid_args[] = { NULL }; -static const struct rte_mbuf_dynfield ice_proto_xtr_metadata_param = { - .name = "ice_dynfield_proto_xtr_metadata", - .size = sizeof(uint32_t), - .align = __alignof__(uint32_t), - .flags = 0, -}; - -struct proto_xtr_ol_flag { - const struct rte_mbuf_dynflag param; - uint64_t *ol_flag; - bool required; -}; - -static bool ice_proto_xtr_hw_support[PROTO_XTR_MAX]; - -static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = { - [PROTO_XTR_VLAN] = { - .param = { .name = "ice_dynflag_proto_xtr_vlan" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_vlan_mask }, - [PROTO_XTR_IPV4] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv4" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv4_mask }, - [PROTO_XTR_IPV6] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv6" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_mask }, - [PROTO_XTR_IPV6_FLOW] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv6_flow" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask }, - [PROTO_XTR_TCP] = { - .param = { .name = "ice_dynflag_proto_xtr_tcp" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_tcp_mask }, - [PROTO_XTR_IP_OFFSET] = { - .param = { .name = "ice_dynflag_proto_xtr_ip_offset" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ip_offset_mask }, -}; - #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100 #define ICE_OS_DEFAULT_PKG_NAME"ICE OS Default Package" @@ -542,7 +506,7 @@ handle_proto_xtr_arg(__rte_unused const char *key, const char *value, } static void -ice_check_proto_xtr_support(struct ice_hw *hw) +ice_check_proto_xtr_support(struct ice_pf *pf, struct ice_hw *hw) { #define FLX_REG(val, fld, idx) \ (((val) & GLFLXP_RXDID_FLX_WRD_##idx##_##fld##_M) >> \ @@ -587,7 +551,7 @@ ice_check_proto_xtr_support(struct ice_hw *hw) if (FLX_REG(v, PROT_MDID, 4) == xtr_sets[i].protid_0 && FLX_REG(v, RXDID_OPCODE, 4) == xtr_sets[i].opcode) - ice_p
[dpdk-dev] [PATCH v3] net/ice: refactor the protocol extraction design
Change the protocol extraction dynamic mbuf usage from register API to lookup API, so the application can decide to read the metadata or not at the run time, in other words, PMD will check this at Rx queue start time. This design makes the API simple now: it just needs to export the name string, not the whole dynamic mbuf data objects. Signed-off-by: Haiyue Wang --- v3: Fix 'regiser' typo in commit message. v2: update the commit message, doc; and add the error handling for dynamic mbuf lookup. Also keep the metadata format defination. --- doc/guides/nics/ice.rst | 16 ++-- drivers/net/ice/ice_ethdev.c | 117 +-- drivers/net/ice/ice_ethdev.h | 1 + drivers/net/ice/ice_rxtx.c| 62 drivers/net/ice/ice_rxtx.h| 1 + drivers/net/ice/rte_pmd_ice.h | 171 +++--- drivers/net/ice/version.map | 13 --- 7 files changed, 106 insertions(+), 275 deletions(-) diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst index a2aea12333..9878b665b3 100644 --- a/doc/guides/nics/ice.rst +++ b/doc/guides/nics/ice.rst @@ -156,19 +156,17 @@ Runtime Config Options +++ | IPHDR2 | IPHDR1 | +++ - | IPv6 HDR Offset | IPv4 HDR Offset | + | Reserved | IP Header Offset | +++ - IPHDR1 - Outer/Single IPv4 Header offset. + IPHDR1 - Outer/Single IPv4/IPv6 Header offset. - IPHDR2 - Outer/Single IPv6 Header offset. + IPHDR2 - Reserved. - Use ``rte_net_ice_dynf_proto_xtr_metadata_get`` to access the protocol - extraction metadata, and use ``RTE_PKT_RX_DYNF_PROTO_XTR_*`` to get the - metadata type of ``struct rte_mbuf::ol_flags``. - - The ``rte_net_ice_dump_proto_xtr_metadata`` routine shows how to - access the protocol extraction result in ``struct rte_mbuf``. + The dynamic mbuf field for metadata uses "rte_pmd_dynfield_proto_xtr_metadata" + name with 4 byte size. And the related dynamic mbuf flag uses the name format + "rte_pmd_dynflag_proto_xtr_*" which ends with the protocol extraction devargs + name such as "ip_offset". Driver compilation and testing -- diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 51b99c6506..9e7d71ae4d 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -32,42 +32,6 @@ static const char * const ice_valid_args[] = { NULL }; -static const struct rte_mbuf_dynfield ice_proto_xtr_metadata_param = { - .name = "ice_dynfield_proto_xtr_metadata", - .size = sizeof(uint32_t), - .align = __alignof__(uint32_t), - .flags = 0, -}; - -struct proto_xtr_ol_flag { - const struct rte_mbuf_dynflag param; - uint64_t *ol_flag; - bool required; -}; - -static bool ice_proto_xtr_hw_support[PROTO_XTR_MAX]; - -static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = { - [PROTO_XTR_VLAN] = { - .param = { .name = "ice_dynflag_proto_xtr_vlan" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_vlan_mask }, - [PROTO_XTR_IPV4] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv4" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv4_mask }, - [PROTO_XTR_IPV6] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv6" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_mask }, - [PROTO_XTR_IPV6_FLOW] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv6_flow" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask }, - [PROTO_XTR_TCP] = { - .param = { .name = "ice_dynflag_proto_xtr_tcp" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_tcp_mask }, - [PROTO_XTR_IP_OFFSET] = { - .param = { .name = "ice_dynflag_proto_xtr_ip_offset" }, - .ol_flag = &rte_net_ice_dynflag_proto_xtr_ip_offset_mask }, -}; - #define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100 #define ICE_OS_DEFAULT_PKG_NAME"ICE OS Default Package" @@ -542,7 +506,7 @@ handle_proto_xtr_arg(__rte_unused const char *key, const char *value, } static void -ice_check_proto_xtr_support(struct ice_hw *hw) +ice_check_proto_xtr_support(struct ice_pf *pf, struct ice_hw *hw) { #define FLX_REG(val, fld, idx) \ (((val) & GLFLXP_RXDID_FLX_WRD_##idx##_##fld##_M) >> \ @@ -587,7 +551,7 @@ ice_check_proto_xtr_support(struct ice_hw *hw) if (FLX_REG(v, PROT_MDID, 4) == xtr_sets[i].protid_0 && FLX_REG(v, RXDID
[dpdk-dev] [PATCH v4] net/ice: rename the dynamic mbuf name
Rename the dynamic mbuf name to 'intel_pmd_xxx' format, so that the Intel PMD which has the protocol extraction feature will share the same dynamic field/flags space in mbuf. Signed-off-by: Haiyue Wang --- v4: "who register, who use", even the PMD has the duplicated code with different name space, the defined API will help the application to focus on the function itself that the PMD provides. v3: Fix 'regiser' typo in commit message. v2: update the commit message, doc; and add the error handling for dynamic mbuf lookup. Also keep the metadata format defination. --- drivers/net/ice/ice_ethdev.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 3483f99897..d51f3faba4 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -33,7 +33,7 @@ static const char * const ice_valid_args[] = { }; static const struct rte_mbuf_dynfield ice_proto_xtr_metadata_param = { - .name = "ice_dynfield_proto_xtr_metadata", + .name = "intel_pmd_dynfield_proto_xtr_metadata", .size = sizeof(uint32_t), .align = __alignof__(uint32_t), .flags = 0, @@ -49,22 +49,22 @@ static bool ice_proto_xtr_hw_support[PROTO_XTR_MAX]; static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = { [PROTO_XTR_VLAN] = { - .param = { .name = "ice_dynflag_proto_xtr_vlan" }, + .param = { .name = "intel_pmd_dynflag_proto_xtr_vlan" }, .ol_flag = &rte_net_ice_dynflag_proto_xtr_vlan_mask }, [PROTO_XTR_IPV4] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv4" }, + .param = { .name = "intel_pmd_dynflag_proto_xtr_ipv4" }, .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv4_mask }, [PROTO_XTR_IPV6] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv6" }, + .param = { .name = "intel_pmd_dynflag_proto_xtr_ipv6" }, .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_mask }, [PROTO_XTR_IPV6_FLOW] = { - .param = { .name = "ice_dynflag_proto_xtr_ipv6_flow" }, + .param = { .name = "intel_pmd_dynflag_proto_xtr_ipv6_flow" }, .ol_flag = &rte_net_ice_dynflag_proto_xtr_ipv6_flow_mask }, [PROTO_XTR_TCP] = { - .param = { .name = "ice_dynflag_proto_xtr_tcp" }, + .param = { .name = "intel_pmd_dynflag_proto_xtr_tcp" }, .ol_flag = &rte_net_ice_dynflag_proto_xtr_tcp_mask }, [PROTO_XTR_IP_OFFSET] = { - .param = { .name = "ice_dynflag_proto_xtr_ip_offset" }, + .param = { .name = "intel_pmd_dynflag_proto_xtr_ip_offset" }, .ol_flag = &rte_net_ice_dynflag_proto_xtr_ip_offset_mask }, }; -- 2.29.0
[dpdk-dev] [PATCH v1] net/ice: fix DCF Rx segmentation fault
The initialization for the handler of Rx FlexiMD fields extraction into mbuf is missed, it will cause segmentation fault (core dumped). Fixes: 7a340b0b4e03 ("net/ice: refactor Rx FlexiMD handling") Reported-by: Alvin Zhang Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_dcf.c | 1 + drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.h | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index d20e2b3f48..44dbd3bb84 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -899,6 +899,7 @@ ice_dcf_configure_queues(struct ice_dcf_hw *hw) return -EINVAL; } #endif + ice_select_rxd_to_pkt_fields_handler(rxq[i], vc_qp->rxq.rxdid); } memset(&args, 0, sizeof(args)); diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index f6291894cd..860ffb7f67 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -148,7 +148,7 @@ ice_rxd_to_pkt_fields_by_comms_aux_v2(struct ice_rx_queue *rxq, #endif } -static void +void ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, uint32_t rxdid) { switch (rxdid) { diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index 23409d479a..6b16716063 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -234,6 +234,8 @@ int ice_rx_descriptor_status(void *rx_queue, uint16_t offset); int ice_tx_descriptor_status(void *tx_queue, uint16_t offset); void ice_set_default_ptype_table(struct rte_eth_dev *dev); const uint32_t *ice_dev_supported_ptypes_get(struct rte_eth_dev *dev); +void ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, + uint32_t rxdid); int ice_rx_vec_dev_check(struct rte_eth_dev *dev); int ice_tx_vec_dev_check(struct rte_eth_dev *dev); -- 2.29.0
[dpdk-dev] [PATCH v2] net/ice: fix DCF Rx segmentation fault
The initialization of selecting the handler for scalar Rx path FlexiMD fields extraction into mbuf is missed, it will cause segmentation fault (core dumped). Also add the missed support to handle RXDID 16, which has RSS hash value on Qword 1. Fixes: 7a340b0b4e03 ("net/ice: refactor Rx FlexiMD handling") Reported-by: Alvin Zhang Signed-off-by: Haiyue Wang --- v2: The RSS hash is wrong, fix it. --- drivers/net/ice/ice_dcf.c | 1 + drivers/net/ice/ice_rxtx.c | 28 +++- drivers/net/ice/ice_rxtx.h | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index d20e2b3f48..44dbd3bb84 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -899,6 +899,7 @@ ice_dcf_configure_queues(struct ice_dcf_hw *hw) return -EINVAL; } #endif + ice_select_rxd_to_pkt_fields_handler(rxq[i], vc_qp->rxq.rxdid); } memset(&args, 0, sizeof(args)); diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index f6291894cd..1bac643125 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -43,6 +43,28 @@ ice_proto_xtr_type_to_rxdid(uint8_t xtr_type) rxdid_map[xtr_type] : ICE_RXDID_COMMS_OVS; } +static inline void +ice_rxd_to_pkt_fields_by_comms_generic(__rte_unused struct ice_rx_queue *rxq, + struct rte_mbuf *mb, + volatile union ice_rx_flex_desc *rxdp) +{ + volatile struct ice_32b_rx_flex_desc_comms *desc = + (volatile struct ice_32b_rx_flex_desc_comms *)rxdp; + uint16_t stat_err = rte_le_to_cpu_16(desc->status_error0); + + if (likely(stat_err & (1 << ICE_RX_FLEX_DESC_STATUS0_RSS_VALID_S))) { + mb->ol_flags |= PKT_RX_RSS_HASH; + mb->hash.rss = rte_le_to_cpu_32(desc->rss_hash); + } + +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + if (desc->flow_id != 0x) { + mb->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID; + mb->hash.fdir.hi = rte_le_to_cpu_32(desc->flow_id); + } +#endif +} + static inline void ice_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct ice_rx_queue *rxq, struct rte_mbuf *mb, @@ -148,7 +170,7 @@ ice_rxd_to_pkt_fields_by_comms_aux_v2(struct ice_rx_queue *rxq, #endif } -static void +void ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, uint32_t rxdid) { switch (rxdid) { @@ -182,6 +204,10 @@ ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, uint32_t rxdid) rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_aux_v2; break; + case ICE_RXDID_COMMS_GENERIC: + rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_generic; + break; + case ICE_RXDID_COMMS_OVS: rxq->rxd_to_pkt_fields = ice_rxd_to_pkt_fields_by_comms_ovs; break; diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index 23409d479a..6b16716063 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -234,6 +234,8 @@ int ice_rx_descriptor_status(void *rx_queue, uint16_t offset); int ice_tx_descriptor_status(void *tx_queue, uint16_t offset); void ice_set_default_ptype_table(struct rte_eth_dev *dev); const uint32_t *ice_dev_supported_ptypes_get(struct rte_eth_dev *dev); +void ice_select_rxd_to_pkt_fields_handler(struct ice_rx_queue *rxq, + uint32_t rxdid); int ice_rx_vec_dev_check(struct rte_eth_dev *dev); int ice_tx_vec_dev_check(struct rte_eth_dev *dev); -- 2.29.0
[dpdk-dev] [PATCH v1] net/i40e: perform basic validation on the VF messages
Do the VF message basic validation such as OPCODE message length check, some special OPCODE message format check, to protect the i40e PMD from malicious VF message attack. Fixes: 4861cde46116 ("i40e: new poll mode driver") Signed-off-by: Haiyue Wang --- drivers/net/i40e/i40e_pf.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 092e0d3..d6e83e3 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -1295,6 +1295,7 @@ uint16_t vf_id = abs_vf_id - hw->func_caps.vf_base_id; struct rte_pmd_i40e_mb_event_param ret_param; bool b_op = TRUE; + int ret; if (vf_id > pf->vf_num - 1 || !pf->vfs) { PMD_DRV_LOG(ERR, "invalid argument"); @@ -1309,6 +1310,30 @@ return; } + /* perform basic checks on the msg */ + ret = virtchnl_vc_validate_vf_msg(&vf->version, opcode, msg, msglen); + + /* perform additional checks specific to this driver */ + if (opcode == VIRTCHNL_OP_CONFIG_RSS_KEY) { + struct virtchnl_rss_key *vrk = (struct virtchnl_rss_key *)msg; + + if (vrk->key_len != ((I40E_PFQF_HKEY_MAX_INDEX + 1) * 4)) + ret = VIRTCHNL_ERR_PARAM; + } else if (opcode == VIRTCHNL_OP_CONFIG_RSS_LUT) { + struct virtchnl_rss_lut *vrl = (struct virtchnl_rss_lut *)msg; + + if (vrl->lut_entries != ((I40E_VFQF_HLUT1_MAX_INDEX + 1) * 4)) + ret = VIRTCHNL_ERR_PARAM; + } + + if (ret) { + PMD_DRV_LOG(ERR, "Invalid message from VF %u, opcode %u, len %u", + vf_id, opcode, msglen); + i40e_pf_host_send_msg_to_vf(vf, opcode, + I40E_ERR_PARAM, NULL, 0); + return; + } + /** * initialise structure to send to user application * will return response from user in retval field -- 1.8.3.1
[dpdk-dev] [PATCH v1] net/avf: fix DEBUG_DUMP_DESC causing build issue
Add the missed 'volatile' keyword to avoid the warning for type mismatch, which will be treated as compiler error if WERROR_FLAGS is enabled. Fixes: bfd38e4d708b ("net/avf: fix missing compiler error flags") CC: sta...@dpdk.org Signed-off-by: Haiyue Wang --- drivers/net/avf/avf_rxtx.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/avf/avf_rxtx.h b/drivers/net/avf/avf_rxtx.h index c4120f8..898d2f3 100644 --- a/drivers/net/avf/avf_rxtx.h +++ b/drivers/net/avf/avf_rxtx.h @@ -201,17 +201,17 @@ uint16_t avf_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, static inline void avf_dump_rx_descriptor(struct avf_rx_queue *rxq, - const void *desc, + const volatile void *desc, uint16_t rx_id) { #ifdef RTE_LIBRTE_AVF_16BYTE_RX_DESC - const union avf_16byte_rx_desc *rx_desc = desc; + const volatile union avf_16byte_rx_desc *rx_desc = desc; printf("Queue %d Rx_desc %d: QW0: 0x%016"PRIx64" QW1: 0x%016"PRIx64"\n", rxq->queue_id, rx_id, rx_desc->read.pkt_addr, rx_desc->read.hdr_addr); #else - const union avf_32byte_rx_desc *rx_desc = desc; + const volatile union avf_32byte_rx_desc *rx_desc = desc; printf("Queue %d Rx_desc %d: QW0: 0x%016"PRIx64" QW1: 0x%016"PRIx64 " QW2: 0x%016"PRIx64" QW3: 0x%016"PRIx64"\n", rxq->queue_id, @@ -225,10 +225,10 @@ void avf_dump_rx_descriptor(struct avf_rx_queue *rxq, */ static inline void avf_dump_tx_descriptor(const struct avf_tx_queue *txq, - const void *desc, uint16_t tx_id) + const volatile void *desc, uint16_t tx_id) { const char *name; - const struct avf_tx_desc *tx_desc = desc; + const volatile struct avf_tx_desc *tx_desc = desc; enum avf_tx_desc_dtype_value type; type = (enum avf_tx_desc_dtype_value)rte_le_to_cpu_64( -- 1.8.3.1
[dpdk-dev] [PATCH v1] net/i40e: enable the loopback function if it is X722 MAC
In FVL, there was an issue and it didn't support the loopback function before FW 5.0. For FPK (X722) it should work. So it needs to distinguish between the devices by checking MAC type. Fixes: 689bba33272d (i40e: add VEB switching support) Fixes: bce83974ba2c (net/i40e: set Tx loopback from PF) Signed-off-by: Haiyue Wang --- drivers/net/i40e/i40e_ethdev.c | 4 ++-- drivers/net/i40e/rte_pmd_i40e.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index f7a685c8c..ed5cd9c59 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -5371,7 +5371,7 @@ i40e_enable_pf_lb(struct i40e_pf *pf) int ret; /* Use the FW API if FW >= v5.0 */ - if (hw->aq.fw_maj_ver < 5) { + if (hw->aq.fw_maj_ver < 5 && hw->mac.type != I40E_MAC_X722) { PMD_INIT_LOG(ERR, "FW < v5.0, cannot enable loopback"); return; } @@ -5642,7 +5642,7 @@ i40e_vsi_setup(struct i40e_pf *pf, ctxt.flags = I40E_AQ_VSI_TYPE_VF; /* Use the VEB configuration if FW >= v5.0 */ - if (hw->aq.fw_maj_ver >= 5) { + if (hw->aq.fw_maj_ver >= 5 || hw->mac.type == I40E_MAC_X722) { /* Configure switch ID */ ctxt.info.valid_sections |= rte_cpu_to_le_16(I40E_AQ_VSI_PROP_SWITCH_VALID); diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index bba62b1c5..7ce5d02fa 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -338,7 +338,7 @@ i40e_vsi_set_tx_loopback(struct i40e_vsi *vsi, uint8_t on) hw = I40E_VSI_TO_HW(vsi); /* Use the FW API if FW >= v5.0 */ - if (hw->aq.fw_maj_ver < 5) { + if (hw->aq.fw_maj_ver < 5 && hw->mac.type != I40E_MAC_X722) { PMD_INIT_LOG(ERR, "FW < v5.0, cannot enable loopback"); return -ENOTSUP; } -- 2.17.1
[dpdk-dev] [PATCH v3] net/i40e: workaround for Fortville performance
The GL_SWR_PM_UP_THR value is not impacted from the link speed, its value is set according to the total number of ports for a better pipe-monitor configuration. All bellowing relevant device IDs are considered (NICs, LOMs, Mezz and Backplane): Device-ID ValueComments 0x1572 0x03030303 10G SFI 0x1581 0x03030303 10G Backplane 0x1586 0x03030303 10G BaseT 0x1589 0x03030303 10G BaseT (FortPond) 0x1580 0x06060606 40G Backplane 0x1583 0x06060606 2x40G QSFP 0x1584 0x06060606 1x40G QSFP 0x1587 0x06060606 20G Backplane (HP) 0x1588 0x06060606 20G KR2 (HP) 0x158A 0x06060606 25G Backplane 0x158B 0x06060606 25G SFP28 Fixes: c9223a2bf53c ("i40e: workaround for XL710 performance") Fixes: 75d133dd3296 ("net/i40e: enable 25G device") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- v2 -> v3: - Change the return type of i40e_get_swr_pm_cfg from int to bool. v1 -> v2: - The GL_SWR_PM_UP_THR register size is 4B, so change the table value type from uint64_t to uint32_t to reduce the table size. - Fix two CAMELCASE coding style errors. --- drivers/net/i40e/i40e_ethdev.c | 71 +- 1 file changed, 64 insertions(+), 7 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 13c5d32..ef17de8 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -10003,6 +10003,60 @@ i40e_pctype_to_flowtype(const struct i40e_adapter *adapter, #define I40E_GL_SWR_PM_UP_THR_SF_VALUE 0x06060606 #define I40E_GL_SWR_PM_UP_THR0x269FBC +/* + * GL_SWR_PM_UP_THR: + * The value is not impacted from the link speed, its value is set according + * to the total number of ports for a better pipe-monitor configuration. + */ +static bool +i40e_get_swr_pm_cfg(struct i40e_hw *hw, uint32_t *value) +{ +#define I40E_GL_SWR_PM_EF_DEVICE(dev) \ + .device_id = (dev), \ + .val = I40E_GL_SWR_PM_UP_THR_EF_VALUE + +#define I40E_GL_SWR_PM_SF_DEVICE(dev) \ + .device_id = (dev), \ + .val = I40E_GL_SWR_PM_UP_THR_SF_VALUE + + static const struct { + uint16_t device_id; + uint32_t val; + } swr_pm_table[] = { + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_SFP_XL710) }, + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_KX_C) }, + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_10G_BASE_T) }, + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_10G_BASE_T4) }, + + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_KX_B) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_QSFP_A) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_QSFP_B) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_20G_KR2) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_20G_KR2_A) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_25G_B) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_25G_SFP28) }, + }; + uint32_t i; + + if (value == NULL) { + PMD_DRV_LOG(ERR, "value is NULL"); + return false; + } + + for (i = 0; i < RTE_DIM(swr_pm_table); i++) { + if (hw->device_id == swr_pm_table[i].device_id) { + *value = swr_pm_table[i].val; + + PMD_DRV_LOG(DEBUG, "Device 0x%x with GL_SWR_PM_UP_THR " + "value - 0x%08x", + hw->device_id, *value); + return true; + } + } + + return false; +} + static int i40e_dev_sync_phy_type(struct i40e_hw *hw) { @@ -10067,13 +10121,16 @@ i40e_configure_registers(struct i40e_hw *hw) } if (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR) { - if (I40E_PHY_TYPE_SUPPORT_40G(hw->phy.phy_types) || /* For XL710 */ - I40E_PHY_TYPE_SUPPORT_25G(hw->phy.phy_types)) /* For XXV710 */ - reg_table[i].val = - I40E_GL_SWR_PM_UP_THR_SF_VALUE; - else /* For X710 */ - reg_table[i].val = - I40E_GL_SWR_PM_UP_THR_EF_VALUE; + uint32_t cfg_val; + + if (!i40e_get_swr_pm_cfg(hw, &cfg_val)) { + PMD_DRV_LOG(DEBUG, "Device 0x%x skips " + "GL_SWR_PM_UP_THR value fixup", + hw->device_id); + continue; + } + + reg_table[i].val = cfg_val; } ret = i40e_aq_debug_read_register(hw, reg_table[i].addr, -- 2.7.4
[dpdk-dev] [PATCH v1] mbuf: fix RTE_ETH_IS_IPV6_HDR comment typo
It should be IPv6, not IPv4. Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- lib/librte_mbuf/rte_mbuf_ptype.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h index 79ea314..01acc66 100644 --- a/lib/librte_mbuf/rte_mbuf_ptype.h +++ b/lib/librte_mbuf/rte_mbuf_ptype.h @@ -653,9 +653,9 @@ extern "C" { #define RTE_ETH_IS_IPV4_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV4) /** - * Check if the (outer) L3 header is IPv4. To avoid comparing IPv4 types one by - * one, bit 6 is selected to be used for IPv4 only. Then checking bit 6 can - * determine if it is an IPV4 packet. + * Check if the (outer) L3 header is IPv6. To avoid comparing IPv6 types one by + * one, bit 6 is selected to be used for IPv6 only. Then checking bit 6 can + * determine if it is an IPV6 packet. */ #define RTE_ETH_IS_IPV6_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV6) -- 2.7.4
[dpdk-dev] [PATCH v1] net/i40e: workaround for Fortville performance
The GL_SWR_PM_UP_THR value is not impacted from the link speed, its value is set according to the total number of ports for a better pipe-monitor configuration. All bellowing relevant device IDs are considered (NICs, LOMs, Mezz and Backplane): Device-ID ValueComments 0x1572 0x03030303 10G SFI 0x1581 0x03030303 10G Backplane 0x1586 0x03030303 10G BaseT 0x1589 0x03030303 10G BaseT (FortPond) 0x1580 0x06060606 40G Backplane 0x1583 0x06060606 2x40G QSFP 0x1584 0x06060606 1x40G QSFP 0x1587 0x06060606 20G Backplane (HP) 0x1588 0x06060606 20G KR2 (HP) 0x158A 0x06060606 25G Backplane 0x158B 0x06060606 25G SFP28 Fixes: c9223a2bf53c ("i40e: workaround for XL710 performance") Fixes: 75d133dd3296 ("net/i40e: enable 25G device") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- drivers/net/i40e/i40e_ethdev.c | 71 +- 1 file changed, 64 insertions(+), 7 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7d4f1c9..04a2056 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -10003,6 +10003,60 @@ enum i40e_filter_pctype #define I40E_GL_SWR_PM_UP_THR_SF_VALUE 0x06060606 #define I40E_GL_SWR_PM_UP_THR0x269FBC +/* + * GL_SWR_PM_UP_THR: + * The value is not impacted from the link speed, its value is set according + * to the total number of ports for a better pipe-monitor configuration. + */ +static int +i40e_get_swr_pm_cfg(struct i40e_hw *hw, uint64_t *value) +{ +#define I40E_GL_SWR_PM_EF_DEVICE(dev) \ + .device_id = (dev), \ + .val = I40E_GL_SWR_PM_UP_THR_EF_VALUE + +#define I40E_GL_SWR_PM_SF_DEVICE(dev) \ + .device_id = (dev), \ + .val = I40E_GL_SWR_PM_UP_THR_SF_VALUE + + static const struct { + uint16_t device_id; + uint64_t val; + } swr_pm_table[] = { + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_SFP_XL710) }, + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_KX_C) }, + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_10G_BASE_T) }, + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_10G_BASE_T4) }, + + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_KX_B) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_QSFP_A) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_QSFP_B) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_20G_KR2) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_20G_KR2_A) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_25G_B) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_25G_SFP28) }, + }; + uint32_t i; + + if (value == NULL) { + PMD_DRV_LOG(ERR, "value is NULL"); + return 0; + } + + for (i = 0; i < RTE_DIM(swr_pm_table); i++) { + if (hw->device_id == swr_pm_table[i].device_id) { + *value = swr_pm_table[i].val; + + PMD_DRV_LOG(DEBUG, "Device 0x%" PRIx16 " with " + "GL_SWR_PM_UP_THR setting to 0x%" PRIx64, + hw->device_id, *value); + return 1; + } + } + + return 0; +} + static int i40e_dev_sync_phy_type(struct i40e_hw *hw) { @@ -10067,13 +10121,16 @@ enum i40e_filter_pctype } if (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR) { - if (I40E_PHY_TYPE_SUPPORT_40G(hw->phy.phy_types) || /* For XL710 */ - I40E_PHY_TYPE_SUPPORT_25G(hw->phy.phy_types)) /* For XXV710 */ - reg_table[i].val = - I40E_GL_SWR_PM_UP_THR_SF_VALUE; - else /* For X710 */ - reg_table[i].val = - I40E_GL_SWR_PM_UP_THR_EF_VALUE; + uint64_t cfg_val; + + if (!i40e_get_swr_pm_cfg(hw, &cfg_val)) { + PMD_DRV_LOG(DEBUG, "Device 0x%" PRIx16 "skips " + "GL_SWR_PM_UP_THR setting", + hw->device_id); + continue; + } + + reg_table[i].val = cfg_val; } ret = i40e_aq_debug_read_register(hw, reg_table[i].addr, -- 1.8.3.1
[dpdk-dev] [PATCH v2] net/i40e: workaround for Fortville performance
The GL_SWR_PM_UP_THR value is not impacted from the link speed, its value is set according to the total number of ports for a better pipe-monitor configuration. All bellowing relevant device IDs are considered (NICs, LOMs, Mezz and Backplane): Device-ID ValueComments 0x1572 0x03030303 10G SFI 0x1581 0x03030303 10G Backplane 0x1586 0x03030303 10G BaseT 0x1589 0x03030303 10G BaseT (FortPond) 0x1580 0x06060606 40G Backplane 0x1583 0x06060606 2x40G QSFP 0x1584 0x06060606 1x40G QSFP 0x1587 0x06060606 20G Backplane (HP) 0x1588 0x06060606 20G KR2 (HP) 0x158A 0x06060606 25G Backplane 0x158B 0x06060606 25G SFP28 Fixes: c9223a2bf53c ("i40e: workaround for XL710 performance") Fixes: 75d133dd3296 ("net/i40e: enable 25G device") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- drivers/net/i40e/i40e_ethdev.c | 71 +- 1 file changed, 64 insertions(+), 7 deletions(-) --- v1 -> v2: - The GL_SWR_PM_UP_THR register size is 4B, so change the table value type from uint64_t to uint32_t to reduce the table size. - Fix two CAMELCASE coding style errors. diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7d4f1c9..95274f3 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -10003,6 +10003,60 @@ enum i40e_filter_pctype #define I40E_GL_SWR_PM_UP_THR_SF_VALUE 0x06060606 #define I40E_GL_SWR_PM_UP_THR0x269FBC +/* + * GL_SWR_PM_UP_THR: + * The value is not impacted from the link speed, its value is set according + * to the total number of ports for a better pipe-monitor configuration. + */ +static int +i40e_get_swr_pm_cfg(struct i40e_hw *hw, uint32_t *value) +{ +#define I40E_GL_SWR_PM_EF_DEVICE(dev) \ + .device_id = (dev), \ + .val = I40E_GL_SWR_PM_UP_THR_EF_VALUE + +#define I40E_GL_SWR_PM_SF_DEVICE(dev) \ + .device_id = (dev), \ + .val = I40E_GL_SWR_PM_UP_THR_SF_VALUE + + static const struct { + uint16_t device_id; + uint32_t val; + } swr_pm_table[] = { + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_SFP_XL710) }, + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_KX_C) }, + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_10G_BASE_T) }, + { I40E_GL_SWR_PM_EF_DEVICE(I40E_DEV_ID_10G_BASE_T4) }, + + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_KX_B) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_QSFP_A) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_QSFP_B) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_20G_KR2) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_20G_KR2_A) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_25G_B) }, + { I40E_GL_SWR_PM_SF_DEVICE(I40E_DEV_ID_25G_SFP28) }, + }; + uint32_t i; + + if (value == NULL) { + PMD_DRV_LOG(ERR, "value is NULL"); + return 0; + } + + for (i = 0; i < RTE_DIM(swr_pm_table); i++) { + if (hw->device_id == swr_pm_table[i].device_id) { + *value = swr_pm_table[i].val; + + PMD_DRV_LOG(DEBUG, "Device 0x%x with GL_SWR_PM_UP_THR " + "value - 0x%08x", + hw->device_id, *value); + return 1; + } + } + + return 0; +} + static int i40e_dev_sync_phy_type(struct i40e_hw *hw) { @@ -10067,13 +10121,16 @@ enum i40e_filter_pctype } if (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR) { - if (I40E_PHY_TYPE_SUPPORT_40G(hw->phy.phy_types) || /* For XL710 */ - I40E_PHY_TYPE_SUPPORT_25G(hw->phy.phy_types)) /* For XXV710 */ - reg_table[i].val = - I40E_GL_SWR_PM_UP_THR_SF_VALUE; - else /* For X710 */ - reg_table[i].val = - I40E_GL_SWR_PM_UP_THR_EF_VALUE; + uint32_t cfg_val; + + if (!i40e_get_swr_pm_cfg(hw, &cfg_val)) { + PMD_DRV_LOG(DEBUG, "Device 0x%x skips " + "GL_SWR_PM_UP_THR value fixup", + hw->device_id); + continue; + } + + reg_table[i].val = cfg_val; } ret = i40e_aq_debug_read_register(hw, reg_table[i].addr, -- 1.8.3.1
[dpdk-dev] [PATCH v1] net/iavf/base: make the base code as common share
The iavf base code can be shared with iavf, i40evf PMDs, so make it as common share part firstly. Signed-off-by: Haiyue Wang --- drivers/common/Makefile | 5 + drivers/common/iavf/Makefile | 28 + drivers/{net/iavf/base => common/iavf}/README | 0 .../iavf/base => common/iavf}/iavf_adminq.c | 0 .../iavf/base => common/iavf}/iavf_adminq.h | 0 .../base => common/iavf}/iavf_adminq_cmd.h| 0 .../iavf/base => common/iavf}/iavf_alloc.h| 0 .../iavf/base => common/iavf}/iavf_common.c | 0 .../iavf/base => common/iavf}/iavf_devids.h | 0 drivers/common/iavf/iavf_main.c | 114 ++ .../iavf/base => common/iavf}/iavf_osdep.h| 49 ++-- .../base => common/iavf}/iavf_prototype.h | 0 .../iavf/base => common/iavf}/iavf_register.h | 0 .../iavf/base => common/iavf}/iavf_status.h | 0 .../iavf/base => common/iavf}/iavf_type.h | 0 drivers/common/iavf/meson.build | 10 ++ .../common/iavf/rte_common_iavf_version.map | 12 ++ .../{net/iavf/base => common/iavf}/virtchnl.h | 0 drivers/common/meson.build| 2 +- drivers/net/iavf/Makefile | 23 +--- drivers/net/iavf/base/meson.build | 23 drivers/net/iavf/iavf.h | 6 +- drivers/net/iavf/iavf_ethdev.c| 83 - drivers/net/iavf/iavf_rxtx.c | 3 - drivers/net/iavf/iavf_rxtx_vec_avx2.c | 1 - drivers/net/iavf/iavf_rxtx_vec_sse.c | 2 - drivers/net/iavf/iavf_vchnl.c | 5 - drivers/net/iavf/meson.build | 4 +- mk/rte.app.mk | 4 + 29 files changed, 191 insertions(+), 183 deletions(-) create mode 100644 drivers/common/iavf/Makefile rename drivers/{net/iavf/base => common/iavf}/README (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_adminq.c (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_adminq.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_adminq_cmd.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_alloc.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_common.c (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_devids.h (100%) create mode 100644 drivers/common/iavf/iavf_main.c rename drivers/{net/iavf/base => common/iavf}/iavf_osdep.h (76%) rename drivers/{net/iavf/base => common/iavf}/iavf_prototype.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_register.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_status.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_type.h (100%) create mode 100644 drivers/common/iavf/meson.build create mode 100644 drivers/common/iavf/rte_common_iavf_version.map rename drivers/{net/iavf/base => common/iavf}/virtchnl.h (100%) delete mode 100644 drivers/net/iavf/base/meson.build diff --git a/drivers/common/Makefile b/drivers/common/Makefile index 1ff033bba..3254c5274 100644 --- a/drivers/common/Makefile +++ b/drivers/common/Makefile @@ -30,4 +30,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_COMMON_DPAAX),y) DIRS-y += dpaax endif +IAVF-y := $(CONFIG_RTE_LIBRTE_IAVF_PMD) +ifneq (,$(findstring y,$(IAVF-y))) +DIRS-y += iavf +endif + include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/iavf/Makefile b/drivers/common/iavf/Makefile new file mode 100644 index 0..e3b2e7a3c --- /dev/null +++ b/drivers/common/iavf/Makefile @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019 Intel Corporation + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_common_iavf.a + +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-pointer-arith +CFLAGS += -Wno-cast-qual + +EXPORT_MAP := rte_common_iavf_version.map + +# +# all source are stored in SRCS-y +# +SRCS-y += iavf_adminq.c +SRCS-y += iavf_common.c +SRCS-y += iavf_main.c + +LDLIBS += -lrte_eal + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/iavf/base/README b/drivers/common/iavf/README similarity index 100% rename from drivers/net/iavf/base/README rename to drivers/common/iavf/README diff --git a/drivers/net/iavf/base/iavf_adminq.c b/drivers/common/iavf/iavf_adminq.c similarity index 100% rename from drivers/net/iavf/base/iavf_adminq.c rename to drivers/common/iavf/iavf_adminq.c diff --git a/drivers/net/iavf/base/iavf_adminq.h b/drivers/common/iavf/iavf_adminq.h similarity index 100% rename from drivers/net/iavf/base/iavf_adminq.h rename to drivers/common/iavf/iavf_adminq.h diff --git a/drivers/net/iavf/base/iavf_adminq_cmd.h b/drivers/common/iavf/iavf_adminq_cmd.h similarity index 100% rename from drivers/net/iavf/base/iavf_adminq_cmd.h rename to drivers/common/iavf/iavf_adminq_cmd.h diff --git a/drivers/net/iavf/base/iavf_alloc.h b/drivers/common/iavf/iav
[dpdk-dev] [PATCH v1] net/ice: align with MAC address length definition
Use the standand MAC address length definition in PMD's scope. Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 2cbd82c94..80b422a27 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -873,7 +873,7 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) ret = -ENOMEM; goto DONE; } - rte_memcpy(&f->mac_info.mac_addr, mac_addr, ETH_ADDR_LEN); + rte_memcpy(&f->mac_info.mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); TAILQ_INSERT_TAIL(&vsi->mac_list, f, next); vsi->mac_num++; @@ -1662,7 +1662,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) /* MAC configuration */ rte_memcpy(pf->dev_addr.addr_bytes, hw->port_info->mac.perm_addr, - ETH_ADDR_LEN); + RTE_ETHER_ADDR_LEN); rte_memcpy(&mac_addr, &pf->dev_addr, RTE_ETHER_ADDR_LEN); ret = ice_add_mac_filter(vsi, &mac_addr); @@ -3267,7 +3267,7 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "Failed to add mac filter"); return -EIO; } - memcpy(&pf->dev_addr, mac_addr, ETH_ADDR_LEN); + rte_memcpy(&pf->dev_addr, mac_addr, RTE_ETHER_ADDR_LEN); flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL; ret = ice_aq_manage_mac_write(hw, mac_addr->addr_bytes, flags, NULL); -- 2.17.1
[dpdk-dev] [PATCH v2] net/ice: use the copy API to do MAC assignment
Use the fast copy an Ethernet address API to do MAC assignment, instead of calling rte_memcpy function. Signed-off-by: Haiyue Wang --- v2: Update the commit title and message, use the rte_ether_addr_copy API instead of just changing the length definition to make code style clean. drivers/net/ice/ice_ethdev.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 2cbd82c94..d104df26f 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -873,7 +873,7 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) ret = -ENOMEM; goto DONE; } - rte_memcpy(&f->mac_info.mac_addr, mac_addr, ETH_ADDR_LEN); + rte_ether_addr_copy(mac_addr, &f->mac_info.mac_addr); TAILQ_INSERT_TAIL(&vsi->mac_list, f, next); vsi->mac_num++; @@ -1660,16 +1660,16 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) if (type == ICE_VSI_PF) { /* MAC configuration */ - rte_memcpy(pf->dev_addr.addr_bytes, - hw->port_info->mac.perm_addr, - ETH_ADDR_LEN); + rte_ether_addr_copy((struct rte_ether_addr *) + hw->port_info->mac.perm_addr, + &pf->dev_addr); - rte_memcpy(&mac_addr, &pf->dev_addr, RTE_ETHER_ADDR_LEN); + rte_ether_addr_copy(&pf->dev_addr, &mac_addr); ret = ice_add_mac_filter(vsi, &mac_addr); if (ret != ICE_SUCCESS) PMD_INIT_LOG(ERR, "Failed to add dflt MAC filter"); - rte_memcpy(&mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); + rte_ether_addr_copy(&broadcast, &mac_addr); ret = ice_add_mac_filter(vsi, &mac_addr); if (ret != ICE_SUCCESS) PMD_INIT_LOG(ERR, "Failed to add MAC filter"); @@ -3267,7 +3267,7 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "Failed to add mac filter"); return -EIO; } - memcpy(&pf->dev_addr, mac_addr, ETH_ADDR_LEN); + rte_ether_addr_copy(mac_addr, &pf->dev_addr); flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL; ret = ice_aq_manage_mac_write(hw, mac_addr->addr_bytes, flags, NULL); -- 2.17.1
[dpdk-dev] [PATCH v3] net/ice: use the copy API to do MAC assignment
Use the API rte_ether_addr_copy to do MAC assignment, instead of calling rte_memcpy function directly. Signed-off-by: Haiyue Wang --- v3: Update the commit message v2: Update the commit title and message, use the rte_ether_addr_copy API instead of just changing the length definition to make code style clean. drivers/net/ice/ice_ethdev.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 2cbd82c94..d104df26f 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -873,7 +873,7 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) ret = -ENOMEM; goto DONE; } - rte_memcpy(&f->mac_info.mac_addr, mac_addr, ETH_ADDR_LEN); + rte_ether_addr_copy(mac_addr, &f->mac_info.mac_addr); TAILQ_INSERT_TAIL(&vsi->mac_list, f, next); vsi->mac_num++; @@ -1660,16 +1660,16 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) if (type == ICE_VSI_PF) { /* MAC configuration */ - rte_memcpy(pf->dev_addr.addr_bytes, - hw->port_info->mac.perm_addr, - ETH_ADDR_LEN); + rte_ether_addr_copy((struct rte_ether_addr *) + hw->port_info->mac.perm_addr, + &pf->dev_addr); - rte_memcpy(&mac_addr, &pf->dev_addr, RTE_ETHER_ADDR_LEN); + rte_ether_addr_copy(&pf->dev_addr, &mac_addr); ret = ice_add_mac_filter(vsi, &mac_addr); if (ret != ICE_SUCCESS) PMD_INIT_LOG(ERR, "Failed to add dflt MAC filter"); - rte_memcpy(&mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); + rte_ether_addr_copy(&broadcast, &mac_addr); ret = ice_add_mac_filter(vsi, &mac_addr); if (ret != ICE_SUCCESS) PMD_INIT_LOG(ERR, "Failed to add MAC filter"); @@ -3267,7 +3267,7 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "Failed to add mac filter"); return -EIO; } - memcpy(&pf->dev_addr, mac_addr, ETH_ADDR_LEN); + rte_ether_addr_copy(mac_addr, &pf->dev_addr); flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL; ret = ice_aq_manage_mac_write(hw, mac_addr->addr_bytes, flags, NULL); -- 2.17.1
[dpdk-dev] [PATCH v2] net/iavf/base: change the base code as common
Change the iavf base code as driver common library, it is used by iavf PMD now, and it can be used by i40evf PMD in the future. Signed-off-by: Haiyue Wang --- v2: update the commit message, and rename the iavf_main.c to iavf_impl.c drivers/common/Makefile | 5 + drivers/common/iavf/Makefile | 28 + drivers/{net/iavf/base => common/iavf}/README | 1 + .../iavf/base => common/iavf}/iavf_adminq.c | 0 .../iavf/base => common/iavf}/iavf_adminq.h | 0 .../base => common/iavf}/iavf_adminq_cmd.h| 0 .../iavf/base => common/iavf}/iavf_alloc.h| 0 .../iavf/base => common/iavf}/iavf_common.c | 0 .../iavf/base => common/iavf}/iavf_devids.h | 0 drivers/common/iavf/iavf_impl.c | 114 ++ .../iavf/base => common/iavf}/iavf_osdep.h| 50 ++-- .../base => common/iavf}/iavf_prototype.h | 0 .../iavf/base => common/iavf}/iavf_register.h | 0 .../iavf/base => common/iavf}/iavf_status.h | 0 .../iavf/base => common/iavf}/iavf_type.h | 0 drivers/common/iavf/meson.build | 10 ++ .../common/iavf/rte_common_iavf_version.map | 12 ++ .../{net/iavf/base => common/iavf}/virtchnl.h | 0 drivers/common/meson.build| 2 +- drivers/net/iavf/Makefile | 23 +--- drivers/net/iavf/base/meson.build | 23 drivers/net/iavf/iavf.h | 6 +- drivers/net/iavf/iavf_ethdev.c| 83 - drivers/net/iavf/iavf_rxtx.c | 3 - drivers/net/iavf/iavf_rxtx_vec_avx2.c | 1 - drivers/net/iavf/iavf_rxtx_vec_sse.c | 2 - drivers/net/iavf/iavf_vchnl.c | 5 - drivers/net/iavf/meson.build | 4 +- mk/rte.app.mk | 4 + 29 files changed, 192 insertions(+), 184 deletions(-) create mode 100644 drivers/common/iavf/Makefile rename drivers/{net/iavf/base => common/iavf}/README (96%) rename drivers/{net/iavf/base => common/iavf}/iavf_adminq.c (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_adminq.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_adminq_cmd.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_alloc.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_common.c (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_devids.h (100%) create mode 100644 drivers/common/iavf/iavf_impl.c rename drivers/{net/iavf/base => common/iavf}/iavf_osdep.h (75%) rename drivers/{net/iavf/base => common/iavf}/iavf_prototype.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_register.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_status.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_type.h (100%) create mode 100644 drivers/common/iavf/meson.build create mode 100644 drivers/common/iavf/rte_common_iavf_version.map rename drivers/{net/iavf/base => common/iavf}/virtchnl.h (100%) delete mode 100644 drivers/net/iavf/base/meson.build diff --git a/drivers/common/Makefile b/drivers/common/Makefile index 1ff033bba..3254c5274 100644 --- a/drivers/common/Makefile +++ b/drivers/common/Makefile @@ -30,4 +30,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_COMMON_DPAAX),y) DIRS-y += dpaax endif +IAVF-y := $(CONFIG_RTE_LIBRTE_IAVF_PMD) +ifneq (,$(findstring y,$(IAVF-y))) +DIRS-y += iavf +endif + include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/iavf/Makefile b/drivers/common/iavf/Makefile new file mode 100644 index 0..43383e376 --- /dev/null +++ b/drivers/common/iavf/Makefile @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019 Intel Corporation + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_common_iavf.a + +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-pointer-arith +CFLAGS += -Wno-cast-qual + +EXPORT_MAP := rte_common_iavf_version.map + +# +# all source are stored in SRCS-y +# +SRCS-y += iavf_adminq.c +SRCS-y += iavf_common.c +SRCS-y += iavf_impl.c + +LDLIBS += -lrte_eal + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/iavf/base/README b/drivers/common/iavf/README similarity index 96% rename from drivers/net/iavf/base/README rename to drivers/common/iavf/README index e8c49c36f..b78e89bee 100644 --- a/drivers/net/iavf/base/README +++ b/drivers/common/iavf/README @@ -17,3 +17,4 @@ NOTE: The source code in this directory should not be modified apart from the following file(s): iavf_osdep.h +iavf_impl.c diff --git a/drivers/net/iavf/base/iavf_adminq.c b/drivers/common/iavf/iavf_adminq.c similarity index 100% rename from drivers/net/iavf/base/iavf_adminq.c rename to drivers/common/iavf/iavf_adminq.c diff --git a/drivers/net/iavf/base/iavf_adminq.h b/drivers/common/iavf/iavf_adminq.h similarity index 100% rename from drivers/net/
[dpdk-dev] [PATCH v3] net/iavf/base: change the base as driver common
Change the iavf base code as driver common library, it is used by iavf PMD now, and it can be used by other Intel SR-IOV PMDs in the future. Signed-off-by: Haiyue Wang --- v3: update the commit message. v2: update the commit message, and rename the iavf_main.c to iavf_impl.c drivers/common/Makefile | 5 + drivers/common/iavf/Makefile | 28 + drivers/{net/iavf/base => common/iavf}/README | 1 + .../iavf/base => common/iavf}/iavf_adminq.c | 0 .../iavf/base => common/iavf}/iavf_adminq.h | 0 .../base => common/iavf}/iavf_adminq_cmd.h| 0 .../iavf/base => common/iavf}/iavf_alloc.h| 0 .../iavf/base => common/iavf}/iavf_common.c | 0 .../iavf/base => common/iavf}/iavf_devids.h | 0 drivers/common/iavf/iavf_impl.c | 114 ++ .../iavf/base => common/iavf}/iavf_osdep.h| 50 ++-- .../base => common/iavf}/iavf_prototype.h | 0 .../iavf/base => common/iavf}/iavf_register.h | 0 .../iavf/base => common/iavf}/iavf_status.h | 0 .../iavf/base => common/iavf}/iavf_type.h | 0 drivers/common/iavf/meson.build | 10 ++ .../common/iavf/rte_common_iavf_version.map | 12 ++ .../{net/iavf/base => common/iavf}/virtchnl.h | 0 drivers/common/meson.build| 2 +- drivers/net/iavf/Makefile | 23 +--- drivers/net/iavf/base/meson.build | 23 drivers/net/iavf/iavf.h | 6 +- drivers/net/iavf/iavf_ethdev.c| 83 - drivers/net/iavf/iavf_rxtx.c | 3 - drivers/net/iavf/iavf_rxtx_vec_avx2.c | 1 - drivers/net/iavf/iavf_rxtx_vec_sse.c | 2 - drivers/net/iavf/iavf_vchnl.c | 5 - drivers/net/iavf/meson.build | 4 +- mk/rte.app.mk | 4 + 29 files changed, 192 insertions(+), 184 deletions(-) create mode 100644 drivers/common/iavf/Makefile rename drivers/{net/iavf/base => common/iavf}/README (96%) rename drivers/{net/iavf/base => common/iavf}/iavf_adminq.c (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_adminq.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_adminq_cmd.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_alloc.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_common.c (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_devids.h (100%) create mode 100644 drivers/common/iavf/iavf_impl.c rename drivers/{net/iavf/base => common/iavf}/iavf_osdep.h (75%) rename drivers/{net/iavf/base => common/iavf}/iavf_prototype.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_register.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_status.h (100%) rename drivers/{net/iavf/base => common/iavf}/iavf_type.h (100%) create mode 100644 drivers/common/iavf/meson.build create mode 100644 drivers/common/iavf/rte_common_iavf_version.map rename drivers/{net/iavf/base => common/iavf}/virtchnl.h (100%) delete mode 100644 drivers/net/iavf/base/meson.build diff --git a/drivers/common/Makefile b/drivers/common/Makefile index 1ff033bba..3254c5274 100644 --- a/drivers/common/Makefile +++ b/drivers/common/Makefile @@ -30,4 +30,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_COMMON_DPAAX),y) DIRS-y += dpaax endif +IAVF-y := $(CONFIG_RTE_LIBRTE_IAVF_PMD) +ifneq (,$(findstring y,$(IAVF-y))) +DIRS-y += iavf +endif + include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/common/iavf/Makefile b/drivers/common/iavf/Makefile new file mode 100644 index 0..43383e376 --- /dev/null +++ b/drivers/common/iavf/Makefile @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019 Intel Corporation + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_common_iavf.a + +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-pointer-arith +CFLAGS += -Wno-cast-qual + +EXPORT_MAP := rte_common_iavf_version.map + +# +# all source are stored in SRCS-y +# +SRCS-y += iavf_adminq.c +SRCS-y += iavf_common.c +SRCS-y += iavf_impl.c + +LDLIBS += -lrte_eal + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/iavf/base/README b/drivers/common/iavf/README similarity index 96% rename from drivers/net/iavf/base/README rename to drivers/common/iavf/README index e8c49c36f..b78e89bee 100644 --- a/drivers/net/iavf/base/README +++ b/drivers/common/iavf/README @@ -17,3 +17,4 @@ NOTE: The source code in this directory should not be modified apart from the following file(s): iavf_osdep.h +iavf_impl.c diff --git a/drivers/net/iavf/base/iavf_adminq.c b/drivers/common/iavf/iavf_adminq.c similarity index 100% rename from drivers/net/iavf/base/iavf_adminq.c rename to drivers/common/iavf/iavf_adminq.c diff --git a/drivers/net/iavf/base/iavf_adminq.h b/drivers/common/iavf/iavf_adminq.h s