[dpdk-dev] [PATCH v3] app/testpmd: fix commands to config some offload
Without this patch, testpmd command to config Rx offload keep_crc would fail and report "Bad argument". This patch aslo fix the command to config the Tx offload mbuf_fast_free. Fixes: 70815c9ecadd ("ethdev: add new offload flag to keep CRC") Fixes: c73a9071877a ("app/testpmd: add commands to test new offload API") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Tested-by: Yuan Peng Acked-by: Bernard Iremonger --- app/test-pmd/cmdline.c | 16 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 54ba2f5..589121d 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -17005,7 +17005,7 @@ struct cmd_config_per_port_rx_offload_result { offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "crc_strip#scatter#timestamp#security"); + "crc_strip#scatter#timestamp#security#keep_crc"); cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result, @@ -17084,7 +17084,7 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config rx_offload vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" - "jumbo_frame|crc_strip|scatter|timestamp|security " + "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc " "on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, @@ -17134,7 +17134,7 @@ struct cmd_config_per_queue_rx_offload_result { offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "crc_strip#scatter#timestamp#security"); + "crc_strip#scatter#timestamp#security#keep_crc"); cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result, @@ -17186,7 +17186,7 @@ struct cmd_config_per_queue_rx_offload_result { "vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" - "jumbo_frame|crc_strip|scatter|timestamp|security " + "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc " "on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, @@ -17403,7 +17403,7 @@ struct cmd_config_per_port_tx_offload_result { "sctp_cksum#tcp_tso#udp_tso#outer_ipv4_cksum#" "qinq_insert#vxlan_tnl_tso#gre_tnl_tso#" "ipip_tnl_tso#geneve_tnl_tso#macsec_insert#" - "mt_lockfree#multi_segs#fast_free#security"); + "mt_lockfree#multi_segs#mbuf_fast_free#security"); cmdline_parse_token_string_t cmd_config_per_port_tx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_tx_offload_result, @@ -17484,7 +17484,7 @@ struct cmd_config_per_port_tx_offload_result { "sctp_cksum|tcp_tso|udp_tso|outer_ipv4_cksum|" "qinq_insert|vxlan_tnl_tso|gre_tnl_tso|" "ipip_tnl_tso|geneve_tnl_tso|macsec_insert|" - "mt_lockfree|multi_segs|fast_free|security " + "mt_lockfree|multi_segs|mbuf_fast_free|security " "on|off", .tokens = { (void *)&cmd_config_per_port_tx_offload_result_port, @@ -17535,7 +17535,7 @@ struct cmd_config_per_queue_tx_offload_result { "sctp_cksum#tcp_tso#udp_tso#outer_ipv4_cksum#" "qinq_insert#vxlan_tnl_tso#gre_tnl_tso#" "ipip_tnl_tso#geneve_tnl_tso#macsec_insert#" - "mt_lockfree#multi_segs#fast_free#security"); +
[dpdk-dev] [PATCH] app/testpmd: fix commands to config some offload
Without this patch, testpmd command to config Rx offload keep_crc would fail and report "Bad argument". This patch aslo fix the command to config the Tx offload mbuf_fast_free. Fixes: 70815c9ecadd ("ethdev: add new offload flag to keep CRC") Fixes: c73a9071877a ("app/testpmd: add commands to test new offload API") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Tested-by: Yuan Peng --- app/test-pmd/cmdline.c | 16 doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 54ba2f5..589121d 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -17005,7 +17005,7 @@ struct cmd_config_per_port_rx_offload_result { offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "crc_strip#scatter#timestamp#security"); + "crc_strip#scatter#timestamp#security#keep_crc"); cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result, @@ -17084,7 +17084,7 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config rx_offload vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" - "jumbo_frame|crc_strip|scatter|timestamp|security " + "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc " "on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, @@ -17134,7 +17134,7 @@ struct cmd_config_per_queue_rx_offload_result { offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "crc_strip#scatter#timestamp#security"); + "crc_strip#scatter#timestamp#security#keep_crc"); cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result, @@ -17186,7 +17186,7 @@ struct cmd_config_per_queue_rx_offload_result { "vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" - "jumbo_frame|crc_strip|scatter|timestamp|security " + "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc " "on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, @@ -17403,7 +17403,7 @@ struct cmd_config_per_port_tx_offload_result { "sctp_cksum#tcp_tso#udp_tso#outer_ipv4_cksum#" "qinq_insert#vxlan_tnl_tso#gre_tnl_tso#" "ipip_tnl_tso#geneve_tnl_tso#macsec_insert#" - "mt_lockfree#multi_segs#fast_free#security"); + "mt_lockfree#multi_segs#mbuf_fast_free#security"); cmdline_parse_token_string_t cmd_config_per_port_tx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_tx_offload_result, @@ -17484,7 +17484,7 @@ struct cmd_config_per_port_tx_offload_result { "sctp_cksum|tcp_tso|udp_tso|outer_ipv4_cksum|" "qinq_insert|vxlan_tnl_tso|gre_tnl_tso|" "ipip_tnl_tso|geneve_tnl_tso|macsec_insert|" - "mt_lockfree|multi_segs|fast_free|security " + "mt_lockfree|multi_segs|mbuf_fast_free|security " "on|off", .tokens = { (void *)&cmd_config_per_port_tx_offload_result_port, @@ -17535,7 +17535,7 @@ struct cmd_config_per_queue_tx_offload_result { "sctp_cksum#tcp_tso#udp_tso#outer_ipv4_cksum#" "qinq_insert#vxlan_tnl_tso#gre_tnl_tso#" "ipip_tnl_tso#geneve_tnl_tso#macsec_insert#" - "mt_lockfree#multi_segs#fast_free#security"); + "mt_lo
[dpdk-dev] [PATCH] app/testpmd: fix commands to config some offload
Without this patch, testpmd command to config Rx offload keep_crc would fail and report "Bad argument". This patch aslo fix the command to config the Tx offload mbuf_fast_free. Fixes: 70815c9ecadd ("ethdev: add new offload flag to keep CRC") Fixes: c73a9071877a ("app/testpmd: add commands to test new offload API") Cc: sta...@dpdk.org Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5885289..a0ed3a0 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16665,7 +16665,7 @@ struct cmd_config_per_port_rx_offload_result { offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "crc_strip#scatter#timestamp#security"); + "crc_strip#scatter#timestamp#security#keep_crc"); cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_rx_offload_result, @@ -16744,7 +16744,7 @@ struct cmd_config_per_port_rx_offload_result { .help_str = "port config rx_offload vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" - "jumbo_frame|crc_strip|scatter|timestamp|security " + "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc " "on|off", .tokens = { (void *)&cmd_config_per_port_rx_offload_result_port, @@ -16794,7 +16794,7 @@ struct cmd_config_per_queue_rx_offload_result { offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" "qinq_strip#outer_ipv4_cksum#macsec_strip#" "header_split#vlan_filter#vlan_extend#jumbo_frame#" - "crc_strip#scatter#timestamp#security"); + "crc_strip#scatter#timestamp#security#keep_crc"); cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_queue_rx_offload_result, @@ -16846,7 +16846,7 @@ struct cmd_config_per_queue_rx_offload_result { "vlan_strip|ipv4_cksum|" "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" "macsec_strip|header_split|vlan_filter|vlan_extend|" - "jumbo_frame|crc_strip|scatter|timestamp|security " + "jumbo_frame|crc_strip|scatter|timestamp|security|keep_crc " "on|off", .tokens = { (void *)&cmd_config_per_queue_rx_offload_result_port, @@ -17063,7 +17063,7 @@ struct cmd_config_per_port_tx_offload_result { "sctp_cksum#tcp_tso#udp_tso#outer_ipv4_cksum#" "qinq_insert#vxlan_tnl_tso#gre_tnl_tso#" "ipip_tnl_tso#geneve_tnl_tso#macsec_insert#" - "mt_lockfree#multi_segs#fast_free#security"); + "mt_lockfree#multi_segs#mbuf_fast_free#security"); cmdline_parse_token_string_t cmd_config_per_port_tx_offload_result_on_off = TOKEN_STRING_INITIALIZER (struct cmd_config_per_port_tx_offload_result, @@ -17144,7 +17144,7 @@ struct cmd_config_per_port_tx_offload_result { "sctp_cksum|tcp_tso|udp_tso|outer_ipv4_cksum|" "qinq_insert|vxlan_tnl_tso|gre_tnl_tso|" "ipip_tnl_tso|geneve_tnl_tso|macsec_insert|" - "mt_lockfree|multi_segs|fast_free|security " + "mt_lockfree|multi_segs|mbuf_fast_free|security " "on|off", .tokens = { (void *)&cmd_config_per_port_tx_offload_result_port, @@ -17195,7 +17195,7 @@ struct cmd_config_per_queue_tx_offload_result { "sctp_cksum#tcp_tso#udp_tso#outer_ipv4_cksum#" "qinq_insert#vxlan_tnl_tso#gre_tnl_tso#" "ipip_tnl_tso#geneve_tnl_tso#macsec_insert#" - "mt_lockfree#multi_segs#fast_free#security"); + "mt_lockfree#multi_segs#mbuf_fast_free#security"); cmdline_parse_token_string_t cmd_config_per_queue_tx_offload
[dpdk-dev] [PATCH v5] net/ixgbe: fix to config VLAN strip on the fly
The old ixgbe_vlan_offload_set() is called by rte_eth_dev_set_vlan_offload() which is meant to config VLAN strip/filter/extend on all queues. This old function is also called by rte_eth_dev_start()/ixgbe_dev_start() which need support per-queue VALN strip on only parts of queues. So add new function ixgbe_vlan_offload_config() = old ixgbe_vlan_offload_set(). This new function is called by ixgbe_dev_start() to support VLAN strip per-queue configuration. New ixgbe_vlan_offload_set() = codes to align VLAN strip flags on all queues with port level setting + new ixgbe_vlan_offload_configure(). The 2nd function is called by rte_eth_dev_set_vlan_offload to support configure VLAN strip on all queues of whole port. Fixes: 216f78f4d53f ("net/ixgbe: support VLAN strip per queue offloading in PF") Fixes: 860a94d3c692 ("net/ixgbe: support VLAN strip per queue offloading in VF") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Signed-off-by: Yanglong Wu Acked-by: Qi Zhang --- v5: reduce redundant codes add Fixes in git log message v4: fix typo error in git log message v3: keep vlan strip as per-queue capability and support config vlan on port level on the fly v2: rework as comments asked --- drivers/net/ixgbe/ixgbe_ethdev.c | 61 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 7219f02..0b150cb 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -189,6 +189,9 @@ static void ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on); static void ixgbe_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on); +static void ixgbe_config_vlan_strip_on_all_queues(struct rte_eth_dev *dev, + int mask); +static int ixgbe_vlan_offload_config(struct rte_eth_dev *dev, int mask); static int ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask); static void ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue); static void ixgbe_vlan_hw_strip_disable(struct rte_eth_dev *dev, uint16_t queue); @@ -246,6 +249,7 @@ static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on); +static int ixgbevf_vlan_offload_config(struct rte_eth_dev *dev, int mask); static int ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask); static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on); static int ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, @@ -1974,10 +1978,13 @@ ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on) rxq = dev->data->rx_queues[queue]; - if (on) + if (on) { rxq->vlan_flags = PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; - else + rxq->offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } else { rxq->vlan_flags = PKT_RX_VLAN; + rxq->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } } static void @@ -2129,8 +2136,30 @@ ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) } } +static void +ixgbe_config_vlan_strip_on_all_queues(struct rte_eth_dev *dev, int mask) +{ + uint16_t i; + struct rte_eth_rxmode *rxmode; + struct ixgbe_rx_queue *rxq; + + if (mask & ETH_VLAN_STRIP_MASK) { + rxmode = &dev->data->dev_conf.rxmode; + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + rxq->offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } + else + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + rxq->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } + } +} + static int -ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) +ixgbe_vlan_offload_config(struct rte_eth_dev *dev, int mask) { struct rte_eth_rxmode *rxmode; rxmode = &dev->data->dev_conf.rxmode; @@ -2156,6 +2185,16 @@ ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) return 0; } +static int +ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) +{ + ixgbe_config_vlan_strip_on_all_queues(dev, mask); + + ixgbe_vlan_offload_config(dev, mask); + + return 0; +} + static void ixgbe_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev) { @@ -2577,7 +2616,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev) mask = ETH_VLAN_STRIP_M
[dpdk-dev] [PATCH v4] net/ixgbe: config VLAN strip on the fly
The old ixgbe_vlan_offload_set() is called by rte_eth_dev_set_vlan_offload() which is meant to config VLAN strip/filter/extend on all queues. This old function is also called by rte_eth_dev_start()/ixgbe_dev_start() which need support per-queue VALN strip on only parts of queues. So add new function ixgbe_vlan_offload_config() = old ixgbe_vlan_offload_set(). New ixgbe_vlan_offload_set = codes to align VLAN strip flags on all queues with port level setting + ixgbe_vlan_offload_configure(). Signed-off-by: Wei Dai Signed-off-by: Yanglong Wu --- v4: fix typo error in git log message v3: keep vlan strip as per-queue capability and support config vlan on port level on the fly v2: rework as comments asked --- drivers/net/ixgbe/ixgbe_ethdev.c | 69 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 7219f02..deb9baa 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -189,6 +189,7 @@ static void ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on); static void ixgbe_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on); +static int ixgbe_vlan_offload_config(struct rte_eth_dev *dev, int mask); static int ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask); static void ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue); static void ixgbe_vlan_hw_strip_disable(struct rte_eth_dev *dev, uint16_t queue); @@ -246,6 +247,7 @@ static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on); +static int ixgbevf_vlan_offload_config(struct rte_eth_dev *dev, int mask); static int ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask); static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on); static int ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, @@ -1974,10 +1976,13 @@ ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on) rxq = dev->data->rx_queues[queue]; - if (on) + if (on) { rxq->vlan_flags = PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; - else + rxq->offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } else { rxq->vlan_flags = PKT_RX_VLAN; + rxq->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } } static void @@ -2130,7 +2135,7 @@ ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) } static int -ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) +ixgbe_vlan_offload_config(struct rte_eth_dev *dev, int mask) { struct rte_eth_rxmode *rxmode; rxmode = &dev->data->dev_conf.rxmode; @@ -2156,6 +2161,32 @@ ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) return 0; } +static int +ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) +{ + uint16_t i; + struct rte_eth_rxmode *rxmode; + struct ixgbe_rx_queue *rxq; + + if (mask & ETH_VLAN_STRIP_MASK) { + rxmode = &dev->data->dev_conf.rxmode; + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + rxq->offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } + else + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + rxq->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } + } + + ixgbe_vlan_offload_config(dev, mask); + + return 0; +} + static void ixgbe_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev) { @@ -2577,7 +2608,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev) mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | ETH_VLAN_EXTEND_MASK; - err = ixgbe_vlan_offload_set(dev, mask); + err = ixgbe_vlan_offload_config(dev, mask); if (err) { PMD_INIT_LOG(ERR, "Unable to set VLAN offload"); goto error; @@ -5022,7 +5053,7 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) /* Set HW strip */ mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | ETH_VLAN_EXTEND_MASK; - err = ixgbevf_vlan_offload_set(dev, mask); + err = ixgbevf_vlan_offload_config(dev, mask); if (err) { PMD_INIT_LOG(ERR, "Unable to set VLAN offload (%d)", err); ixgbe_dev_clear_queues(dev); @@ -5220,7 +5251,7 @@ ixgbevf_vlan_strip_queue_set(struct rte_et
[dpdk-dev] [PATCH v3] net/ixgbe: config VLAN strip on the fly
The old ixgbe_vlan_offload_set() is called by rte_eth_dev_set_vlan_offload() which is meant to config VLAN strip/filter/extend on all queues. This old fucntion is also called by rte_eth_dev_start()/ixgbe_dev_start() which need support per-queue VALN strip on only parts of queues. So add new function ixgbe_vlan_offload_config() = old ixgbe_vlan_offload_set(). New ixgbe_vlan_offload_set = codes to align VLAN strip flags on all queues with port level setting + ixgbe_vlan_offload_configure(). Signed-off-by: Wei Dai Signed-off-by: Yanglong Wu --- drivers/net/ixgbe/ixgbe_ethdev.c | 69 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 7219f02..deb9baa 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -189,6 +189,7 @@ static void ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on); static void ixgbe_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on); +static int ixgbe_vlan_offload_config(struct rte_eth_dev *dev, int mask); static int ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask); static void ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue); static void ixgbe_vlan_hw_strip_disable(struct rte_eth_dev *dev, uint16_t queue); @@ -246,6 +247,7 @@ static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on); +static int ixgbevf_vlan_offload_config(struct rte_eth_dev *dev, int mask); static int ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask); static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on); static int ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, @@ -1974,10 +1976,13 @@ ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, uint16_t queue, bool on) rxq = dev->data->rx_queues[queue]; - if (on) + if (on) { rxq->vlan_flags = PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; - else + rxq->offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } else { rxq->vlan_flags = PKT_RX_VLAN; + rxq->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } } static void @@ -2130,7 +2135,7 @@ ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) } static int -ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) +ixgbe_vlan_offload_config(struct rte_eth_dev *dev, int mask) { struct rte_eth_rxmode *rxmode; rxmode = &dev->data->dev_conf.rxmode; @@ -2156,6 +2161,32 @@ ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) return 0; } +static int +ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) +{ + uint16_t i; + struct rte_eth_rxmode *rxmode; + struct ixgbe_rx_queue *rxq; + + if (mask & ETH_VLAN_STRIP_MASK) { + rxmode = &dev->data->dev_conf.rxmode; + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + rxq->offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } + else + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + rxq->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } + } + + ixgbe_vlan_offload_config(dev, mask); + + return 0; +} + static void ixgbe_vmdq_vlan_hw_filter_enable(struct rte_eth_dev *dev) { @@ -2577,7 +2608,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev) mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | ETH_VLAN_EXTEND_MASK; - err = ixgbe_vlan_offload_set(dev, mask); + err = ixgbe_vlan_offload_config(dev, mask); if (err) { PMD_INIT_LOG(ERR, "Unable to set VLAN offload"); goto error; @@ -5022,7 +5053,7 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) /* Set HW strip */ mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | ETH_VLAN_EXTEND_MASK; - err = ixgbevf_vlan_offload_set(dev, mask); + err = ixgbevf_vlan_offload_config(dev, mask); if (err) { PMD_INIT_LOG(ERR, "Unable to set VLAN offload (%d)", err); ixgbe_dev_clear_queues(dev); @@ -5220,7 +5251,7 @@ ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on) } static int -ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask) +ixgbevf_vlan_offload_config(struct rte_eth_dev *dev, int mask) { struct
[dpdk-dev] [PATCH] bus/pci: fix error in parsing vfio driver
In pci_get_kernel_driver_by_path(), the available memory size of dri_name should be strlen(name + 1) + 1, not the size of the pointer (8 bytes), so "vfio-pci" is truncated to "vfio-pc" ended with number 0. This patch fixes it. Fixes: fe5f777b5383 ("bus/pci: replace strncpy by strlcpy") Cc: sta...@dpdk.org Signed-off-by: Wei Dai --- drivers/bus/pci/linux/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index a73ee49..cc6b383 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -54,7 +54,7 @@ pci_get_kernel_driver_by_path(const char *filename, char *dri_name) name = strrchr(path, '/'); if (name) { - strlcpy(dri_name, name + 1, sizeof(dri_name)); + strlcpy(dri_name, name + 1, strlen(name + 1) + 1); return 0; } -- 2.5.5
[dpdk-dev] [PATCH v14] ethdev: new Rx/Tx offloads API
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure() and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If any offloading is enabled in rte_eth_dev_configure() by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If a per-queue offloading hasn't be enabled in rte_eth_dev_configure(), it can be enabled or disabled for individual queue in ret_eth_[rt]x_queue_setup(). A new added offloading is the one which hasn't been enabled in rte_eth_dev_configure() and is reuqested to be enabled in rte_eth_[rt]x_queue_setup(), it must be per-queue type, otherwise trigger an error log. The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup() function only carries those new added offloadings of per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. This patch assumes that all PMDs in 18.05-rc2 have already converted to offload API defined in 17.11 . It also assumes that all PMDs can return correct offloading capabilities in rte_eth_dev_infos_get(). In the beginning of [rt]x_queue_setup() of underlying PMD, add offloads = [rt]xconf->offloads | dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API defined in 17.11 to avoid upper application broken due to offload API change. PMD can use the info that input [rt]xconf->offloads only carry the new added per-queue offloads to do some optimization or some code change on base of this patch. Signed-off-by: Wei Dai Signed-off-by: Ferruh Yigit Signed-off-by: Qi Zhang --- v14: rework on v13 according to feedback. This v14 is also based on commit dc33238da4be ("app/testpmd: check if CRC strip offload supported") in the repo dpdk-next-net. v13: only rework on v12 according to feedback. This version is based on commit dc33238da4be ("app/testpmd: check if CRC strip offload supported") in the repo dpdk-next-net. v12: fix coding style warning v11: This patch set is based on 18.05-rc2 . document update according to feedback revise rte_ethdev.h for doxygen v10: sorry, miss the code change, fix the buidling error v9: replace RTE_PMD_DEBUG_TRACE with ethdev_log(ERR, in ethdev to avoid failure of application which hasn't been completely converted to new offload API. v8: Revise PMD codes to comply with offload API in v7 update document v7: Give the maximum freedom for upper application, only minimal checking is performed in ethdev layer. Only requested specific pure per-queue offloadings are input to underlying PMD. v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- doc/guides/prog_guide/poll_mode_drv.rst | 6 +++--- lib/librte_ethdev/rte_ethdev.c | 22 -- lib/librte_ethdev/rte_ethdev.h | 18 +++--- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst index f4e0bcd..af82352 100644 --- a/doc/guides/prog_guide/poll_mode_drv.rst +++ b/doc/guides/prog_guide/poll_mode_drv.rst @@ -303,12 +303,12 @@ In the DPDK offload API, offloads are divided into per-port and per-queue offloa * A pure per-port offloading can't be enabled on a queue and disabled on another queue at the same time. * A pure per-port offloading must be enabled or disabled on all queues at the same time. * Any offloading is per-queue or pure per-port type, but can't be both types at same devices. -* A per-port offloading can be enabled or disabled on all queues at the same time. -* It is certain that both per-queue and pure per-port offloading are per-port type. +* Port capabilities = per-queue capabilities + pure per-port capabilities. +* Any supported offloading can be enabled on all queues. The different offloads capabilities can be queried using ``rte_eth_dev_info_get()``. The ``dev_info->[rt]x_queue_offload_capa`` returned from ``rte_eth_dev_info_get()`` includes all per-queue offloading capabilities. -The ``dev_info->[rt]x_offload_capa`` returned from ``rte_eth_dev_info_get()`` includes all per-port and per-queue offloading capabilities. +The ``dev_info->[rt]x_offload_capa`` returned from ``rte_eth_dev_info_get()`` includes all pure per-port and per-queue offlo
[dpdk-dev] [PATCH v13] ethdev: new Rx/Tx offloads API
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure() and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If any offloading is enabled in rte_eth_dev_configure() by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If a per-queue offloading hasn't be enabled in rte_eth_dev_configure(), it can be enabled or disabled for individual queue in ret_eth_[rt]x_queue_setup(). A new added offloading is the one which hasn't been enabled in rte_eth_dev_configure() and is reuqested to be enabled in rte_eth_[rt]x_queue_setup(), it must be per-queue type, otherwise trigger an error log. The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup() function only carries those new added offloadings of per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. This patch assumes that all PMDs in 18.05-rc2 have already converted to offload API defined in 17.11 . It also assumes that all PMDs can return correct offloading capabilities in rte_eth_dev_infos_get(). In the beginning of [rt]x_queue_setup() of underlying PMD, add offloads = [rt]xconf->offloads | dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API defined in 17.11 to avoid upper application broken due to offload API change. PMD can use the info that input [rt]xconf->offloads only carry the new added per-queue offloads to do some optimization or some code change on base of this patch. Signed-off-by: Wei Dai Signed-off-by: Ferruh Yigit Signed-off-by: Qi Zhang --- v13: only rework on v12 according to feedback. This version is based on commit dc33238da4be ("app/testpmd: check if CRC strip offload supported") in the repo dpdk-next-net. v12: fix coding style warning v11: This patch set is based on 18.05-rc2 . document update according to feedback revise rte_ethdev.h for doxygen v10: sorry, miss the code change, fix the buidling error v9: replace RTE_PMD_DEBUG_TRACE with ethdev_log(ERR, in ethdev to avoid failure of application which hasn't been completely converted to new offload API. v8: Revise PMD codes to comply with offload API in v7 update document v7: Give the maximum freedom for upper application, only minimal checking is performed in ethdev layer. Only requested specific pure per-queue offloadings are input to underlying PMD. v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- doc/guides/prog_guide/poll_mode_drv.rst | 6 +++--- lib/librte_ethdev/rte_ethdev.c | 22 -- lib/librte_ethdev/rte_ethdev.h | 17 ++--- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst index f4e0bcd..daa858d 100644 --- a/doc/guides/prog_guide/poll_mode_drv.rst +++ b/doc/guides/prog_guide/poll_mode_drv.rst @@ -303,12 +303,12 @@ In the DPDK offload API, offloads are divided into per-port and per-queue offloa * A pure per-port offloading can't be enabled on a queue and disabled on another queue at the same time. * A pure per-port offloading must be enabled or disabled on all queues at the same time. * Any offloading is per-queue or pure per-port type, but can't be both types at same devices. -* A per-port offloading can be enabled or disabled on all queues at the same time. -* It is certain that both per-queue and pure per-port offloading are per-port type. +* Port capabilities = pre-queue capabilities + pure per-port capabilities. +* Any supported offloading can be enabled on all queues. The different offloads capabilities can be queried using ``rte_eth_dev_info_get()``. The ``dev_info->[rt]x_queue_offload_capa`` returned from ``rte_eth_dev_info_get()`` includes all per-queue offloading capabilities. -The ``dev_info->[rt]x_offload_capa`` returned from ``rte_eth_dev_info_get()`` includes all per-port and per-queue offloading capabilities. +The ``dev_info->[rt]x_offload_capa`` returned from ``rte_eth_dev_info_get()`` includes all pure per-port and per-queue offloading capabilities. Supported offloads can be either per-port or per-queue. Offloads are enabled using the existing ``DEV_TX_OFFLOAD_*`` or ``DEV_RX_OFFLOAD_*`` flags. diff --git a/lib/
[dpdk-dev] [PATCH v12] ethdev: new Rx/Tx offloads API
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure() and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If any offloading is enabled in rte_eth_dev_configure() by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If a per-queue offloading hasn't be enabled in rte_eth_dev_configure(), it can be enabled or disabled for individual queue in ret_eth_[rt]x_queue_setup(). A new added offloading is the one which hasn't been enabled in rte_eth_dev_configure() and is reuqested to be enabled in rte_eth_[rt]x_queue_setup(), it must be per-queue type, otherwise trigger an error log. The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup() function only carries those new added offloadings of per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. This patch assumes that all PMDs in 18.05-rc2 have already converted to offload API defined in 17.11 . It also assumes that all PMDs can return correct offloading capabilities in rte_eth_dev_infos_get(). In the beginning of [rt]x_queue_setup() of underlying PMD, add offloads = [rt]xconf->offloads | dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API defined in 17.11 to avoid upper application broken due to offload API change. PMD can use the info that input [rt]xconf->offloads only carry the new added per-queue offloads to do some optimization or some code change on base of this patch. Signed-off-by: Wei Dai Signed-off-by: Ferruh Yigit Signed-off-by: Qi Zhang --- v12: fix coding style warning v11: This patch set is based on 18.05-rc2 . document update according to feedback revise rte_ethdev.h for doxygen v10: sorry, miss the code change, fix the buidling error v9: replace RTE_PMD_DEBUG_TRACE with ethdev_log(ERR, in ethdev to avoid failure of application which hasn't been completely converted to new offload API. v8: Revise PMD codes to comply with offload API in v7 update document v7: Give the maximum freedom for upper application, only minimal checking is performed in ethdev layer. Only requested specific pure per-queue offloadings are input to underlying PMD. v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- doc/guides/prog_guide/poll_mode_drv.rst | 28 -- doc/guides/rel_notes/release_18_05.rst | 8 ++ drivers/net/avf/avf_rxtx.c | 5 +- drivers/net/bnxt/bnxt_ethdev.c | 17 drivers/net/cxgbe/cxgbe_ethdev.c| 50 +- drivers/net/dpaa/dpaa_ethdev.c | 16 drivers/net/dpaa2/dpaa2_ethdev.c| 16 drivers/net/e1000/em_ethdev.c | 19 drivers/net/e1000/em_rxtx.c | 64 ++--- drivers/net/e1000/igb_rxtx.c| 64 ++--- drivers/net/ena/ena_ethdev.c| 65 + drivers/net/failsafe/failsafe_ops.c | 81 drivers/net/fm10k/fm10k_ethdev.c| 82 ++-- drivers/net/i40e/i40e_rxtx.c| 58 ++-- drivers/net/ixgbe/ixgbe_ethdev.c| 38 drivers/net/ixgbe/ixgbe_rxtx.c | 66 ++--- drivers/net/mlx4/mlx4_rxq.c | 43 ++--- drivers/net/mlx4/mlx4_txq.c | 42 ++-- drivers/net/mlx5/mlx5_ethdev.c | 22 - drivers/net/mlx5/mlx5_rxq.c | 50 ++ drivers/net/mlx5/mlx5_txq.c | 44 + drivers/net/mvpp2/mrvl_ethdev.c | 97 +-- drivers/net/nfp/nfp_net.c | 163 drivers/net/octeontx/octeontx_ethdev.c | 72 +- drivers/net/sfc/sfc_ethdev.c| 9 +- drivers/net/sfc/sfc_rx.c| 42 ++-- drivers/net/sfc/sfc_rx.h| 3 +- drivers/net/sfc/sfc_tx.c| 42 ++-- drivers/net/sfc/sfc_tx.h| 3 +- drivers/net/tap/rte_eth_tap.c | 88 ++--- drivers/net/thunderx/nicvf_ethdev.c | 70 ++ drivers/net/virtio/virtio_rxtx.c| 9 +- drivers/net/vmxnet3/vmxnet3_ethdev.c| 16 drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +- lib/librte_ethdev/rte_ethdev.c | 86 + lib/librte_ethdev/rte_ethdev.h
[dpdk-dev] [PATCH v11] ethdev: new Rx/Tx offloads API
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure() and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If any offloading is enabled in rte_eth_dev_configure() by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If a per-queue offloading hasn't be enabled in rte_eth_dev_configure(), it can be enabled or disabled for individual queue in ret_eth_[rt]x_queue_setup(). A new added offloading is the one which hasn't been enabled in rte_eth_dev_configure() and is reuqested to be enabled in rte_eth_[rt]x_queue_setup(), it must be per-queue type, otherwise trigger an error log. The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup() function only carries those new added offloadings of per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. This patch assumes that all PMDs in 18.05-rc2 have already converted to offload API defined in 17.11 . It also assumes that all PMDs can return correct offloading capabilities in rte_eth_dev_infos_get(). In the beginning of [rt]x_queue_setup() of underlying PMD, add offloads = [rt]xconf->offloads | dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API defined in 17.11 to avoid upper application broken due to offload API change. PMD can use the info that input [rt]xconf->offloads only carry the new added per-queue offloads to do some optimization or some code change on base of this patch. Signed-off-by: Wei Dai Signed-off-by: Ferruh Yigit Signed-off-by: Qi Zhang --- v11: This patch set is based on 18.05-rc2 . document update according to feedback revise rte_ethdev.h for doxygen v10: sorry, miss the code change, fix the buidling error v9: replace RTE_PMD_DEBUG_TRACE with ethdev_log(ERR, in ethdev to avoid failure of application which hasn't been completely converted to new offload API. v8: Revise PMD codes to comply with offload API in v7 update document v7: Give the maximum freedom for upper application, only minimal checking is performed in ethdev layer. Only requested specific pure per-queue offloadings are input to underlying PMD. v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- doc/guides/prog_guide/poll_mode_drv.rst | 28 -- doc/guides/rel_notes/release_18_05.rst | 8 ++ drivers/net/avf/avf_rxtx.c | 5 +- drivers/net/bnxt/bnxt_ethdev.c | 17 drivers/net/cxgbe/cxgbe_ethdev.c| 50 +- drivers/net/dpaa/dpaa_ethdev.c | 16 drivers/net/dpaa2/dpaa2_ethdev.c| 16 drivers/net/e1000/em_ethdev.c | 19 drivers/net/e1000/em_rxtx.c | 64 ++--- drivers/net/e1000/igb_rxtx.c| 64 ++--- drivers/net/ena/ena_ethdev.c| 65 + drivers/net/failsafe/failsafe_ops.c | 81 drivers/net/fm10k/fm10k_ethdev.c| 82 ++-- drivers/net/i40e/i40e_rxtx.c| 58 ++-- drivers/net/ixgbe/ixgbe_ethdev.c| 38 drivers/net/ixgbe/ixgbe_rxtx.c | 66 ++--- drivers/net/mlx4/mlx4_rxq.c | 43 ++--- drivers/net/mlx4/mlx4_txq.c | 42 ++-- drivers/net/mlx5/mlx5_ethdev.c | 22 - drivers/net/mlx5/mlx5_rxq.c | 50 ++ drivers/net/mlx5/mlx5_txq.c | 44 + drivers/net/mvpp2/mrvl_ethdev.c | 97 +-- drivers/net/nfp/nfp_net.c | 163 drivers/net/octeontx/octeontx_ethdev.c | 72 +- drivers/net/sfc/sfc_ethdev.c| 9 +- drivers/net/sfc/sfc_rx.c| 42 ++-- drivers/net/sfc/sfc_rx.h| 3 +- drivers/net/sfc/sfc_tx.c| 42 ++-- drivers/net/sfc/sfc_tx.h| 3 +- drivers/net/tap/rte_eth_tap.c | 88 ++--- drivers/net/thunderx/nicvf_ethdev.c | 70 ++ drivers/net/virtio/virtio_rxtx.c| 9 +- drivers/net/vmxnet3/vmxnet3_ethdev.c| 16 drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +- lib/librte_ethdev/rte_ethdev.c | 86 + lib/librte_ethdev/rte_ethdev.h | 20 +++- 36 files change
[dpdk-dev] [PATCH] net/e1000: add support of Tx multi_segs
This feature has been confirmed with testpmd: testpmd> set fwd txonly testpmd> port stop all testpmd> port config all txd 1024 testpmd> set txsplit on testpmd> set txpkts 70,80,90,100 testpmd> start It can be observed at peer port that UDP packets with UDP data length 298 bytes. Signed-off-by: Wei Dai --- drivers/net/e1000/igb_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 128ed0b..5f729f2 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -1460,7 +1460,8 @@ igb_get_tx_port_offloads_capa(struct rte_eth_dev *dev) DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; + DEV_TX_OFFLOAD_TCP_TSO | + DEV_TX_OFFLOAD_MULTI_SEGS; return rx_offload_capa; } -- 2.7.5
[dpdk-dev] [PATCH v10] ethdev: new Rx/Tx offloads API
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure( ) and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). If any offloading is enabled in rte_eth_dev_configure( ) by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). If a per-queue offloading hasn't be enabled in rte_eth_dev_configure( ), it can be enabled or disabled for individual queue in ret_eth_[rt]x_queue_setup( ). A new added offloading is the one which hasn't been enabled in rte_eth_dev_configure( ) and is reuqested to be enabled in rte_eth_[rt]x_queue_setup( ), it must be per-queue type, otherwise triger an error log. The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup( ) function only carries those new added offloadings of per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. This patch assumes that all PMDs in 18.05-rc2 have already converted to offload API defined in 17.11 . It also assumes that all PMDs can return correct offloading capabilities in rte_eth_dev_infos_get( ). In the beginning of [rt]x_queue_setup( ) of underlying PMD, add offloads = [rt]xconf->offloads | dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API defined in 17.11 to avoid upper application broken due to offload API change. PMD can use the info that input [rt]xconf->offloads only carry the new added per-queue offloads to do some optimization or some code change on base of this patch. Signed-off-by: Wei Dai Signed-off-by: Ferruh Yigit Signed-off-by: Qi Zhang --- v10: sorry, miss the code change, fix the buidling error v9: replace RTE_PMD_DEBUG_TRACE with ethdev_log(ERR, in ethdev to avoid failure of application which hasn't been completely converted to new offload API. v8: Revise PMD codes to comply with offload API in v7 update document v7: Give the maximum freedom for upper application, only minimal checking is performed in ethdev layer. Only requested specific pure per-queue offloadings are input to underlying PMD. v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- doc/guides/prog_guide/poll_mode_drv.rst | 26 +++-- doc/guides/rel_notes/release_18_05.rst | 8 ++ drivers/net/avf/avf_rxtx.c | 5 +- drivers/net/bnxt/bnxt_ethdev.c | 17 drivers/net/cxgbe/cxgbe_ethdev.c| 50 +- drivers/net/dpaa/dpaa_ethdev.c | 16 drivers/net/dpaa2/dpaa2_ethdev.c| 16 drivers/net/e1000/em_ethdev.c | 19 drivers/net/e1000/em_rxtx.c | 64 ++--- drivers/net/e1000/igb_rxtx.c| 64 ++--- drivers/net/ena/ena_ethdev.c| 65 + drivers/net/failsafe/failsafe_ops.c | 81 drivers/net/fm10k/fm10k_ethdev.c| 82 ++-- drivers/net/i40e/i40e_rxtx.c| 58 ++-- drivers/net/ixgbe/ixgbe_ethdev.c| 38 drivers/net/ixgbe/ixgbe_rxtx.c | 66 ++--- drivers/net/mlx4/mlx4_rxq.c | 43 ++--- drivers/net/mlx4/mlx4_txq.c | 42 ++-- drivers/net/mlx5/mlx5_ethdev.c | 22 - drivers/net/mlx5/mlx5_rxq.c | 50 ++ drivers/net/mlx5/mlx5_txq.c | 44 + drivers/net/mvpp2/mrvl_ethdev.c | 97 +-- drivers/net/nfp/nfp_net.c | 163 drivers/net/octeontx/octeontx_ethdev.c | 72 +- drivers/net/sfc/sfc_ethdev.c| 9 +- drivers/net/sfc/sfc_rx.c| 42 ++-- drivers/net/sfc/sfc_rx.h| 3 +- drivers/net/sfc/sfc_tx.c| 42 ++-- drivers/net/sfc/sfc_tx.h| 3 +- drivers/net/tap/rte_eth_tap.c | 88 ++--- drivers/net/thunderx/nicvf_ethdev.c | 70 ++ drivers/net/virtio/virtio_rxtx.c| 9 +- drivers/net/vmxnet3/vmxnet3_ethdev.c| 16 drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +- lib/librte_ethdev/rte_ethdev.c | 86 + 35 files changed, 238 insertions(+), 1346 deletions(-) diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst index 09a93ba..56483f
[dpdk-dev] [PATCH v9] ethdev: new Rx/Tx offloads API
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure( ) and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). If any offloading is enabled in rte_eth_dev_configure( ) by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). If a per-queue offloading hasn't be enabled in rte_eth_dev_configure( ), it can be enabled or disabled for individual queue in ret_eth_[rt]x_queue_setup( ). A new added offloading is the one which hasn't been enabled in rte_eth_dev_configure( ) and is reuqested to be enabled in rte_eth_[rt]x_queue_setup( ), it must be per-queue type, otherwise triger an error log. The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup( ) function only carries those new added offloadings of per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. This patch assumes that all PMDs in 18.05-rc2 have already converted to offload API defined in 17.11 . It also assumes that all PMDs can return correct offloading capabilities in rte_eth_dev_infos_get( ). In the beginning of [rt]x_queue_setup( ) of underlying PMD, add offloads = [rt]xconf->offloads | dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API defined in 17.11 to avoid upper application broken due to offload API change. PMD can use the info that input [rt]xconf->offloads only carry the new added per-queue offloads to do some optimization or some code change on base of this patch. Signed-off-by: Wei Dai Signed-off-by: Ferruh Yigit Signed-off-by: Qi Zhang --- v9: replace RTE_PMD_DEBUG_TRACE with ethdev_log(ERR, in ethdev to avoid failure of application which hasn't been completely converted to new offload API. v8: Revise PMD codes to comply with offload API in v7 update document v7: Give the maximum freedom for upper application, only minimal checking is performed in ethdev layer. Only requested specific pure per-queue offloadings are input to underlying PMD. v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- doc/guides/prog_guide/poll_mode_drv.rst | 26 +++-- doc/guides/rel_notes/release_18_05.rst | 8 ++ drivers/net/avf/avf_rxtx.c | 5 +- drivers/net/bnxt/bnxt_ethdev.c | 17 drivers/net/cxgbe/cxgbe_ethdev.c| 50 +- drivers/net/dpaa/dpaa_ethdev.c | 16 drivers/net/dpaa2/dpaa2_ethdev.c| 16 drivers/net/e1000/em_ethdev.c | 19 drivers/net/e1000/em_rxtx.c | 64 ++--- drivers/net/e1000/igb_rxtx.c| 64 ++--- drivers/net/ena/ena_ethdev.c| 65 + drivers/net/failsafe/failsafe_ops.c | 81 drivers/net/fm10k/fm10k_ethdev.c| 82 ++-- drivers/net/i40e/i40e_rxtx.c| 58 ++-- drivers/net/ixgbe/ixgbe_ethdev.c| 38 drivers/net/ixgbe/ixgbe_rxtx.c | 66 ++--- drivers/net/mlx4/mlx4_rxq.c | 43 ++--- drivers/net/mlx4/mlx4_txq.c | 42 ++-- drivers/net/mlx5/mlx5_ethdev.c | 22 - drivers/net/mlx5/mlx5_rxq.c | 50 ++ drivers/net/mlx5/mlx5_txq.c | 44 + drivers/net/mvpp2/mrvl_ethdev.c | 97 +-- drivers/net/nfp/nfp_net.c | 163 drivers/net/octeontx/octeontx_ethdev.c | 72 +- drivers/net/sfc/sfc_ethdev.c| 9 +- drivers/net/sfc/sfc_rx.c| 42 ++-- drivers/net/sfc/sfc_rx.h| 3 +- drivers/net/sfc/sfc_tx.c| 42 ++-- drivers/net/sfc/sfc_tx.h| 3 +- drivers/net/tap/rte_eth_tap.c | 88 ++--- drivers/net/thunderx/nicvf_ethdev.c | 70 ++ drivers/net/virtio/virtio_rxtx.c| 9 +- drivers/net/vmxnet3/vmxnet3_ethdev.c| 16 drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +- lib/librte_ethdev/rte_ethdev.c | 86 + 35 files changed, 238 insertions(+), 1346 deletions(-) diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst index 09a93ba..56483fb 100644 --- a/doc/guides/prog_guide/poll_mode
[dpdk-dev] [PATCH v2] ethdev: fix comments for offload capabilities
Indeed, rx_offload_capa or tx_offload_capa in struct rte_eth_dev_info includes not only per port offloading features but also per queue ones. This patch make its meaning much clearer. Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API") Fixes: cba7f53b717d ("ethdev: introduce Tx queue offloads API") Cc: sta...@dpdk.org Signed-off-by: Wei Dai --- v2: fix coding style issues --- lib/librte_ethdev/rte_ethdev.h | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 7ccf4ba..98e3114 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1067,9 +1067,13 @@ struct rte_eth_dev_info { uint16_t max_vfs; /**< Maximum number of VFs. */ uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */ uint64_t rx_offload_capa; - /**< Device per port RX offload capabilities. */ + /**< Rx offload capabilities including all per port ones +* and all per queue ones. +*/ uint64_t tx_offload_capa; - /**< Device per port TX offload capabilities. */ + /**< Tx offload capabilities including all per port ones +* and all per queue ones. +*/ uint64_t rx_queue_offload_capa; /**< Device per queue RX offload capabilities. */ uint64_t tx_queue_offload_capa; -- 2.7.5
[dpdk-dev] [PATCH v8] app/testpmd: add commands to test new offload API
Add following testpmd run-time commands to support test of new Rx offload API: show port rx_offload capabilities show port rx_offload configuration port config rx_offload on|off port rxq rx_offload on|off Above last 2 commands should be run when the port is stopped. And can be one of "vlan_strip", "ipv4_cksum", ... Add following testpmd run-time commands to support test of new Tx offload API: show port tx_offload capabilities show port tx_offload configuration port config tx_offload on|off port txq tx_offload on|off Above last 2 commands should be run when the port is stopped. And can be one of "vlan_insert", "udp_cksum", ... Signed-off-by: Wei Dai Acked-by: Jingjing Wu --- v8: Change the command formats according to feedback from community: 1. Change "[rt]x_offload get capabilit " to "show port [rt]x_offload capabilitis" 2. Change "[rt]x_offload get configuration " to "show port [rt]x_offload configuration" 3. Change "[rt]x_offload enable|disable per_port " to "port config [rt]x_offload on|off" 4. Change "[rt]x_offload enable|disable per_queue " to "port [rt]xq [rt]x_offload on|off" --- app/test-pmd/cmdline.c | 807 app/test-pmd/testpmd.c | 16 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 87 +++ 3 files changed, 904 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 9615670..2904d3d 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16448,6 +16448,805 @@ cmdline_parse_inst_t cmd_load_from_file = { }, }; +/* Get Rx offloads capabilities */ +struct cmd_rx_offload_get_capa_result { + cmdline_fixed_string_t show; + cmdline_fixed_string_t port; + portid_t port_id; + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t capabilities; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_capa_show = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +show, "show"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_port = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port, "port"); +cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port_id, UINT16); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_capabilities = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +capabilities, "capabilities"); + +static void +print_rx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_rx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_rx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.rx_queue_offload_capa; + port_offloads = dev_info.rx_offload_capa ^ queue_offloads; + + printf("Rx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_rx_offloads(queue_offloads); + + printf("\n"); + printf(" Per Port :"); + print_rx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_rx_offload_get_capa = { + .f = cmd_rx_offload_get_capa_parsed, + .data = NULL, + .help_str = "show port rx_offload capabilities", + .tokens = { + (void *)&cmd_rx_offload_get_capa_show, + (void *)&cmd_rx_offload_get_capa_port, + (void *)&cmd_rx_offload_get_capa_port_id, +
[dpdk-dev] [PATCH v8] ethdev: check Rx/Tx offloads
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure( ) and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). If any offloading is enabled in rte_eth_dev_configure( ) by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). If a per-queue offloading hasn't be enabled in rte_eth_dev_configure( ), it can be enabled or disabled for individual queue in ret_eth_[rt]x_queue_setup( ). A new added offloading is the one which hasn't been enabled in rte_eth_dev_configure( ) and is reuqested to be enabled in rte_eth_[rt]x_queue_setup( ), it must be per-queue type, otherwise return error. The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup( ) function only carries those new added offloadings of per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. This patch assumes that all PMDs in 18.05-rc2 have already converted to offload API defined in 17.11 . It also assumes that all PMDs can return correct offloading capabilities in rte_eth_dev_infos_get( ). In the beginning of [rt]x_queue_setup( ) of underlying PMD, add offloads = [rt]xconf->offloads | dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API defined in 17.11 to avoid upper application broken due to offload API change. PMD can use the info that input [rt]xconf->offloads only carry the new added per-queue offloads to do some optimization or some code change on base of this patch. Signed-off-by: Wei Dai Signed-off-by: Ferruh Yigit Signed-off-by: Qi Zhang --- v8: Revise PMD codes to comply with offload API in v7 update document v7: Give the maximum freedom for upper application, only minimal checking is performed in ethdev layer. Only requested specific pure per-queue offloadings are input to underlying PMD. v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- doc/guides/prog_guide/poll_mode_drv.rst | 26 +++-- doc/guides/rel_notes/release_18_05.rst | 8 ++ drivers/net/avf/avf_rxtx.c | 5 +- drivers/net/bnxt/bnxt_ethdev.c | 17 drivers/net/cxgbe/cxgbe_ethdev.c| 50 +- drivers/net/dpaa/dpaa_ethdev.c | 16 drivers/net/dpaa2/dpaa2_ethdev.c| 16 drivers/net/e1000/em_ethdev.c | 19 drivers/net/e1000/em_rxtx.c | 64 ++--- drivers/net/e1000/igb_rxtx.c| 64 ++--- drivers/net/ena/ena_ethdev.c| 65 + drivers/net/failsafe/failsafe_ops.c | 81 drivers/net/fm10k/fm10k_ethdev.c| 82 ++-- drivers/net/i40e/i40e_rxtx.c| 58 ++-- drivers/net/ixgbe/ixgbe_ethdev.c| 38 drivers/net/ixgbe/ixgbe_rxtx.c | 66 ++--- drivers/net/mlx4/mlx4_rxq.c | 43 ++--- drivers/net/mlx4/mlx4_txq.c | 42 ++-- drivers/net/mlx5/mlx5_ethdev.c | 22 - drivers/net/mlx5/mlx5_rxq.c | 50 ++ drivers/net/mlx5/mlx5_txq.c | 44 + drivers/net/mvpp2/mrvl_ethdev.c | 97 +-- drivers/net/nfp/nfp_net.c | 163 drivers/net/octeontx/octeontx_ethdev.c | 72 +- drivers/net/sfc/sfc_ethdev.c| 9 +- drivers/net/sfc/sfc_rx.c| 42 ++-- drivers/net/sfc/sfc_rx.h| 3 +- drivers/net/sfc/sfc_tx.c| 42 ++-- drivers/net/sfc/sfc_tx.h| 3 +- drivers/net/tap/rte_eth_tap.c | 88 ++--- drivers/net/thunderx/nicvf_ethdev.c | 70 ++ drivers/net/virtio/virtio_rxtx.c| 9 +- drivers/net/vmxnet3/vmxnet3_ethdev.c| 16 drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +- lib/librte_ethdev/rte_ethdev.c | 88 + 35 files changed, 240 insertions(+), 1346 deletions(-) diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst index 09a93ba..56483fb 100644 --- a/doc/guides/prog_guide/poll_mode_drv.rst +++ b/doc/guides/prog_guide/poll_mode_drv.rst @@ -297,16 +297,30 @@ Per-Port and Per-Queue Offloads ^^^ In the DPDK offload API, offloads ar
[dpdk-dev] [PATCH v8] ethdev: check Rx/Tx offloads
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure( ) and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). If any offloading is enabled in rte_eth_dev_configure( ) by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). If a per-queue offloading hasn't be enabled in rte_eth_dev_configure( ), it can be enabled or disabled for individual queue in ret_eth_[rt]x_queue_setup( ). A new added offloading is the one which hasn't been enabled in rte_eth_dev_configure( ) and is reuqested to be enabled in rte_eth_[rt]x_queue_setup( ), it must be per-queue type, otherwise return error. The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup( ) function only carries those new added offloadings of per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. This patch assumes that all PMDs in 18.05-rc2 have already converted to offload API defined in 17.11 . It also assumes that all PMDs can return correct offloading capabilities in rte_eth_dev_infos_get( ). In the beginning of [rt]x_queue_setup( ) of underlying PMD, add offloads = [rt]xconf->offloads | dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API defined in 17.11 to avoid upper application broken due to offload API change. PMD can use the info that input [rt]xconf->offloads only carry the new added per-queue offloads to do some optimization or some code change on base of this patch. Signed-off-by: Wei Dai Signed-off-by: Ferruh Yigit Signed-off-by: Qi Zhang --- v8: Revise PMD codes to comply with offload API in v7 update document v7: Give the maximum freedom for upper application, only minimal checking is performed in ethdev layer. Only requested specific pure per-queue offloadings are input to underlying PMD. v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- doc/guides/prog_guide/poll_mode_drv.rst | 26 +++-- doc/guides/rel_notes/release_18_05.rst | 8 ++ drivers/net/avf/avf_rxtx.c | 5 +- drivers/net/bnxt/bnxt_ethdev.c | 17 drivers/net/cxgbe/cxgbe_ethdev.c| 50 +- drivers/net/dpaa/dpaa_ethdev.c | 16 drivers/net/dpaa2/dpaa2_ethdev.c| 16 drivers/net/e1000/em_ethdev.c | 19 drivers/net/e1000/em_rxtx.c | 64 ++--- drivers/net/e1000/igb_rxtx.c| 64 ++--- drivers/net/ena/ena_ethdev.c| 65 + drivers/net/failsafe/failsafe_ops.c | 81 drivers/net/fm10k/fm10k_ethdev.c| 82 ++-- drivers/net/i40e/i40e_rxtx.c| 58 ++-- drivers/net/ixgbe/ixgbe_ethdev.c| 38 drivers/net/ixgbe/ixgbe_rxtx.c | 66 ++--- drivers/net/mlx4/mlx4_rxq.c | 43 ++--- drivers/net/mlx4/mlx4_txq.c | 42 ++-- drivers/net/mlx5/mlx5_ethdev.c | 22 - drivers/net/mlx5/mlx5_rxq.c | 50 ++ drivers/net/mlx5/mlx5_txq.c | 44 + drivers/net/mvpp2/mrvl_ethdev.c | 97 +-- drivers/net/nfp/nfp_net.c | 163 drivers/net/octeontx/octeontx_ethdev.c | 72 +- drivers/net/sfc/sfc_ethdev.c| 9 +- drivers/net/sfc/sfc_rx.c| 42 ++-- drivers/net/sfc/sfc_rx.h| 3 +- drivers/net/sfc/sfc_tx.c| 42 ++-- drivers/net/sfc/sfc_tx.h| 3 +- drivers/net/tap/rte_eth_tap.c | 88 ++--- drivers/net/thunderx/nicvf_ethdev.c | 70 ++ drivers/net/virtio/virtio_rxtx.c| 9 +- drivers/net/vmxnet3/vmxnet3_ethdev.c| 16 drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +- lib/librte_ethdev/rte_ethdev.c | 88 + 35 files changed, 240 insertions(+), 1346 deletions(-) diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst index 09a93ba..56483fb 100644 --- a/doc/guides/prog_guide/poll_mode_drv.rst +++ b/doc/guides/prog_guide/poll_mode_drv.rst @@ -297,16 +297,30 @@ Per-Port and Per-Queue Offloads ^^^ In the DPDK offload API, offloads ar
[dpdk-dev] [PATCH v7] ethdev: check Rx/Tx offloads
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure( ) and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). >From application, a pure per-port offloading can't be enabled on any queue if it hasn't been enabled in rte_eth_dev_configure( ). If any offloading is enabled in rte_eth_dev_configure( ) by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ). The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup( ) function only carries those offloadings only enabled for the queue but not enabled in rte_eth_dev_configure( ) and they are certain per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. Signed-off-by: Wei Dai Signed-off-by: Ferruh Yigit --- v7: Give the maximum freedom for upper application, only minimal checking is performed in ethdev layer. Only requested specific pure per-queue offloadings are input to underlying PMD. v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- lib/librte_ethdev/rte_ethdev.c | 150 + 1 file changed, 150 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index e560524..0ad05eb 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1139,6 +1139,28 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, ETHER_MAX_LEN; } + /* Any requested offloading must be within its device capabilities */ + if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) != +local_conf.rxmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Rx offloads " + "0x%" PRIx64 " doesn't match Rx offloads " + "capabilities 0x%" PRIx64 "\n", + port_id, + local_conf.rxmode.offloads, + dev_info.rx_offload_capa); + return -EINVAL; + } + if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != +local_conf.txmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Tx offloads " + "0x%" PRIx64 " doesn't match Tx offloads " + "capabilities 0x%" PRIx64 "\n", + port_id, + local_conf.txmode.offloads, + dev_info.tx_offload_capa); + return -EINVAL; + } + /* Check that device supports requested rss hash functions. */ if ((dev_info.flow_type_rss_offloads | dev_conf->rx_adv_conf.rss_conf.rss_hf) != @@ -1414,6 +1436,8 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, struct rte_eth_dev_info dev_info; struct rte_eth_rxconf local_conf; void **rxq; + uint64_t pure_port_offload_capa; + uint64_t only_enabled_for_queue; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); @@ -1504,6 +1528,68 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &local_conf.offloads); } + /* +* The requested offloadings by application for this queue +* can be per-queue type or per-port type. and +* they must be within the device offloading capabilities. +*/ + if ((local_conf.offloads & dev_info.rx_offload_capa) != +local_conf.offloads) { + RTE_PMD_DEBUG_TRACE("Ethdev port_id=%d rx_queue_id=%d " + "Requested offload 0x%" PRIx64 "doesn't " + "match per-queue capability 0x%" PRIx64 + " in %s\n", + port_id, + rx_queue_id, + local_conf.offloads, +
[dpdk-dev] [PATCH v6] ethdev: check Rx/Tx offloads
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure( ) and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). >From application, a pure per-port offloading can only be enabled in rte_eth_dev_configure(). Only supported per queue offloading can be sent to rte_eth_[rt]x_queue_setup( ). A per queue offloading is enabled only if it is enabled in rte_eth_dev_configure( ) OR if it is enabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is enabled in rte_eth_dev_configure(), it can't be disabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is disabled in rte_eth_dev_configure( ), it can be enabled or disabled( ) in rte_eth_[rt]x_queue_setup( ). This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. Signed-off-by: Wei Dai --- v6: No need enable an offload in queue_setup( ) if it has already been enabled in dev_configure( ) v5: keep offload settings sent to PMD same as those from application v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- lib/librte_ether/rte_ethdev.c | 70 +++ 1 file changed, 70 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f0f53d4..39a0f0e 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1196,6 +1196,28 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, ETHER_MAX_LEN; } + /* Any requested offload must be within its device capability */ + if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) != +local_conf.rxmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Rx offloads " + "0x%" PRIx64 " doesn't match Rx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.rxmode.offloads, + dev_info.rx_offload_capa); + return -EINVAL; + } + if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != +local_conf.txmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Tx offloads " + "0x%" PRIx64 " doesn't match Tx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.txmode.offloads, + dev_info.tx_offload_capa); + return -EINVAL; + } + /* * Setup new number of RX/TX queues and reconfigure device. */ @@ -1547,6 +1569,30 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from application. +* If any other offload is sent to this function, return -EINVAL +*/ + if ((local_conf.offloads & dev_info.rx_queue_offload_capa) != +local_conf.offloads) { + RTE_PMD_DEBUG_TRACE("Ethdev port_id=%d rx_queue_id=%d " + "Requested offload 0x%" PRIx64 "doesn't " + "match per-queue capability 0x%" PRIx64 + " in %s\n", + port_id, + rx_queue_id, + local_conf.offloads, + dev_info.rx_queue_offload_capa, + __func__); + return -EINVAL; + } + + /* +* If an offload has already been enabled in rte_eth_dev_configure(), +* there is no need to enable it again in queue level. +*/ + local_conf.offloads &= ~dev->data->dev_conf.rxmode.offloads; + ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, socket_id, &local_conf, mp); if (!ret) { @@ -1681,6 +1727,30 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, &local_conf.offloads); } +
[dpdk-dev] [PATCH v5] ethdev: check Rx/Tx offloads
This patch check if a requested offloading is supported in the device capability. Any offloading is disabled by default if it is not set in rte_eth_dev_configure( ) and rte_eth_[rt]x_queue_setup(). A per port offloading can only be enabled in rte_eth_dev_configure(). If a per port offloading is sent to rte_eth_[rt]x_queue_setup( ), return error. Only per queue offloading can be sent to rte_eth_[rt]x_queue_setup( ). A per queue offloading is enabled only if it is enabled in rte_eth_dev_configure( ) OR if it is enabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is enabled in rte_eth_dev_configure(), it can't be disabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is disabled in rte_eth_dev_configure( ), it can be enabled or disabled( ) in rte_eth_[rt]x_queue_setup( ). This patch can make such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. Signed-off-by: Wei Dai --- lib/librte_ether/rte_ethdev.c | 56 +++ 1 file changed, 56 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f0f53d4..5485f47 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1196,6 +1196,28 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, ETHER_MAX_LEN; } + /* Any requested offload must be within its device capability */ + if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) != +local_conf.rxmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Rx offloads " + "0x%" PRIx64 " doesn't match Rx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.rxmode.offloads, + dev_info.rx_offload_capa); + return -EINVAL; + } + if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != +local_conf.txmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Tx offloads " + "0x%" PRIx64 " doesn't match Tx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.txmode.offloads, + dev_info.tx_offload_capa); + return -EINVAL; + } + /* * Setup new number of RX/TX queues and reconfigure device. */ @@ -1547,6 +1569,23 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from application. +* If any pure per-port offload is sent to this function, return -EINVAL +*/ + if ((local_conf.offloads & dev_info.rx_queue_offload_capa) != +local_conf.offloads) { + RTE_PMD_DEBUG_TRACE("Ethdev port_id=%d rx_queue_id=%d " + "Requested offload 0x%" PRIx64 "doesn't " + "match per-queue capability 0x%" PRIx64 + " in rte_eth_rx_queue_setup( )\n", + port_id, + rx_queue_id, + local_conf.offloads, + dev_info.rx_queue_offload_capa); + return -EINVAL; + } + ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, socket_id, &local_conf, mp); if (!ret) { @@ -1681,6 +1720,23 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from applcation. +* If any pure per-port offload is sent to this function, return -EINVAL +*/ + if ((local_conf.offloads & dev_info.tx_queue_offload_capa) != +local_conf.offloads) { + RTE_PMD_DEBUG_TRACE("Ethdev port_id=%d tx_queue_id=%d " + "Requested offload 0x%" PRIx64 "doesn't " + "match per-queue capability 0x%" PRIx64 + " in rte_eth_tx_queue_setup( )\n", + port_id, + tx_queue_id, +
[dpdk-dev] [PATCH v4] ethdev: check Rx/Tx offloads
This patch check if a requested offloading is supported in the device capability. Any offloading is disabled by default if it is not set in rte_eth_dev_configure( ) and rte_eth_[rt]x_queue_setup(). A per port offloading can only be enabled in rte_eth_dev_configure(). If a per port offloading is sent to rte_eth_[rt]x_queue_setup( ), return error. Only per queue offloading can be sent to rte_eth_[rt]x_queue_setup( ). A per queue offloading is enabled only if it is enabled in rte_eth_dev_configure( ) OR if it is enabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is enabled in rte_eth_dev_configure(), it can't be disabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is disabled in rte_eth_dev_configure( ), it can be enabled or disabled( ) in rte_eth_[rt]x_queue_setup( ). This patch can make such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. Signed-off-by: Wei Dai --- v4: fix a wrong description in git log message. v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- lib/librte_ether/rte_ethdev.c | 76 +++ 1 file changed, 76 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f0f53d4..70a7904 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1196,6 +1196,28 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, ETHER_MAX_LEN; } + /* Any requested offload must be within its device capability */ + if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) != +local_conf.rxmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Rx offloads " + "0x%" PRIx64 " doesn't match Rx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.rxmode.offloads, + dev_info.rx_offload_capa); + return -EINVAL; + } + if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != +local_conf.txmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Tx offloads " + "0x%" PRIx64 " doesn't match Tx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.txmode.offloads, + dev_info.tx_offload_capa); + return -EINVAL; + } + /* * Setup new number of RX/TX queues and reconfigure device. */ @@ -1547,6 +1569,33 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from application. +* If any pure per-port offload is sent to this function, return -EINVAL +*/ + if ((local_conf.offloads & dev_info.rx_queue_offload_capa) != +local_conf.offloads) { + RTE_PMD_DEBUG_TRACE("Ethdev port_id=%d rx_queue_id=%d " + "Requested offload 0x%" PRIx64 "doesn't " + "match per-queue capability 0x%" PRIx64 + " in rte_eth_rx_queue_setup( )\n", + port_id, + rx_queue_id, + local_conf.offloads, + dev_info.rx_queue_offload_capa); + return -EINVAL; + } + + /* +* If a per-queue offload is enabled in rte_eth_dev_configure( ), +* it is also enabled on all queues and can't be disabled here. +* If it is diabled in rte_eth_dev_configure( ), it can be enabled +* or disabled here. +* If a per-port offload is enabled in rte_eth_dev_configure( ), +* it is also enabled for all queues here. +*/ + local_conf.offloads |= dev->data->dev_conf.rxmode.offloads; + ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, socket_id, &local_conf, mp); if (!ret) { @@ -1681,6 +1730,33 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, &local_conf.offloads); } + /* +* On
[dpdk-dev] [PATCH v3] ethdev: check Rx/Tx offloads
This patch check if a requested offloading is supported in the device capability. Any offloading is disabled by default if it is not set in rte_eth_dev_configure( ) and rte_eth_[rt]x_queue_setup(). A per port offloading can only be enabled in rte_eth_dev_configure(). If a per port offloading is sent to rte_eth_[rt]x_queue_setup( ), return error. Only per queue offloading can be sent to rte_eth_dev_configure( ). A per queue offloading is enabled only if it is enabled in rte_eth_dev_configure( ) OR if it is enabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is enabled in rte_eth_dev_configure(), it can't be disabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is disabled in rte_eth_dev_configure( ), it can be enabled or disabled( ) in rte_eth_[rt]x_queue_setup( ). This patch can make such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. Signed-off-by: Wei Dai --- v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- lib/librte_ether/rte_ethdev.c | 76 +++ 1 file changed, 76 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f0f53d4..70a7904 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1196,6 +1196,28 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, ETHER_MAX_LEN; } + /* Any requested offload must be within its device capability */ + if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) != +local_conf.rxmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Rx offloads " + "0x%" PRIx64 " doesn't match Rx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.rxmode.offloads, + dev_info.rx_offload_capa); + return -EINVAL; + } + if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != +local_conf.txmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Tx offloads " + "0x%" PRIx64 " doesn't match Tx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.txmode.offloads, + dev_info.tx_offload_capa); + return -EINVAL; + } + /* * Setup new number of RX/TX queues and reconfigure device. */ @@ -1547,6 +1569,33 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from application. +* If any pure per-port offload is sent to this function, return -EINVAL +*/ + if ((local_conf.offloads & dev_info.rx_queue_offload_capa) != +local_conf.offloads) { + RTE_PMD_DEBUG_TRACE("Ethdev port_id=%d rx_queue_id=%d " + "Requested offload 0x%" PRIx64 "doesn't " + "match per-queue capability 0x%" PRIx64 + " in rte_eth_rx_queue_setup( )\n", + port_id, + rx_queue_id, + local_conf.offloads, + dev_info.rx_queue_offload_capa); + return -EINVAL; + } + + /* +* If a per-queue offload is enabled in rte_eth_dev_configure( ), +* it is also enabled on all queues and can't be disabled here. +* If it is diabled in rte_eth_dev_configure( ), it can be enabled +* or disabled here. +* If a per-port offload is enabled in rte_eth_dev_configure( ), +* it is also enabled for all queues here. +*/ + local_conf.offloads |= dev->data->dev_conf.rxmode.offloads; + ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, socket_id, &local_conf, mp); if (!ret) { @@ -1681,6 +1730,33 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from applcation. +* If any pure
[dpdk-dev] [PATCH v3] ethdev: check Rx/Tx offloads
This patch check if a requested offloading is supported in the device capability. Any offloading is disabled by default if it is not set in rte_eth_dev_configure( ) and rte_eth_[rt]x_queue_setup(). A per port offloading can only be enabled in rte_eth_dev_configure(). If a per port offloading is sent to rte_eth_[rt]x_queue_setup( ), return error. Only per queue offloading can be sent to rte_eth_dev_configure( ). A per queue offloading is enabled only if it is enabled in rte_eth_dev_configure( ) OR if it is enabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is enabled in rte_eth_dev_configure(), it can't be disabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is disabled in rte_eth_dev_configure( ), it can be enabled or disabled( ) in rte_eth_[rt]x_queue_setup( ). This patch can make such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. Signed-off-by: Wei Dai --- v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- lib/librte_ether/rte_ethdev.c | 76 +++ 1 file changed, 76 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f0f53d4..70a7904 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1196,6 +1196,28 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, ETHER_MAX_LEN; } + /* Any requested offload must be within its device capability */ + if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) != +local_conf.rxmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Rx offloads " + "0x%" PRIx64 " doesn't match Rx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.rxmode.offloads, + dev_info.rx_offload_capa); + return -EINVAL; + } + if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != +local_conf.txmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Tx offloads " + "0x%" PRIx64 " doesn't match Tx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.txmode.offloads, + dev_info.tx_offload_capa); + return -EINVAL; + } + /* * Setup new number of RX/TX queues and reconfigure device. */ @@ -1547,6 +1569,33 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from application. +* If any pure per-port offload is sent to this function, return -EINVAL +*/ + if ((local_conf.offloads & dev_info.rx_queue_offload_capa) != +local_conf.offloads) { + RTE_PMD_DEBUG_TRACE("Ethdev port_id=%d rx_queue_id=%d " + "Requested offload 0x%" PRIx64 "doesn't " + "match per-queue capability 0x%" PRIx64 + " in rte_eth_rx_queue_setup( )\n", + port_id, + rx_queue_id, + local_conf.offloads, + dev_info.rx_queue_offload_capa); + return -EINVAL; + } + + /* +* If a per-queue offload is enabled in rte_eth_dev_configure( ), +* it is also enabled on all queues and can't be disabled here. +* If it is diabled in rte_eth_dev_configure( ), it can be enabled +* or disabled here. +* If a per-port offload is enabled in rte_eth_dev_configure( ), +* it is also enabled for all queues here. +*/ + local_conf.offloads |= dev->data->dev_conf.rxmode.offloads; + ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, socket_id, &local_conf, mp); if (!ret) { @@ -1681,6 +1730,33 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from applcation. +* If any pure
[dpdk-dev] [PATCH] ethdev: check Rx/Tx offloads
This patch check if a requested offloading is supported in the device capability. Any offloading is disabled by default if it is not set in rte_eth_dev_configure( ) and rte_eth_[rt]x_queue_setup(). A per port offloading can only be enabled in rte_eth_dev_configure(). If a per port offloading is sent to rte_eth_[rt]x_queue_setup( ), return error. Only per queue offloading can be sent to rte_eth_dev_configure( ). A per queue offloading is enabled only if it is enabled in rte_eth_dev_configure( ) OR if it is enabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is enabled in rte_eth_dev_configure(), it can't be disabled in rte_eth_[rt]x_queue_setup( ). If a per queue offloading is disabled in rte_eth_dev_configure( ), it can be enabled or disabled( ) in rte_eth_[rt]x_queue_setup( ). This patch can make such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. Signed-off-by: Wei Dai --- v3: rework according to dicision of offloading API in community v2: add offloads checking in rte_eth_dev_configure( ). check if a requested offloading is supported. --- lib/librte_ether/rte_ethdev.c | 76 +++ 1 file changed, 76 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f0f53d4..70a7904 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1196,6 +1196,28 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, ETHER_MAX_LEN; } + /* Any requested offload must be within its device capability */ + if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) != +local_conf.rxmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Rx offloads " + "0x%" PRIx64 " doesn't match Rx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.rxmode.offloads, + dev_info.rx_offload_capa); + return -EINVAL; + } + if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != +local_conf.txmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Tx offloads " + "0x%" PRIx64 " doesn't match Tx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.txmode.offloads, + dev_info.tx_offload_capa); + return -EINVAL; + } + /* * Setup new number of RX/TX queues and reconfigure device. */ @@ -1547,6 +1569,33 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from application. +* If any pure per-port offload is sent to this function, return -EINVAL +*/ + if ((local_conf.offloads & dev_info.rx_queue_offload_capa) != +local_conf.offloads) { + RTE_PMD_DEBUG_TRACE("Ethdev port_id=%d rx_queue_id=%d " + "Requested offload 0x%" PRIx64 "doesn't " + "match per-queue capability 0x%" PRIx64 + " in rte_eth_rx_queue_setup( )\n", + port_id, + rx_queue_id, + local_conf.offloads, + dev_info.rx_queue_offload_capa); + return -EINVAL; + } + + /* +* If a per-queue offload is enabled in rte_eth_dev_configure( ), +* it is also enabled on all queues and can't be disabled here. +* If it is diabled in rte_eth_dev_configure( ), it can be enabled +* or disabled here. +* If a per-port offload is enabled in rte_eth_dev_configure( ), +* it is also enabled for all queues here. +*/ + local_conf.offloads |= dev->data->dev_conf.rxmode.offloads; + ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, socket_id, &local_conf, mp); if (!ret) { @@ -1681,6 +1730,33 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, &local_conf.offloads); } + /* +* Only per-queue offload can be enabled from applcation. +* If any pure
[dpdk-dev] [PATCH] net/ixgbe: fix missing suppport of multi-segs offloading
This patch adds missing supported Tx multi-segs offloading. Fixes: 51215925a32f ("net/ixgbe: convert to new Tx offloads API") Cc: sta...@dpdk.org Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 7511e18..aed3f5a 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2429,7 +2429,8 @@ ixgbe_get_tx_port_offloads(struct rte_eth_dev *dev) DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; + DEV_TX_OFFLOAD_TCP_TSO | + DEV_TX_OFFLOAD_MULTI_SEGS; if (hw->mac.type == ixgbe_mac_82599EB || hw->mac.type == ixgbe_mac_X540) -- 2.7.5
[dpdk-dev] [PATCH] net/ixgbe: fix segfault in configuring VF VLAN strip
This patch fixes a segment fault in ixgbevf_vlan_offload_set( ) when a Rx queue with index < max_rx_queues is not setup. For such queue, rxq = dev->data->rx_queues[i] is null pointer. Fixes: 860a94d3c692 ("net/ixgbe: support VLAN strip per queue offloading in VF") Cc: sta...@dpdk.org Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index a5e2fc0..33ee52e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -5184,15 +5184,13 @@ ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on) static int ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask) { - struct ixgbe_hw *hw = - IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ixgbe_rx_queue *rxq; uint16_t i; int on = 0; /* VF function only support hw strip feature, others are not support */ if (mask & ETH_VLAN_STRIP_MASK) { - for (i = 0; i < hw->mac.max_rx_queues; i++) { + for (i = 0; i < dev->data->nb_rx_queues; i++) { rxq = dev->data->rx_queues[i]; on = !!(rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP); ixgbevf_vlan_strip_queue_set(dev, i, on); -- 2.7.5
[dpdk-dev] [PATCH v7 2/2] app/testpmd: add commands to test new Tx offload API
Add following testpmd run-time commands to support test of new Tx offload API: tx_offload get capability tx_offload get configuration tx_offload enable|disable per_port tx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_insert", "udp_cksum", ... Signed-off-by: Wei Dai Acked-by: Jingjing Wu --- app/test-pmd/cmdline.c | 382 app/test-pmd/testpmd.c | 15 +- app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 44 4 files changed, 440 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index a6cecba..c28edb6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16369,6 +16369,384 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { } }; +/* Get Tx offloads capability */ +struct cmd_tx_offload_get_capa_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_capa_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_tx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +port_id, UINT16); + +static void +print_tx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_tx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_tx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.tx_queue_offload_capa; + port_offloads = dev_info.tx_offload_capa ^ queue_offloads; + + printf("Tx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_tx_offloads(queue_offloads); + printf("\n"); + printf(" Per Port :"); + print_tx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_tx_offload_get_capa = { + .f = cmd_tx_offload_get_capa_parsed, + .data = NULL, + .help_str = "tx_offload get capability ", + .tokens = { + (void *)&cmd_tx_offload_get_capa_tx_offload, + (void *)&cmd_tx_offload_get_capa_get, + (void *)&cmd_tx_offload_get_capa_capability, + (void *)&cmd_tx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Tx offloads configuration */ +struct cmd_tx_offload_get_configuration_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_tx_offload_get_configuration_port_id = + TOKEN_NUM_INIT
[dpdk-dev] [PATCH v7 1/2] app/testpmd: add commands to test new Rx offload API
Add following testpmd run-time commands to support test of new Rx offload API: rx_offload get capability rx_offload get configuration rx_offload enable|disable per_port rx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_strip", "ipv4_cksum", ... Signed-off-by: Wei Dai Acked-by: Jingjing Wu --- app/test-pmd/cmdline.c | 377 app/test-pmd/testpmd.c | 19 +- app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 43 4 files changed, 438 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 40b31ad..a6cecba 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15996,6 +15996,379 @@ cmdline_parse_inst_t cmd_ptype_mapping_update = { }, }; +/* Get Rx offloads capability */ +struct cmd_rx_offload_get_capa_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port_id, UINT16); + +static void +print_rx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_rx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_rx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.rx_queue_offload_capa; + port_offloads = dev_info.rx_offload_capa ^ queue_offloads; + + printf("Rx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_rx_offloads(queue_offloads); + + printf("\n"); + printf(" Per Port :"); + print_rx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_rx_offload_get_capa = { + .f = cmd_rx_offload_get_capa_parsed, + .data = NULL, + .help_str = "rx_offload get capability ", + .tokens = { + (void *)&cmd_rx_offload_get_capa_rx_offload, + (void *)&cmd_rx_offload_get_capa_get, + (void *)&cmd_rx_offload_get_capa_capability, + (void *)&cmd_rx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Rx offloads configuration */ +struct cmd_rx_offload_get_configuration_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_rx_offload_get_configuration_port_id = + TOKEN_NUM_INIT
[dpdk-dev] [PATCH v7 0/2] app/testpmd: add new commands to test new Tx/Rx offloads
Existed testpmd commands can't support per queue offload configuration. And there are different commands to enable or disable different offloading. This patch set add following commands to support new Tx/Rx offloading API test. To get Rx offload capability of a port, please run: testpmd > rx_offload get capability To get current Rx offload per queue and per port configuration of a port, run: tesstpmd > rx_offload get configuration To enable or disable a Rx per port offloading, please run: testpmd > rx_offload enable|disable per_port vlan_strip|ipv4_cksum|... This command will set|clear the associated bit in dev->dev_conf.rxmode.offloads for rte_eth_dev_configure and tx_conf->offloads of all Rx queues for rte_eth_rx_queue_setup( ). To enable or disable a Tx per port offloading, please run: testpmd > rx_offload enable|disable per_queue vlan_strip|ipv4_cksum|... Same commands like "tx_offload ..." are also added to support new Tx offload API test. Signed-off-by: Wei Dai Acked-by: Jingjing Wu --- v7: update testpmd document v6: reconfig port and queues if offloading is enabled or disabled v5: don't depend on enum types defined in rte_ethdev. v4: improve testpmd command per port offload to set or clear the port configuration and the queue configuration of all queues. v3: add enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type free memory of port->rx_offloads and port->tx_offloads when testpmd is existed v2: use rte_eth_dev_rx_offload_name() and rte_eth_dev_tx_offload_name(). remove static const strings of Rx/Tx offload names. Wei Dai (2): app/testpmd: add commands to test new Rx offload API app/testpmd: add commands to test new Tx offload API app/test-pmd/cmdline.c | 759 app/test-pmd/testpmd.c | 34 +- app/test-pmd/testpmd.h | 2 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 87 4 files changed, 878 insertions(+), 4 deletions(-) -- 2.9.5
[dpdk-dev] [PATCH v2 1/2] net/e1000: convert to new Rx offloads API
Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit support the new Rx offloads API. Signed-off-by: Wei Dai --- drivers/net/e1000/e1000_ethdev.h | 8 +++ drivers/net/e1000/em_ethdev.c| 42 ++- drivers/net/e1000/em_rxtx.c | 93 + drivers/net/e1000/igb_ethdev.c | 45 +--- drivers/net/e1000/igb_rxtx.c | 109 ++- 5 files changed, 240 insertions(+), 57 deletions(-) diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h index 23b089c..17b5806 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -357,6 +357,9 @@ void eth_igb_rx_queue_release(void *rxq); void igb_dev_clear_queues(struct rte_eth_dev *dev); void igb_dev_free_queues(struct rte_eth_dev *dev); +uint64_t igb_get_rx_port_offloads_capa(struct rte_eth_dev *dev); +uint64_t igb_get_rx_queue_offloads_capa(struct rte_eth_dev *dev); + int eth_igb_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, @@ -417,6 +420,8 @@ void igb_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, void igb_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo); +uint32_t em_get_max_pktlen(struct rte_eth_dev *dev); + /* * RX/TX EM function prototypes */ @@ -426,6 +431,9 @@ void eth_em_rx_queue_release(void *rxq); void em_dev_clear_queues(struct rte_eth_dev *dev); void em_dev_free_queues(struct rte_eth_dev *dev); +uint64_t em_get_rx_port_offloads_capa(struct rte_eth_dev *dev); +uint64_t em_get_rx_queue_offloads_capa(struct rte_eth_dev *dev); + int eth_em_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 2035ea8..e2ec4b1 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -451,9 +451,21 @@ eth_em_configure(struct rte_eth_dev *dev) { struct e1000_interrupt *intr = E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private); + struct rte_eth_dev_info dev_info; + uint64_t rx_offloads; PMD_INIT_FUNC_TRACE(); intr->flags |= E1000_FLAG_NEED_LINK_UPDATE; + + eth_em_infos_get(dev, &dev_info); + rx_offloads = dev->data->dev_conf.rxmode.offloads; + if ((rx_offloads & dev_info.rx_offload_capa) != rx_offloads) { + PMD_DRV_LOG(ERR, "Some Rx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + rx_offloads, dev_info.rx_offload_capa); + return -ENOTSUP; + } + PMD_INIT_FUNC_TRACE(); return 0; @@ -1017,9 +1029,11 @@ eth_em_rx_queue_intr_disable(struct rte_eth_dev *dev, __rte_unused uint16_t queu return 0; } -static uint32_t -em_get_max_pktlen(const struct e1000_hw *hw) +uint32_t +em_get_max_pktlen(struct rte_eth_dev *dev) { + struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); + switch (hw->mac.type) { case e1000_82571: case e1000_82572: @@ -1050,13 +1064,8 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev); dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */ - dev_info->max_rx_pktlen = em_get_max_pktlen(hw); + dev_info->max_rx_pktlen = em_get_max_pktlen(dev); dev_info->max_mac_addrs = hw->mac.rar_entry_count; - dev_info->rx_offload_capa = - DEV_RX_OFFLOAD_VLAN_STRIP | - DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM; dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | @@ -1083,6 +1092,10 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_queues = 1; dev_info->max_tx_queues = 1; + dev_info->rx_queue_offload_capa = em_get_rx_queue_offloads_capa(dev); + dev_info->rx_offload_capa = em_get_rx_port_offloads_capa(dev) | + dev_info->rx_queue_offload_capa; + dev_info->rx_desc_lim = (struct rte_eth_desc_lim) { .nb_max = E1000_MAX_RING_DESC, .nb_min = E1000_MIN_RING_DESC, @@ -1406,15 +1419,18 @@ em_vlan_hw_strip_enable(struct rte_eth_dev *dev) static int eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask) { + st
[dpdk-dev] [PATCH v2 0/2] net/e1000: convert to new Rx/Tx offloads API
This patch set convert net/e1000 to new Rx/Tx offloads API. All Rx offloads are per port features. All Tx offloads of e1000 are per queue and also per packet as they are enabled in Tx descriptor. In the new offload API, per queue offload only need to be set in queue_setup(). So if the maimum number of queues is only one in Rx or Tx path, let all offloads in the path are per queue for better convenience. --- v2: add offloads checking Wei Dai (2): net/e1000: convert to new Rx offloads API net/e1000: convert to new Tx offloads API drivers/net/e1000/e1000_ethdev.h | 14 drivers/net/e1000/em_ethdev.c| 58 ++ drivers/net/e1000/em_rxtx.c | 155 +--- drivers/net/e1000/igb_ethdev.c | 60 +++--- drivers/net/e1000/igb_rxtx.c | 167 +++ 5 files changed, 385 insertions(+), 69 deletions(-) -- 2.9.5
[dpdk-dev] [PATCH v2 2/2] net/e1000: convert to new Tx offloads API
Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new Tx offloads API. Signed-off-by: Wei Dai --- drivers/net/e1000/e1000_ethdev.h | 6 drivers/net/e1000/em_ethdev.c| 16 +++ drivers/net/e1000/em_rxtx.c | 62 drivers/net/e1000/igb_ethdev.c | 15 +- drivers/net/e1000/igb_rxtx.c | 58 + 5 files changed, 145 insertions(+), 12 deletions(-) diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h index 17b5806..6354b89 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -373,6 +373,9 @@ int eth_igb_rx_descriptor_done(void *rx_queue, uint16_t offset); int eth_igb_rx_descriptor_status(void *rx_queue, uint16_t offset); int eth_igb_tx_descriptor_status(void *tx_queue, uint16_t offset); +uint64_t igb_get_tx_port_offloads_capa(struct rte_eth_dev *dev); +uint64_t igb_get_tx_queue_offloads_capa(struct rte_eth_dev *dev); + int eth_igb_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); @@ -447,6 +450,9 @@ int eth_em_rx_descriptor_done(void *rx_queue, uint16_t offset); int eth_em_rx_descriptor_status(void *rx_queue, uint16_t offset); int eth_em_tx_descriptor_status(void *tx_queue, uint16_t offset); +uint64_t em_get_tx_port_offloads_capa(struct rte_eth_dev *dev); +uint64_t em_get_tx_queue_offloads_capa(struct rte_eth_dev *dev); + int eth_em_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index e2ec4b1..d37df8a 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -453,6 +453,7 @@ eth_em_configure(struct rte_eth_dev *dev) E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private); struct rte_eth_dev_info dev_info; uint64_t rx_offloads; + uint64_t tx_offloads; PMD_INIT_FUNC_TRACE(); intr->flags |= E1000_FLAG_NEED_LINK_UPDATE; @@ -465,6 +466,13 @@ eth_em_configure(struct rte_eth_dev *dev) rx_offloads, dev_info.rx_offload_capa); return -ENOTSUP; } + tx_offloads = dev->data->dev_conf.txmode.offloads; + if ((tx_offloads & dev_info.tx_offload_capa) != tx_offloads) { + PMD_DRV_LOG(ERR, "Some Tx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + tx_offloads, dev_info.tx_offload_capa); + return -ENOTSUP; + } PMD_INIT_FUNC_TRACE(); @@ -1066,11 +1074,6 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */ dev_info->max_rx_pktlen = em_get_max_pktlen(dev); dev_info->max_mac_addrs = hw->mac.rar_entry_count; - dev_info->tx_offload_capa = - DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM; /* * Starting with 631xESB hw supports 2 TX/RX queues per port. @@ -1095,6 +1098,9 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_queue_offload_capa = em_get_rx_queue_offloads_capa(dev); dev_info->rx_offload_capa = em_get_rx_port_offloads_capa(dev) | dev_info->rx_queue_offload_capa; + dev_info->tx_queue_offload_capa = em_get_tx_queue_offloads_capa(dev); + dev_info->tx_offload_capa = em_get_tx_port_offloads_capa(dev) | + dev_info->tx_queue_offload_capa; dev_info->rx_desc_lim = (struct rte_eth_desc_lim) { .nb_max = E1000_MAX_RING_DESC, diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 3291b5e..2b3c63e 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -164,6 +164,7 @@ struct em_tx_queue { uint8_twthresh; /**< Write-back threshold register. */ struct em_ctx_info ctx_cache; /**< Hardware context history.*/ + uint64_t offloads; /**< offloads of DEV_TX_OFFLOAD_* */ }; #if 1 @@ -1152,6 +1153,52 @@ em_reset_tx_queue(struct em_tx_queue *txq) memset((void*)&txq->ctx_cache, 0, sizeof (txq->ctx_cache)); } +uint64_t +em_get_tx_port_offloads_capa(struct rte_eth_dev *dev) +{ + uint64_t tx_offload_capa; + + RTE_SET_USED(dev)
[dpdk-dev] [PATCH v2] ethdev: check Rx/Tx offloads
This patch check if a requested offloading is supported in the device capability. A per port offloading feature should be enabled or disabled at same time in both rte_eth_dev_configure( ) and rte_eth_rx_queue_setup( )/rte_eth_tx_queue_setup( ). This patch check if a per port offloading flag has same configuration in rte_eth_dev_configure( ) and rte_eth_rx_queue_setup( )/rte_eth_tx_queue_setup( ). This patch can make such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. Signed-off-by: Wei Dai --- v2: add offlaods checking in rte_eth_dev_configure( ). check if a requested offloading is supported --- lib/librte_ether/rte_ethdev.c | 100 ++ 1 file changed, 100 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 0590f0c..a04a705 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1152,6 +1152,27 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, ETHER_MAX_LEN; } + if ((local_conf.rxmode.offloads & dev_info.rx_offload_capa) != +local_conf.rxmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Rx offloads " + "0x%" PRIx64 " doesn't match Rx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.rxmode.offloads, + dev_info.rx_offload_capa); + return -EINVAL; + } + if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) != +local_conf.txmode.offloads) { + RTE_PMD_DEBUG_TRACE("ethdev port_id=%d requested Tx offloads " + "0x%" PRIx64 " doesn't match Tx offloads " + "capability 0x%" PRIx64 "\n", + port_id, + local_conf.txmode.offloads, + dev_info.tx_offload_capa); + return -EINVAL; + } + /* * Setup new number of RX/TX queues and reconfigure device. */ @@ -1404,6 +1425,50 @@ rte_eth_dev_is_removed(uint16_t port_id) return ret; } +/** +* Check if the Rx/Tx queue offloading settings is valid +* @param queue_offloads +* offloads input to rte_eth_rx_queue_setup( ) or rte_eth_tx_queue_setup( ) +* @param port_offloads +* Rx or Tx offloads input to rte_eth_dev_configure( ) +* @param queue_offload_capa +* rx_queue_offload_capa or tx_queue_offload_capa in struct rte_eth_dev_ifnfo +* got from rte_eth_dev_info_get( ) +* @param all_offload_capa +* rx_offload_capa or tx_offload_capa in struct rte_eth_dev_info +* got from rte_eth_dev_info_get( ) +* +* @return +* Nonzero when per-queue offloading setting is valid +*/ +static int +rte_eth_check_queue_offloads(uint64_t queue_offloads, +uint64_t port_offloads, +uint64_t queue_offload_capa, +uint64_t all_offload_capa) +{ + uint64_t pure_port_capa = all_offload_capa ^ queue_offload_capa; + + if ((queue_offloads & all_offload_capa) != queue_offloads) + return 0; + + if ((port_offloads ^ queue_offloads) & pure_port_capa) + return 0; + + return 1; +} + +static int +rte_eth_check_rx_queue_offloads(uint64_t rx_queue_offloads, + const struct rte_eth_rxmode *rxmode, + const struct rte_eth_dev_info *dev_info) +{ + return rte_eth_check_queue_offloads(rx_queue_offloads, + rxmode->offloads, + dev_info->rx_queue_offload_capa, + dev_info->rx_offload_capa); +} + int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, @@ -1495,6 +1560,18 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &local_conf.offloads); } + if (!rte_eth_check_rx_queue_offloads(local_conf.offloads, + &dev->data->dev_conf.rxmode, &dev_info)) { + RTE_PMD_DEBUG_TRACE("Ethdev port %d : Rx queue offloads ox%" + PRIx64 " don't match port offloads 0x%" PRIx64 + " or supported offloads 0x%" PRIx64 "\n", + port_id, + local_conf.offloads, + dev->d
[dpdk-dev] [PATCH v2 2/2] net/fm10k: convert to new Tx offloads API
Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new Rx and Tx offloads API. Signed-off-by: Wei Dai --- drivers/net/fm10k/fm10k.h | 1 + drivers/net/fm10k/fm10k_ethdev.c | 68 ++ drivers/net/fm10k/fm10k_rxtx_vec.c | 2 +- 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index d3c80c2..ce0f2c8 100644 --- a/drivers/net/fm10k/fm10k.h +++ b/drivers/net/fm10k/fm10k.h @@ -213,6 +213,7 @@ struct fm10k_tx_queue { uint16_t next_dd; /* Next pos to check DD flag */ volatile uint32_t *tail_ptr; uint32_t txq_flags; /* Holds flags for this TXq */ + uint64_t offloads; /* Offloads of DEV_TX_OFFLOAD_* */ uint16_t nb_desc; uint16_t port_id; uint8_t tx_deferred_start; /** don't start this queue in dev start. */ diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index d2c47f6..61de4d7 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -64,6 +64,9 @@ static void fm10k_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static uint64_t fm10k_get_rx_queue_offloads_capa(struct rte_eth_dev *dev); static uint64_t fm10k_get_rx_port_offloads_capa(struct rte_eth_dev *dev); +static uint64_t fm10k_get_tx_queue_offloads_capa(struct rte_eth_dev *dev); +static uint64_t fm10k_get_tx_port_offloads_capa(struct rte_eth_dev *dev); + struct fm10k_xstats_name_off { char name[RTE_ETH_XSTATS_NAME_SIZE]; unsigned offset; @@ -447,6 +450,7 @@ fm10k_dev_configure(struct rte_eth_dev *dev) int ret; struct rte_eth_dev_info dev_info; uint64_t rx_offloads = dev->data->dev_conf.rxmode.offloads; + uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads; PMD_INIT_FUNC_TRACE(); @@ -460,6 +464,13 @@ fm10k_dev_configure(struct rte_eth_dev *dev) rx_offloads, dev_info.rx_offload_capa); return -ENOTSUP; } + if ((tx_offloads & dev_info.tx_offload_capa) != tx_offloads) { + PMD_DRV_LOG(ERR, "Some Tx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + tx_offloads, dev_info.tx_offload_capa); + return -ENOTSUP; + } + /* multipe queue mode checking */ ret = fm10k_check_mq_mode(dev); if (ret != 0) { @@ -1408,12 +1419,9 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, dev_info->rx_queue_offload_capa = fm10k_get_rx_queue_offloads_capa(dev); dev_info->rx_offload_capa = fm10k_get_rx_port_offloads_capa(dev) | dev_info->rx_queue_offload_capa; - dev_info->tx_offload_capa = - DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; + dev_info->tx_queue_offload_capa = fm10k_get_tx_queue_offloads_capa(dev); + dev_info->tx_offload_capa = fm10k_get_tx_port_offloads_capa(dev) | + dev_info->tx_queue_offload_capa; dev_info->hash_key_size = FM10K_RSSRK_SIZE * sizeof(uint32_t); dev_info->reta_size = FM10K_MAX_RSS_INDICES; @@ -1438,6 +1446,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, .tx_free_thresh = FM10K_TX_FREE_THRESH_DEFAULT(0), .tx_rs_thresh = FM10K_TX_RS_THRESH_DEFAULT(0), .txq_flags = FM10K_SIMPLE_TX_FLAG, + .offloads = 0, }; dev_info->rx_desc_lim = (struct rte_eth_desc_lim) { @@ -2015,6 +2024,40 @@ handle_txconf(struct fm10k_tx_queue *q, const struct rte_eth_txconf *conf) return 0; } +static uint64_t fm10k_get_tx_queue_offloads_capa(struct rte_eth_dev *dev) +{ + RTE_SET_USED(dev); + + return 0; +} + +static uint64_t fm10k_get_tx_port_offloads_capa(struct rte_eth_dev *dev) +{ + RTE_SET_USED(dev); + + return (uint64_t)(DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_TCP_TSO); +} + +static int +fm10k_check_tx_queue_offloads(struct rte_eth_dev *dev, uint64_t requested) +{ + uint64_t port_offloads = dev->data->dev_conf.txmode.offloads; + uint64_t queue_supported = fm10k_get_tx_queue_offloads_capa(dev); + uint64_t port_supported = fm10k_get_tx_port_offloads_capa(dev); + + if ((requested & (queue_supported | port_supported)) != requested) +
[dpdk-dev] [PATCH v2 1/2] net/fm10k: convert to new Rx offloads API
Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit support the new Rx offloads API. Signed-off-by: Wei Dai --- drivers/net/fm10k/fm10k.h | 1 + drivers/net/fm10k/fm10k_ethdev.c | 88 +- drivers/net/fm10k/fm10k_rxtx_vec.c | 4 +- 3 files changed, 81 insertions(+), 12 deletions(-) diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index 30dad3e..d3c80c2 100644 --- a/drivers/net/fm10k/fm10k.h +++ b/drivers/net/fm10k/fm10k.h @@ -180,6 +180,7 @@ struct fm10k_rx_queue { uint8_t drop_en; uint8_t rx_deferred_start; /* don't start this queue in dev start. */ uint16_t rx_ftag_en; /* indicates FTAG RX supported */ + uint64_t offloads; /* offloads of DEV_RX_OFFLOAD_* */ }; /* diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 9423761..d2c47f6 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -60,6 +60,10 @@ static void fm10k_set_tx_function(struct rte_eth_dev *dev); static int fm10k_check_ftag(struct rte_devargs *devargs); static int fm10k_link_update(struct rte_eth_dev *dev, int wait_to_complete); +static void fm10k_dev_infos_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); +static uint64_t fm10k_get_rx_queue_offloads_capa(struct rte_eth_dev *dev); +static uint64_t fm10k_get_rx_port_offloads_capa(struct rte_eth_dev *dev); struct fm10k_xstats_name_off { char name[RTE_ETH_XSTATS_NAME_SIZE]; unsigned offset; @@ -441,11 +445,21 @@ static int fm10k_dev_configure(struct rte_eth_dev *dev) { int ret; + struct rte_eth_dev_info dev_info; + uint64_t rx_offloads = dev->data->dev_conf.rxmode.offloads; PMD_INIT_FUNC_TRACE(); - if (dev->data->dev_conf.rxmode.hw_strip_crc == 0) + if ((rx_offloads & DEV_RX_OFFLOAD_CRC_STRIP) == 0) PMD_INIT_LOG(WARNING, "fm10k always strip CRC"); + + fm10k_dev_infos_get(dev, &dev_info); + if ((rx_offloads & dev_info.rx_offload_capa) != rx_offloads) { + PMD_DRV_LOG(ERR, "Some Rx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + rx_offloads, dev_info.rx_offload_capa); + return -ENOTSUP; + } /* multipe queue mode checking */ ret = fm10k_check_mq_mode(dev); if (ret != 0) { @@ -454,6 +468,8 @@ fm10k_dev_configure(struct rte_eth_dev *dev) return ret; } + dev->data->scattered_rx = 0; + return 0; } @@ -756,7 +772,7 @@ fm10k_dev_rx_init(struct rte_eth_dev *dev) /* It adds dual VLAN length for supporting dual VLAN */ if ((dev->data->dev_conf.rxmode.max_rx_pkt_len + 2 * FM10K_VLAN_TAG_SIZE) > buf_size || - dev->data->dev_conf.rxmode.enable_scatter) { + rxq->offloads & DEV_RX_OFFLOAD_SCATTER) { uint32_t reg; dev->data->scattered_rx = 1; reg = FM10K_READ_REG(hw, FM10K_SRRCTL(i)); @@ -1389,11 +1405,9 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, dev_info->vmdq_queue_base= 0; dev_info->max_vmdq_pools = ETH_32_POOLS; dev_info->vmdq_queue_num = FM10K_MAX_QUEUES_PF; - dev_info->rx_offload_capa = - DEV_RX_OFFLOAD_VLAN_STRIP | - DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM; + dev_info->rx_queue_offload_capa = fm10k_get_rx_queue_offloads_capa(dev); + dev_info->rx_offload_capa = fm10k_get_rx_port_offloads_capa(dev) | + dev_info->rx_queue_offload_capa; dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | @@ -1412,6 +1426,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, }, .rx_free_thresh = FM10K_RX_FREE_THRESH_DEFAULT(0), .rx_drop_en = 0, + .offloads = 0, }; dev_info->default_txconf = (struct rte_eth_txconf) { @@ -1571,19 +1586,22 @@ static int fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask) { if (mask & ETH_VLAN_STRIP_MASK) { - if (!dev->data->dev_conf.rxmode.hw_vlan_strip) + if (!(dev->data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_STRIP)) PMD_INIT_LOG(ERR, "VLAN stripping is " "always on in fm10k&q
[dpdk-dev] [PATCH v2 0/2] net/fm10k: convert to new Rx/Tx offloads API
This patch set support new offloads API in fm10k PF and VF. --- v2: Add Header_Split in per port Rx capability. Add Rx/Tx offloading checking Wei Dai (2): net/fm10k: convert to new Rx offloads API net/fm10k: convert to new Tx offloads API drivers/net/fm10k/fm10k.h | 2 + drivers/net/fm10k/fm10k_ethdev.c | 156 + drivers/net/fm10k/fm10k_rxtx_vec.c | 6 +- 3 files changed, 145 insertions(+), 19 deletions(-) -- 2.9.5
[dpdk-dev] [PATCH v6 0/2] app/testpmd: add new commands to test new Tx/Rx offloads
Existed testpmd commands can't support per queue offload configuration. And there are different commands to enable or disable different offloading. This patch set add following commands to support new Tx/Rx offloading API test. To get Rx offload capability of a port, please run: testpmd > rx_offload get capability To get current Rx offload per queue and per port configuration of a port, run: tesstpmd > rx_offload get configuration To enable or disable a Rx per port offloading, please run: testpmd > rx_offload enable|disable per_port vlan_strip|ipv4_cksum|... This command will set|clear the associated bit in dev->dev_conf.rxmode.offloads for rte_eth_dev_configure and tx_conf->offloads of all Rx queues for rte_eth_rx_queue_setup( ). To enable or disable a Tx per port offloading, please run: testpmd > rx_offload enable|disable per_queue vlan_strip|ipv4_cksum|... Same commands like "tx_offload ..." are also added to support new Tx offload API test. --- v6: reconfig port and queues if offloading is enabled or disabled v5: don't depend on enum types defined in rte_ethdev. v4: improve testpmd command per port offload to set or clear the port configuration and the queue configuration of all queues. v3: add enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type free memory of port->rx_offloads and port->tx_offloads when testpmd is existed v2: use rte_eth_dev_rx_offload_name() and rte_eth_dev_tx_offload_name(). remove static const strings of Rx/Tx offload names. Wei Dai (2): app/testpmd: add commands to test new Rx offload API app/testpmd: add commands to test new Tx offload API app/test-pmd/cmdline.c | 759 + app/test-pmd/testpmd.c | 34 ++- app/test-pmd/testpmd.h | 2 + 3 files changed, 791 insertions(+), 4 deletions(-) -- 2.9.5
[dpdk-dev] [PATCH v6 1/2] app/testpmd: add commands to test new Rx offload API
Add following testpmd run-time commands to support test of new Rx offload API: rx_offload get capability rx_offload get configuration rx_offload enable|disable per_port rx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_strip", "ipv4_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 377 + app/test-pmd/testpmd.c | 19 ++- app/test-pmd/testpmd.h | 1 + 3 files changed, 395 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 40b31ad..a6cecba 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15996,6 +15996,379 @@ cmdline_parse_inst_t cmd_ptype_mapping_update = { }, }; +/* Get Rx offloads capability */ +struct cmd_rx_offload_get_capa_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port_id, UINT16); + +static void +print_rx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_rx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_rx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.rx_queue_offload_capa; + port_offloads = dev_info.rx_offload_capa ^ queue_offloads; + + printf("Rx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_rx_offloads(queue_offloads); + + printf("\n"); + printf(" Per Port :"); + print_rx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_rx_offload_get_capa = { + .f = cmd_rx_offload_get_capa_parsed, + .data = NULL, + .help_str = "rx_offload get capability ", + .tokens = { + (void *)&cmd_rx_offload_get_capa_rx_offload, + (void *)&cmd_rx_offload_get_capa_get, + (void *)&cmd_rx_offload_get_capa_capability, + (void *)&cmd_rx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Rx offloads configuration */ +struct cmd_rx_offload_get_configuration_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_rx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v6 2/2] app/testpmd: add commands to test new Tx offload API
Add following testpmd run-time commands to support test of new Tx offload API: tx_offload get capability tx_offload get configuration tx_offload enable|disable per_port tx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_insert", "udp_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 382 + app/test-pmd/testpmd.c | 15 +- app/test-pmd/testpmd.h | 1 + 3 files changed, 396 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index a6cecba..c28edb6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16369,6 +16369,384 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { } }; +/* Get Tx offloads capability */ +struct cmd_tx_offload_get_capa_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_capa_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_tx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +port_id, UINT16); + +static void +print_tx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_tx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_tx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.tx_queue_offload_capa; + port_offloads = dev_info.tx_offload_capa ^ queue_offloads; + + printf("Tx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_tx_offloads(queue_offloads); + printf("\n"); + printf(" Per Port :"); + print_tx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_tx_offload_get_capa = { + .f = cmd_tx_offload_get_capa_parsed, + .data = NULL, + .help_str = "tx_offload get capability ", + .tokens = { + (void *)&cmd_tx_offload_get_capa_tx_offload, + (void *)&cmd_tx_offload_get_capa_get, + (void *)&cmd_tx_offload_get_capa_capability, + (void *)&cmd_tx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Tx offloads configuration */ +struct cmd_tx_offload_get_configuration_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_tx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v4 3/4] net/ixgbe: convert to new Rx offloads API
Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit support the new Rx offloads API. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 93 +++--- drivers/net/ixgbe/ixgbe_ipsec.c | 8 +- drivers/net/ixgbe/ixgbe_rxtx.c| 195 +- drivers/net/ixgbe/ixgbe_rxtx.h| 3 + drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 5 - drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 2 +- 6 files changed, 196 insertions(+), 110 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 8bb67ba..9437f05 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2105,19 +2105,22 @@ ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) static int ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) { + struct rte_eth_rxmode *rxmode; + rxmode = &dev->data->dev_conf.rxmode; + if (mask & ETH_VLAN_STRIP_MASK) { ixgbe_vlan_hw_strip_config(dev); } if (mask & ETH_VLAN_FILTER_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_filter) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER) ixgbe_vlan_hw_filter_enable(dev); else ixgbe_vlan_hw_filter_disable(dev); } if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_extend) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND) ixgbe_vlan_hw_extend_enable(dev); else ixgbe_vlan_hw_extend_disable(dev); @@ -2332,6 +2335,8 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)dev->data->dev_private; + struct rte_eth_dev_info dev_info; + uint64_t rx_offloads; int ret; PMD_INIT_FUNC_TRACE(); @@ -2343,6 +2348,15 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) return ret; } + ixgbe_dev_info_get(dev, &dev_info); + rx_offloads = dev->data->dev_conf.rxmode.offloads; + if ((rx_offloads & dev_info.rx_offload_capa) != rx_offloads) { + PMD_DRV_LOG(ERR, "Some Rx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + rx_offloads, dev_info.rx_offload_capa); + return -ENOTSUP; + } + /* set flag to update link status after init */ intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; @@ -3632,30 +3646,9 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) else dev_info->max_vmdq_pools = ETH_64_POOLS; dev_info->vmdq_queue_num = dev_info->max_rx_queues; - dev_info->rx_offload_capa = - DEV_RX_OFFLOAD_VLAN_STRIP | - DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM | - DEV_RX_OFFLOAD_CRC_STRIP; - - /* -* RSC is only supported by 82599 and x540 PF devices in a non-SR-IOV -* mode. -*/ - if ((hw->mac.type == ixgbe_mac_82599EB || -hw->mac.type == ixgbe_mac_X540) && - !RTE_ETH_DEV_SRIOV(dev).active) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; - - if (hw->mac.type == ixgbe_mac_82599EB || - hw->mac.type == ixgbe_mac_X540) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_MACSEC_STRIP; - - if (hw->mac.type == ixgbe_mac_X550 || - hw->mac.type == ixgbe_mac_X550EM_x || - hw->mac.type == ixgbe_mac_X550EM_a) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); + dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | +dev_info->rx_queue_offload_capa); dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | @@ -3675,10 +3668,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; #ifdef RTE_LIBRTE_SECURITY - if (dev->security_ctx) { - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_SECURITY; + if (dev->security_ctx) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY; - } #endif dev_info->default_rxconf = (struct rte_eth_rxconf) { @@ -3689,6 +3680,7
[dpdk-dev] [PATCH v4 4/4] net/ixgbe: convert to new Tx offloads API
Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new Tx offloads API. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 56 +--- drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++- drivers/net/ixgbe/ixgbe_rxtx.c | 79 ++-- drivers/net/ixgbe/ixgbe_rxtx.h | 3 ++ 4 files changed, 108 insertions(+), 35 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 9437f05..6288690 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2337,6 +2337,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) (struct ixgbe_adapter *)dev->data->dev_private; struct rte_eth_dev_info dev_info; uint64_t rx_offloads; + uint64_t tx_offloads; int ret; PMD_INIT_FUNC_TRACE(); @@ -2356,6 +2357,13 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) rx_offloads, dev_info.rx_offload_capa); return -ENOTSUP; } + tx_offloads = dev->data->dev_conf.txmode.offloads; + if ((tx_offloads & dev_info.tx_offload_capa) != tx_offloads) { + PMD_DRV_LOG(ERR, "Some Tx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + tx_offloads, dev_info.tx_offload_capa); + return -ENOTSUP; + } /* set flag to update link status after init */ intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; @@ -3649,28 +3657,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); - - dev_info->tx_offload_capa = - DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM | - DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; - - if (hw->mac.type == ixgbe_mac_82599EB || - hw->mac.type == ixgbe_mac_X540) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_MACSEC_INSERT; - - if (hw->mac.type == ixgbe_mac_X550 || - hw->mac.type == ixgbe_mac_X550EM_x || - hw->mac.type == ixgbe_mac_X550EM_a) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; - -#ifdef RTE_LIBRTE_SECURITY - if (dev->security_ctx) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY; -#endif + dev_info->tx_queue_offload_capa = ixgbe_get_tx_queue_offloads(dev); + dev_info->tx_offload_capa = ixgbe_get_tx_port_offloads(dev); dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { @@ -3692,7 +3680,9 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOOFFLOADS, +ETH_TXQ_FLAGS_NOOFFLOADS | +ETH_TXQ_FLAGS_IGNORE, + .offloads = 0, }; dev_info->rx_desc_lim = rx_desc_lim; @@ -3776,12 +3766,8 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); - dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM | - DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; + dev_info->tx_queue_offload_capa = ixgbe_get_tx_queue_offloads(dev); + dev_info->tx_offload_capa = ixgbe_get_tx_port_offloads(dev); dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { @@ -3803,7 +3789,9 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOOFFLOADS, +ETH_TXQ_FLAGS_NOOFFLOADS | +ETH_TXQ_FLAGS_IGNORE, +
[dpdk-dev] [PATCH v4 2/4] net/ixgbe: support VLAN strip per queue offloading in VF
VLAN strip is a per queue offloading in VF. With this patch it can be enabled or disabled on any Rx queue in VF. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 73755d2..8bb67ba 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -5215,15 +5215,17 @@ ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ixgbe_rx_queue *rxq; uint16_t i; int on = 0; /* VF function only support hw strip feature, others are not support */ if (mask & ETH_VLAN_STRIP_MASK) { - on = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); - - for (i = 0; i < hw->mac.max_rx_queues; i++) + for (i = 0; i < hw->mac.max_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + on = !!(rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP); ixgbevf_vlan_strip_queue_set(dev, i, on); + } } return 0; -- 2.9.5
[dpdk-dev] [PATCH v4 1/4] net/ixgbe: support VLAN strip per queue offloading in PF
VLAN strip is a per queue offloading in PF. With this patch it can be enabled or disabled on any Rx queue in PF. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 109 +-- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_rxtx.c | 1 + drivers/net/ixgbe/ixgbe_rxtx.h | 1 + 5 files changed, 51 insertions(+), 69 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4483258..73755d2 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2001,64 +2001,6 @@ ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue) ixgbe_vlan_hw_strip_bitmap_set(dev, queue, 1); } -void -ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev) -{ - struct ixgbe_hw *hw = - IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t ctrl; - uint16_t i; - struct ixgbe_rx_queue *rxq; - - PMD_INIT_FUNC_TRACE(); - - if (hw->mac.type == ixgbe_mac_82598EB) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); - ctrl &= ~IXGBE_VLNCTRL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); - } else { - /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */ - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); - ctrl &= ~IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); - - /* record those setting for HW strip per queue */ - ixgbe_vlan_hw_strip_bitmap_set(dev, i, 0); - } - } -} - -void -ixgbe_vlan_hw_strip_enable_all(struct rte_eth_dev *dev) -{ - struct ixgbe_hw *hw = - IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t ctrl; - uint16_t i; - struct ixgbe_rx_queue *rxq; - - PMD_INIT_FUNC_TRACE(); - - if (hw->mac.type == ixgbe_mac_82598EB) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); - ctrl |= IXGBE_VLNCTRL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); - } else { - /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */ - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); - ctrl |= IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); - - /* record those setting for HW strip per queue */ - ixgbe_vlan_hw_strip_bitmap_set(dev, i, 1); - } - } -} - static void ixgbe_vlan_hw_extend_disable(struct rte_eth_dev *dev) { @@ -2114,14 +2056,57 @@ ixgbe_vlan_hw_extend_enable(struct rte_eth_dev *dev) */ } +void +ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) +{ + struct ixgbe_hw *hw = + IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; + uint32_t ctrl; + uint16_t i; + struct ixgbe_rx_queue *rxq; + bool on; + + PMD_INIT_FUNC_TRACE(); + + if (hw->mac.type == ixgbe_mac_82598EB) { + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) { + ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); + ctrl |= IXGBE_VLNCTRL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); + } else { + ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); + ctrl &= ~IXGBE_VLNCTRL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); + } + } else { + /* +* Other 10G NIC, the VLAN strip can be setup +* per queue in RXDCTL +*/ + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); + if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) { + ctrl |= IXGBE_RXDCTL_VME; + on = TRUE; + } else { + ctrl &= ~IXGBE_RXDCTL_VME; + on = FALSE; + } + IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); + + /* record those setting for HW strip per queue */ +
[dpdk-dev] [PATCH v4 0/4] net/ixgbe: convert to new offloads API
This patch set adds support of per queue VLAN strip offloading in ixgbe PF and VF. This patch support new offloads API in ixgbe PF and VF. --- v4: don't support header spliting any more v3: Rx header spliting capability is only enabled in #ifdef RTE_HEADER_SPLIT_ENABLE. Tx vector tranmit function only work without any Tx offloads. v2: improve error checking Wei Dai (4): net/ixgbe: support VLAN strip per queue offloading in PF net/ixgbe: support VLAN strip per queue offloading in VF net/ixgbe: convert to new Rx offloads API net/ixgbe: convert to new Tx offloads API drivers/net/ixgbe/ixgbe_ethdev.c | 264 ++-- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_ipsec.c | 13 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_rxtx.c| 275 +++--- drivers/net/ixgbe/ixgbe_rxtx.h| 7 + drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 5 - drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 2 +- 8 files changed, 359 insertions(+), 216 deletions(-) -- 2.9.5
[dpdk-dev] [PATCH] ethdev: add enum type for loop on Rx/Tx offloads
This patch adds enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type. For a loop on all Rx offloads, it is convenient to begin with the first enum member ETH_RX_OFFLOAD_FIRST_FEATURE and to end at ETH_RX_OFFLOAD_TOTAL_NUM. A loop on all Tx offloads can begin with ETH_TX_OFFLOAD_FIRST_FEATURE and end at ETH_TX_OFFLOAD_TOTAL_NUM. Signed-off-by: Wei Dai --- lib/librte_ether/rte_ethdev.h | 44 +++ 1 file changed, 44 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0361533..0089ea3 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -946,6 +946,27 @@ struct rte_eth_conf { DEV_RX_OFFLOAD_VLAN_FILTER | \ DEV_RX_OFFLOAD_VLAN_EXTEND) +enum rte_eth_rx_offload_type { + ETH_RX_OFFLOAD_FIRST_FEATURE = 0, + ETH_RX_OFFLOAD_VLAN_STRIP = ETH_RX_OFFLOAD_FIRST_FEATURE, + ETH_RX_OFFLOAD_IPV4_CKSUM, + ETH_RX_OFFLOAD_UDP_CKSUM, + ETH_RX_OFFLOAD_TCP_CKSUM, + ETH_RX_OFFLOAD_TCP_LRO, + ETH_RX_OFFLOAD_QINQ_STRIP, + ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, + ETH_RX_OFFLOAD_MACSEC_STRIP, + ETH_RX_OFFLOAD_HEADER_SPLIT, + ETH_RX_OFFLOAD_VLAN_FILTER, + ETH_RX_OFFLOAD_VLAN_EXTEND, + ETH_RX_OFFLOAD_JUMBO_FRAME, + ETH_RX_OFFLOAD_CRC_STRIP, + ETH_RX_OFFLOAD_SCATTER, + ETH_RX_OFFLOAD_TIMESTAMP, + ETH_RX_OFFLOAD_SECURITY, + ETH_RX_OFFLOAD_TOTAL_NUM +}; + /* * If new Rx offload capabilities are defined, they also must be * mentioned in rte_rx_offload_names in rte_ethdev.c file. @@ -981,6 +1002,29 @@ struct rte_eth_conf { */ #define DEV_TX_OFFLOAD_SECURITY 0x0002 +enum rte_eth_tx_offload_type { + ETH_TX_OFFLOAD_FIRST_FEATURE = 0, + ETH_TX_OFFLOAD_VLAN_INSERT = ETH_TX_OFFLOAD_FIRST_FEATURE, + ETH_TX_OFFLOAD_IPV4_CKSUM, + ETH_TX_OFFLOAD_UDP_CKSUM, + ETH_TX_OFFLOAD_TCP_CKSUM, + ETH_TX_OFFLOAD_SCTP_CKSUM, + ETH_TX_OFFLOAD_TCP_TSO, + ETH_TX_OFFLOAD_UDP_TSO, + ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM, + ETH_TX_OFFLOAD_QINQ_INSERT, + ETH_TX_OFFLOAD_VXLAN_TNL_TSO, + ETH_TX_OFFLOAD_GRE_TNL_TSO, + ETH_TX_OFFLOAD_IPIP_TNL_TSO, + ETH_TX_OFFLOAD_GENEVE_TNL_TSO, + ETH_TX_OFFLOAD_MACSEC_INSERT, + ETH_TX_OFFLOAD_MT_LOCKFREE, + ETH_TX_OFFLOAD_MULTI_SEGS, + ETH_TX_OFFLOAD_MBUF_FAST_FREE, + ETH_TX_OFFLOAD_SECURITY, + ETH_TX_OFFLOAD_TOTAL_NUM +}; + /* * If new Tx offload capabilities are defined, they also must be * mentioned in rte_tx_offload_names in rte_ethdev.c file. -- 2.7.5
[dpdk-dev] [PATCH v5 1/2] app/testpmd: add commands to test new Rx offload API
Add following testpmd run-time commands to support test of new Rx offload API: rx_offload get capability rx_offload get configuration rx_offload enable|disable per_port rx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_strip", "ipv4_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 373 + app/test-pmd/testpmd.c | 19 ++- app/test-pmd/testpmd.h | 1 + 3 files changed, 391 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 40b31ad..017416b 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15996,6 +15996,375 @@ cmdline_parse_inst_t cmd_ptype_mapping_update = { }, }; +/* Get Rx offloads capability */ +struct cmd_rx_offload_get_capa_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port_id, UINT16); + +static void +print_rx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_rx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_rx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.rx_queue_offload_capa; + port_offloads = dev_info.rx_offload_capa ^ queue_offloads; + + printf("Rx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_rx_offloads(queue_offloads); + + printf("\n"); + printf(" Per Port :"); + print_rx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_rx_offload_get_capa = { + .f = cmd_rx_offload_get_capa_parsed, + .data = NULL, + .help_str = "rx_offload get capability ", + .tokens = { + (void *)&cmd_rx_offload_get_capa_rx_offload, + (void *)&cmd_rx_offload_get_capa_get, + (void *)&cmd_rx_offload_get_capa_capability, + (void *)&cmd_rx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Rx offloads configuration */ +struct cmd_rx_offload_get_configuration_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_rx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v5 2/2] app/testpmd: add commands to test new Tx offload API
Add following testpmd run-time commands to support test of new Tx offload API: tx_offload get capability tx_offload get configuration tx_offload enable|disable per_port tx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_insert", "udp_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 378 + app/test-pmd/testpmd.c | 15 +- app/test-pmd/testpmd.h | 1 + 3 files changed, 392 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 017416b..20b4397 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16365,6 +16365,380 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { } }; +/* Get Tx offloads capability */ +struct cmd_tx_offload_get_capa_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_capa_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_tx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +port_id, UINT16); + +static void +print_tx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_tx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_tx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.tx_queue_offload_capa; + port_offloads = dev_info.tx_offload_capa ^ queue_offloads; + + printf("Tx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_tx_offloads(queue_offloads); + printf("\n"); + printf(" Per Port :"); + print_tx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_tx_offload_get_capa = { + .f = cmd_tx_offload_get_capa_parsed, + .data = NULL, + .help_str = "tx_offload get capability ", + .tokens = { + (void *)&cmd_tx_offload_get_capa_tx_offload, + (void *)&cmd_tx_offload_get_capa_get, + (void *)&cmd_tx_offload_get_capa_capability, + (void *)&cmd_tx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Tx offloads configuration */ +struct cmd_tx_offload_get_configuration_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_tx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v5 0/2] app/testpmd: add new commands to test new Tx/Rx offloads
Existed testpmd commands can't support per queue offload configuration. And there are different commands to enable or disable different offloading. This patch set add following commands to support new Tx/Rx offloading API test. To get Rx offload capability of a port, please run: testpmd > rx_offload get capability To get current Rx offload per queue and per port configuration of a port, run: tesstpmd > rx_offload get configuration To enable or disable a Rx per port offloading, please run: testpmd > rx_offload enable|disable per_port vlan_strip|ipv4_cksum|... This command will set|clear the associated bit in dev->dev_conf.rxmode.offloads for rte_eth_dev_configure and tx_conf->offloads of all Rx queues for rte_eth_rx_queue_setup( ). To enable or disable a Tx per port offloading, please run: testpmd > rx_offload enable|disable per_queue vlan_strip|ipv4_cksum|... Same commands like "tx_offload ..." are also added to support new Tx offload API test. --- v5: don't depend on enum types defined in rte_ethdev. v4: improve testpmd command per port offload to set or clear the port configuration and the queue configuration of all queues. v3: add enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type free memory of port->rx_offloads and port->tx_offloads when testpmd is existed v2: use rte_eth_dev_rx_offload_name() and rte_eth_dev_tx_offload_name(). remove static const strings of Rx/Tx offload names. Wei Dai (2): app/testpmd: add commands to test new Rx offload API app/testpmd: add commands to test new Tx offload API app/test-pmd/cmdline.c | 751 + app/test-pmd/testpmd.c | 34 ++- app/test-pmd/testpmd.h | 2 + 3 files changed, 783 insertions(+), 4 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v4 3/3] app/testpmd: add commands to test new Tx offload API
Add following testpmd run-time commands to support test of new Tx offload API: tx_offload get capability tx_offload get configuration tx_offload enable|disable per_port tx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_insert", "udp_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 379 + app/test-pmd/testpmd.c | 15 +- app/test-pmd/testpmd.h | 1 + 3 files changed, 393 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index ae735d0..e977910 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16366,6 +16366,381 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { } }; +/* Get Tx offloads capability */ +struct cmd_tx_offload_get_capa_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_capa_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_tx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +port_id, UINT16); + +static void +print_tx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_tx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_tx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.tx_queue_offload_capa; + port_offloads = dev_info.tx_offload_capa ^ queue_offloads; + + printf("Tx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_tx_offloads(queue_offloads); + printf("\n"); + printf(" Per Port :"); + print_tx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_tx_offload_get_capa = { + .f = cmd_tx_offload_get_capa_parsed, + .data = NULL, + .help_str = "tx_offload get capability ", + .tokens = { + (void *)&cmd_tx_offload_get_capa_tx_offload, + (void *)&cmd_tx_offload_get_capa_get, + (void *)&cmd_tx_offload_get_capa_capability, + (void *)&cmd_tx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Tx offloads configuration */ +struct cmd_tx_offload_get_configuration_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_tx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v4 2/3] app/testpmd: add commands to test new Rx offload API
Add following testpmd run-time commands to support test of new Rx offload API: rx_offload get capability rx_offload get configuration rx_offload enable|disable per_port rx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_strip", "ipv4_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 374 + app/test-pmd/testpmd.c | 19 ++- app/test-pmd/testpmd.h | 1 + 3 files changed, 392 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 40b31ad..ae735d0 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15996,6 +15996,376 @@ cmdline_parse_inst_t cmd_ptype_mapping_update = { }, }; +/* Get Rx offloads capability */ +struct cmd_rx_offload_get_capa_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port_id, UINT16); + +static void +print_rx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_rx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_rx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.rx_queue_offload_capa; + port_offloads = dev_info.rx_offload_capa ^ queue_offloads; + + printf("Rx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_rx_offloads(queue_offloads); + + printf("\n"); + printf(" Per Port :"); + print_rx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_rx_offload_get_capa = { + .f = cmd_rx_offload_get_capa_parsed, + .data = NULL, + .help_str = "rx_offload get capability ", + .tokens = { + (void *)&cmd_rx_offload_get_capa_rx_offload, + (void *)&cmd_rx_offload_get_capa_get, + (void *)&cmd_rx_offload_get_capa_capability, + (void *)&cmd_rx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Rx offloads configuration */ +struct cmd_rx_offload_get_configuration_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_rx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v4 1/3] ethdev: add enum type for loop on Rx/Tx offloads
This patch adds enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type. For a loop on all Rx offloads, it is convenient to begin with the first enum member ETH_RX_OFFLOAD_FIRST_FEATURE and to end at ETH_RX_OFFLOAD_TOTAL_NUM. A loop on all Tx offloads can begin with ETH_TX_OFFLOAD_FIRST_FEATURE and end at ETH_TX_OFFLOAD_TOTAL_NUM. Signed-off-by: Wei Dai --- lib/librte_ether/rte_ethdev.h | 44 +++ 1 file changed, 44 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0361533..0089ea3 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -946,6 +946,27 @@ struct rte_eth_conf { DEV_RX_OFFLOAD_VLAN_FILTER | \ DEV_RX_OFFLOAD_VLAN_EXTEND) +enum rte_eth_rx_offload_type { + ETH_RX_OFFLOAD_FIRST_FEATURE = 0, + ETH_RX_OFFLOAD_VLAN_STRIP = ETH_RX_OFFLOAD_FIRST_FEATURE, + ETH_RX_OFFLOAD_IPV4_CKSUM, + ETH_RX_OFFLOAD_UDP_CKSUM, + ETH_RX_OFFLOAD_TCP_CKSUM, + ETH_RX_OFFLOAD_TCP_LRO, + ETH_RX_OFFLOAD_QINQ_STRIP, + ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, + ETH_RX_OFFLOAD_MACSEC_STRIP, + ETH_RX_OFFLOAD_HEADER_SPLIT, + ETH_RX_OFFLOAD_VLAN_FILTER, + ETH_RX_OFFLOAD_VLAN_EXTEND, + ETH_RX_OFFLOAD_JUMBO_FRAME, + ETH_RX_OFFLOAD_CRC_STRIP, + ETH_RX_OFFLOAD_SCATTER, + ETH_RX_OFFLOAD_TIMESTAMP, + ETH_RX_OFFLOAD_SECURITY, + ETH_RX_OFFLOAD_TOTAL_NUM +}; + /* * If new Rx offload capabilities are defined, they also must be * mentioned in rte_rx_offload_names in rte_ethdev.c file. @@ -981,6 +1002,29 @@ struct rte_eth_conf { */ #define DEV_TX_OFFLOAD_SECURITY 0x0002 +enum rte_eth_tx_offload_type { + ETH_TX_OFFLOAD_FIRST_FEATURE = 0, + ETH_TX_OFFLOAD_VLAN_INSERT = ETH_TX_OFFLOAD_FIRST_FEATURE, + ETH_TX_OFFLOAD_IPV4_CKSUM, + ETH_TX_OFFLOAD_UDP_CKSUM, + ETH_TX_OFFLOAD_TCP_CKSUM, + ETH_TX_OFFLOAD_SCTP_CKSUM, + ETH_TX_OFFLOAD_TCP_TSO, + ETH_TX_OFFLOAD_UDP_TSO, + ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM, + ETH_TX_OFFLOAD_QINQ_INSERT, + ETH_TX_OFFLOAD_VXLAN_TNL_TSO, + ETH_TX_OFFLOAD_GRE_TNL_TSO, + ETH_TX_OFFLOAD_IPIP_TNL_TSO, + ETH_TX_OFFLOAD_GENEVE_TNL_TSO, + ETH_TX_OFFLOAD_MACSEC_INSERT, + ETH_TX_OFFLOAD_MT_LOCKFREE, + ETH_TX_OFFLOAD_MULTI_SEGS, + ETH_TX_OFFLOAD_MBUF_FAST_FREE, + ETH_TX_OFFLOAD_SECURITY, + ETH_TX_OFFLOAD_TOTAL_NUM +}; + /* * If new Tx offload capabilities are defined, they also must be * mentioned in rte_tx_offload_names in rte_ethdev.c file. -- 2.7.5
[dpdk-dev] [PATCH v4 0/3] app/testpmd: add new commands to test new Tx/Rx offload
Existed testpmd commands can't support per queue offload configuration. And there are different commands to enable or disable different offloading. This patch set add following commands to support new Tx/Rx offloading API test. To get Rx offload capability of a port, please run: testpmd > rx_offload get capability To get current Rx offload per queue and per port configuration of a port, run: tesstpmd > rx_offload get configuration To enable or disable a Rx per port offloading, please run: testpmd > rx_offload enable|disable per_port vlan_strip|ipv4_cksum|... This command will set|clear the associated bit in dev->dev_conf.rxmode.offloads for rte_eth_dev_configure and tx_conf->offloads of all Rx queues for rte_eth_rx_queue_setup( ). To enable or disable a Tx per port offloading, please run: testpmd > rx_offload enable|disable per_queue vlan_strip|ipv4_cksum|... Same commands like "tx_offload ..." are also added to support new Tx offload API test. --- v4: improve testpmd command per port offload to set or clear the port configuration and the queue configuration of all queues. v3: add enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type free memory of port->rx_offloads and port->tx_offloads when testpmd is existed v2: use rte_eth_dev_rx_offload_name() and rte_eth_dev_tx_offload_name(). remove static const strings of Rx/Tx offload names. Wei Dai (3): ethdev: add enum type for loop on Rx/Tx offloads app/testpmd: add commands to test new Rx offload API pp/testpmd: add commands to test new Tx offload API app/test-pmd/cmdline.c| 753 ++ app/test-pmd/testpmd.c| 34 +- app/test-pmd/testpmd.h| 2 + lib/librte_ether/rte_ethdev.h | 44 +++ 4 files changed, 829 insertions(+), 4 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v4 3/3] pp/testpmd: add commands to test new Tx offload API
Add following testpmd run-time commands to support test of new Tx offload API: tx_offload get capability tx_offload get configuration tx_offload enable|disable per_port tx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_insert", "udp_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 379 + app/test-pmd/testpmd.c | 15 +- app/test-pmd/testpmd.h | 1 + 3 files changed, 393 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index ae735d0..e977910 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16366,6 +16366,381 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { } }; +/* Get Tx offloads capability */ +struct cmd_tx_offload_get_capa_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_capa_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_tx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +port_id, UINT16); + +static void +print_tx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_tx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_tx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.tx_queue_offload_capa; + port_offloads = dev_info.tx_offload_capa ^ queue_offloads; + + printf("Tx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_tx_offloads(queue_offloads); + printf("\n"); + printf(" Per Port :"); + print_tx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_tx_offload_get_capa = { + .f = cmd_tx_offload_get_capa_parsed, + .data = NULL, + .help_str = "tx_offload get capability ", + .tokens = { + (void *)&cmd_tx_offload_get_capa_tx_offload, + (void *)&cmd_tx_offload_get_capa_get, + (void *)&cmd_tx_offload_get_capa_capability, + (void *)&cmd_tx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Tx offloads configuration */ +struct cmd_tx_offload_get_configuration_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_tx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v4 2/3] app/testpmd: add commands to test new Rx offload API
Add following testpmd run-time commands to support test of new Rx offload API: rx_offload get capability rx_offload get configuration rx_offload enable|disable per_port rx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_strip", "ipv4_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 374 + app/test-pmd/testpmd.c | 19 ++- app/test-pmd/testpmd.h | 1 + 3 files changed, 392 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 40b31ad..ae735d0 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15996,6 +15996,376 @@ cmdline_parse_inst_t cmd_ptype_mapping_update = { }, }; +/* Get Rx offloads capability */ +struct cmd_rx_offload_get_capa_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port_id, UINT16); + +static void +print_rx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_rx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_rx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.rx_queue_offload_capa; + port_offloads = dev_info.rx_offload_capa ^ queue_offloads; + + printf("Rx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_rx_offloads(queue_offloads); + + printf("\n"); + printf(" Per Port :"); + print_rx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_rx_offload_get_capa = { + .f = cmd_rx_offload_get_capa_parsed, + .data = NULL, + .help_str = "rx_offload get capability ", + .tokens = { + (void *)&cmd_rx_offload_get_capa_rx_offload, + (void *)&cmd_rx_offload_get_capa_get, + (void *)&cmd_rx_offload_get_capa_capability, + (void *)&cmd_rx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Rx offloads configuration */ +struct cmd_rx_offload_get_configuration_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_rx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v4 0/3] app/testpmd: add new commands to test new Tx/Rx offload
Existed testpmd commands can't support per queue offload configuration. And there are different commands to enable or disable different offloading. This patch set add following commands to support new Tx/Rx offloading API test. To get Rx offload capability of a port, please run: testpmd > rx_offload get capability To get current Rx offload per queue and per port configuration of a port, run: tesstpmd > rx_offload get configuration To enable or disable a Rx per port offloading, please run: testpmd > rx_offload enable|disable per_port vlan_strip|ipv4_cksum|... This command will set|clear the associated bit in dev->dev_conf.rxmode.offloads for rte_eth_dev_configure and tx_conf->offloads of all Rx queues for rte_eth_rx_queue_setup( ). To enable or disable a Tx per port offloading, please run: testpmd > rx_offload enable|disable per_queue vlan_strip|ipv4_cksum|... Same commands like "tx_offload ..." are also added to support new Tx offload API test. --- v4: improve testpmd command per port offload to set or clear the port configuration and the queue configuration of all queues. v3: add enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type free memory of port->rx_offloads and port->tx_offloads when testpmd is existed v2: use rte_eth_dev_rx_offload_name() and rte_eth_dev_tx_offload_name(). remove static const strings of Rx/Tx offload names. Wei Dai (3): ethdev: add enum type for loop on Rx/Tx offloads app/testpmd: add commands to test new Rx offload API pp/testpmd: add commands to test new Tx offload API app/test-pmd/cmdline.c| 753 ++ app/test-pmd/testpmd.c| 34 +- app/test-pmd/testpmd.h| 2 + lib/librte_ether/rte_ethdev.h | 44 +++ 4 files changed, 829 insertions(+), 4 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v4 1/3] ethdev: add enum type for loop on Rx/Tx offloads
This patch adds enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type. For a loop on all Rx offloads, it is convenient to begin with the first enum member ETH_RX_OFFLOAD_FIRST_FEATURE and to end at ETH_RX_OFFLOAD_TOTAL_NUM. A loop on all Tx offloads can begin with ETH_TX_OFFLOAD_FIRST_FEATURE and end at ETH_TX_OFFLOAD_TOTAL_NUM. Signed-off-by: Wei Dai --- lib/librte_ether/rte_ethdev.h | 44 +++ 1 file changed, 44 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0361533..0089ea3 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -946,6 +946,27 @@ struct rte_eth_conf { DEV_RX_OFFLOAD_VLAN_FILTER | \ DEV_RX_OFFLOAD_VLAN_EXTEND) +enum rte_eth_rx_offload_type { + ETH_RX_OFFLOAD_FIRST_FEATURE = 0, + ETH_RX_OFFLOAD_VLAN_STRIP = ETH_RX_OFFLOAD_FIRST_FEATURE, + ETH_RX_OFFLOAD_IPV4_CKSUM, + ETH_RX_OFFLOAD_UDP_CKSUM, + ETH_RX_OFFLOAD_TCP_CKSUM, + ETH_RX_OFFLOAD_TCP_LRO, + ETH_RX_OFFLOAD_QINQ_STRIP, + ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, + ETH_RX_OFFLOAD_MACSEC_STRIP, + ETH_RX_OFFLOAD_HEADER_SPLIT, + ETH_RX_OFFLOAD_VLAN_FILTER, + ETH_RX_OFFLOAD_VLAN_EXTEND, + ETH_RX_OFFLOAD_JUMBO_FRAME, + ETH_RX_OFFLOAD_CRC_STRIP, + ETH_RX_OFFLOAD_SCATTER, + ETH_RX_OFFLOAD_TIMESTAMP, + ETH_RX_OFFLOAD_SECURITY, + ETH_RX_OFFLOAD_TOTAL_NUM +}; + /* * If new Rx offload capabilities are defined, they also must be * mentioned in rte_rx_offload_names in rte_ethdev.c file. @@ -981,6 +1002,29 @@ struct rte_eth_conf { */ #define DEV_TX_OFFLOAD_SECURITY 0x0002 +enum rte_eth_tx_offload_type { + ETH_TX_OFFLOAD_FIRST_FEATURE = 0, + ETH_TX_OFFLOAD_VLAN_INSERT = ETH_TX_OFFLOAD_FIRST_FEATURE, + ETH_TX_OFFLOAD_IPV4_CKSUM, + ETH_TX_OFFLOAD_UDP_CKSUM, + ETH_TX_OFFLOAD_TCP_CKSUM, + ETH_TX_OFFLOAD_SCTP_CKSUM, + ETH_TX_OFFLOAD_TCP_TSO, + ETH_TX_OFFLOAD_UDP_TSO, + ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM, + ETH_TX_OFFLOAD_QINQ_INSERT, + ETH_TX_OFFLOAD_VXLAN_TNL_TSO, + ETH_TX_OFFLOAD_GRE_TNL_TSO, + ETH_TX_OFFLOAD_IPIP_TNL_TSO, + ETH_TX_OFFLOAD_GENEVE_TNL_TSO, + ETH_TX_OFFLOAD_MACSEC_INSERT, + ETH_TX_OFFLOAD_MT_LOCKFREE, + ETH_TX_OFFLOAD_MULTI_SEGS, + ETH_TX_OFFLOAD_MBUF_FAST_FREE, + ETH_TX_OFFLOAD_SECURITY, + ETH_TX_OFFLOAD_TOTAL_NUM +}; + /* * If new Tx offload capabilities are defined, they also must be * mentioned in rte_tx_offload_names in rte_ethdev.c file. -- 2.7.5
[dpdk-dev] [PATCH v3 4/4] net/ixgbe: convert to new Tx offloads API
Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new Tx offloads API. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 56 +--- drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++- drivers/net/ixgbe/ixgbe_rxtx.c | 79 ++-- drivers/net/ixgbe/ixgbe_rxtx.h | 3 ++ 4 files changed, 108 insertions(+), 35 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 9437f05..6288690 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2337,6 +2337,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) (struct ixgbe_adapter *)dev->data->dev_private; struct rte_eth_dev_info dev_info; uint64_t rx_offloads; + uint64_t tx_offloads; int ret; PMD_INIT_FUNC_TRACE(); @@ -2356,6 +2357,13 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) rx_offloads, dev_info.rx_offload_capa); return -ENOTSUP; } + tx_offloads = dev->data->dev_conf.txmode.offloads; + if ((tx_offloads & dev_info.tx_offload_capa) != tx_offloads) { + PMD_DRV_LOG(ERR, "Some Tx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + tx_offloads, dev_info.tx_offload_capa); + return -ENOTSUP; + } /* set flag to update link status after init */ intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; @@ -3649,28 +3657,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); - - dev_info->tx_offload_capa = - DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM | - DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; - - if (hw->mac.type == ixgbe_mac_82599EB || - hw->mac.type == ixgbe_mac_X540) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_MACSEC_INSERT; - - if (hw->mac.type == ixgbe_mac_X550 || - hw->mac.type == ixgbe_mac_X550EM_x || - hw->mac.type == ixgbe_mac_X550EM_a) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; - -#ifdef RTE_LIBRTE_SECURITY - if (dev->security_ctx) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY; -#endif + dev_info->tx_queue_offload_capa = ixgbe_get_tx_queue_offloads(dev); + dev_info->tx_offload_capa = ixgbe_get_tx_port_offloads(dev); dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { @@ -3692,7 +3680,9 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOOFFLOADS, +ETH_TXQ_FLAGS_NOOFFLOADS | +ETH_TXQ_FLAGS_IGNORE, + .offloads = 0, }; dev_info->rx_desc_lim = rx_desc_lim; @@ -3776,12 +3766,8 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); - dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM | - DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; + dev_info->tx_queue_offload_capa = ixgbe_get_tx_queue_offloads(dev); + dev_info->tx_offload_capa = ixgbe_get_tx_port_offloads(dev); dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { @@ -3803,7 +3789,9 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOOFFLOADS, +ETH_TXQ_FLAGS_NOOFFLOADS | +ETH_TXQ_FLAGS_IGNORE, +
[dpdk-dev] [PATCH v3 3/4] net/ixgbe: convert to new Rx offloads API
Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit support the new Rx offloads API. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 93 + drivers/net/ixgbe/ixgbe_ipsec.c | 8 +- drivers/net/ixgbe/ixgbe_rxtx.c| 165 +++--- drivers/net/ixgbe/ixgbe_rxtx.h| 3 + drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 2 +- 6 files changed, 207 insertions(+), 66 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 8bb67ba..9437f05 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2105,19 +2105,22 @@ ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) static int ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) { + struct rte_eth_rxmode *rxmode; + rxmode = &dev->data->dev_conf.rxmode; + if (mask & ETH_VLAN_STRIP_MASK) { ixgbe_vlan_hw_strip_config(dev); } if (mask & ETH_VLAN_FILTER_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_filter) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER) ixgbe_vlan_hw_filter_enable(dev); else ixgbe_vlan_hw_filter_disable(dev); } if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_extend) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND) ixgbe_vlan_hw_extend_enable(dev); else ixgbe_vlan_hw_extend_disable(dev); @@ -2332,6 +2335,8 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)dev->data->dev_private; + struct rte_eth_dev_info dev_info; + uint64_t rx_offloads; int ret; PMD_INIT_FUNC_TRACE(); @@ -2343,6 +2348,15 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) return ret; } + ixgbe_dev_info_get(dev, &dev_info); + rx_offloads = dev->data->dev_conf.rxmode.offloads; + if ((rx_offloads & dev_info.rx_offload_capa) != rx_offloads) { + PMD_DRV_LOG(ERR, "Some Rx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + rx_offloads, dev_info.rx_offload_capa); + return -ENOTSUP; + } + /* set flag to update link status after init */ intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; @@ -3632,30 +3646,9 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) else dev_info->max_vmdq_pools = ETH_64_POOLS; dev_info->vmdq_queue_num = dev_info->max_rx_queues; - dev_info->rx_offload_capa = - DEV_RX_OFFLOAD_VLAN_STRIP | - DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM | - DEV_RX_OFFLOAD_CRC_STRIP; - - /* -* RSC is only supported by 82599 and x540 PF devices in a non-SR-IOV -* mode. -*/ - if ((hw->mac.type == ixgbe_mac_82599EB || -hw->mac.type == ixgbe_mac_X540) && - !RTE_ETH_DEV_SRIOV(dev).active) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; - - if (hw->mac.type == ixgbe_mac_82599EB || - hw->mac.type == ixgbe_mac_X540) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_MACSEC_STRIP; - - if (hw->mac.type == ixgbe_mac_X550 || - hw->mac.type == ixgbe_mac_X550EM_x || - hw->mac.type == ixgbe_mac_X550EM_a) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); + dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | +dev_info->rx_queue_offload_capa); dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | @@ -3675,10 +3668,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; #ifdef RTE_LIBRTE_SECURITY - if (dev->security_ctx) { - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_SECURITY; + if (dev->security_ctx) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY; - } #endif dev_info->default_rxconf = (struct rte_eth_rxconf) { @@ -3689,6 +3680,7
[dpdk-dev] [PATCH v3 2/4] net/ixgbe: support VLAN strip per queue offloading in VF
VLAN strip is a per queue offloading in VF. With this patch it can be enabled or disabled on any Rx queue in VF. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 73755d2..8bb67ba 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -5215,15 +5215,17 @@ ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ixgbe_rx_queue *rxq; uint16_t i; int on = 0; /* VF function only support hw strip feature, others are not support */ if (mask & ETH_VLAN_STRIP_MASK) { - on = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); - - for (i = 0; i < hw->mac.max_rx_queues; i++) + for (i = 0; i < hw->mac.max_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + on = !!(rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP); ixgbevf_vlan_strip_queue_set(dev, i, on); + } } return 0; -- 2.7.5
[dpdk-dev] [PATCH v3 0/4] net/ixgbe: convert to new offloads API
This patch set adds support of per queue VLAN strip offloading in ixgbe PF and VF. This patch support new offloads API in ixgbe PF and VF. --- v3: Rx header spliting capability is only enabled in #ifdef RTE_HEADER_SPLIT_ENABLE. Tx vector tranmit function only work without any Tx offloads. v2: improve error checking Wei Dai (4): net/ixgbe: support VLAN strip per queue offloading in PF net/ixgbe: support VLAN strip per queue offloading in VF net/ixgbe: convert to new Rx offloads API net/ixgbe: convert to new Tx offloads API drivers/net/ixgbe/ixgbe_ethdev.c | 264 ++ drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_ipsec.c | 13 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_rxtx.c| 245 --- drivers/net/ixgbe/ixgbe_rxtx.h| 7 + drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 2 +- 8 files changed, 370 insertions(+), 172 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v3 1/4] net/ixgbe: support VLAN strip per queue offloading in PF
VLAN strip is a per queue offloading in PF. With this patch it can be enabled or disabled on any Rx queue in PF. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 109 +-- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_rxtx.c | 1 + drivers/net/ixgbe/ixgbe_rxtx.h | 1 + 5 files changed, 51 insertions(+), 69 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4483258..73755d2 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2001,64 +2001,6 @@ ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue) ixgbe_vlan_hw_strip_bitmap_set(dev, queue, 1); } -void -ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev) -{ - struct ixgbe_hw *hw = - IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t ctrl; - uint16_t i; - struct ixgbe_rx_queue *rxq; - - PMD_INIT_FUNC_TRACE(); - - if (hw->mac.type == ixgbe_mac_82598EB) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); - ctrl &= ~IXGBE_VLNCTRL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); - } else { - /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */ - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); - ctrl &= ~IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); - - /* record those setting for HW strip per queue */ - ixgbe_vlan_hw_strip_bitmap_set(dev, i, 0); - } - } -} - -void -ixgbe_vlan_hw_strip_enable_all(struct rte_eth_dev *dev) -{ - struct ixgbe_hw *hw = - IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t ctrl; - uint16_t i; - struct ixgbe_rx_queue *rxq; - - PMD_INIT_FUNC_TRACE(); - - if (hw->mac.type == ixgbe_mac_82598EB) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); - ctrl |= IXGBE_VLNCTRL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); - } else { - /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */ - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); - ctrl |= IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); - - /* record those setting for HW strip per queue */ - ixgbe_vlan_hw_strip_bitmap_set(dev, i, 1); - } - } -} - static void ixgbe_vlan_hw_extend_disable(struct rte_eth_dev *dev) { @@ -2114,14 +2056,57 @@ ixgbe_vlan_hw_extend_enable(struct rte_eth_dev *dev) */ } +void +ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) +{ + struct ixgbe_hw *hw = + IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; + uint32_t ctrl; + uint16_t i; + struct ixgbe_rx_queue *rxq; + bool on; + + PMD_INIT_FUNC_TRACE(); + + if (hw->mac.type == ixgbe_mac_82598EB) { + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) { + ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); + ctrl |= IXGBE_VLNCTRL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); + } else { + ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); + ctrl &= ~IXGBE_VLNCTRL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); + } + } else { + /* +* Other 10G NIC, the VLAN strip can be setup +* per queue in RXDCTL +*/ + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); + if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) { + ctrl |= IXGBE_RXDCTL_VME; + on = TRUE; + } else { + ctrl &= ~IXGBE_RXDCTL_VME; + on = FALSE; + } + IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); + + /* record those setting for HW strip per queue */ +
[dpdk-dev] [PATCH v3 1/3] ethdev: add enum type for loop on Rx/Tx offloads
This patch adds enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type. For a loop on all Rx offloads, it is convenient to begin with the first enum member ETH_RX_OFFLOAD_FIRST_FEATURE and to end at ETH_RX_OFFLOAD_TOTAL_NUM. A loop on all Tx offloads can begin with ETH_TX_OFFLOAD_FIRST_FEATURE and end at ETH_TX_OFFLOAD_TOTAL_NUM. Signed-off-by: Wei Dai --- lib/librte_ether/rte_ethdev.h | 44 +++ 1 file changed, 44 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0361533..0089ea3 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -946,6 +946,27 @@ struct rte_eth_conf { DEV_RX_OFFLOAD_VLAN_FILTER | \ DEV_RX_OFFLOAD_VLAN_EXTEND) +enum rte_eth_rx_offload_type { + ETH_RX_OFFLOAD_FIRST_FEATURE = 0, + ETH_RX_OFFLOAD_VLAN_STRIP = ETH_RX_OFFLOAD_FIRST_FEATURE, + ETH_RX_OFFLOAD_IPV4_CKSUM, + ETH_RX_OFFLOAD_UDP_CKSUM, + ETH_RX_OFFLOAD_TCP_CKSUM, + ETH_RX_OFFLOAD_TCP_LRO, + ETH_RX_OFFLOAD_QINQ_STRIP, + ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM, + ETH_RX_OFFLOAD_MACSEC_STRIP, + ETH_RX_OFFLOAD_HEADER_SPLIT, + ETH_RX_OFFLOAD_VLAN_FILTER, + ETH_RX_OFFLOAD_VLAN_EXTEND, + ETH_RX_OFFLOAD_JUMBO_FRAME, + ETH_RX_OFFLOAD_CRC_STRIP, + ETH_RX_OFFLOAD_SCATTER, + ETH_RX_OFFLOAD_TIMESTAMP, + ETH_RX_OFFLOAD_SECURITY, + ETH_RX_OFFLOAD_TOTAL_NUM +}; + /* * If new Rx offload capabilities are defined, they also must be * mentioned in rte_rx_offload_names in rte_ethdev.c file. @@ -981,6 +1002,29 @@ struct rte_eth_conf { */ #define DEV_TX_OFFLOAD_SECURITY 0x0002 +enum rte_eth_tx_offload_type { + ETH_TX_OFFLOAD_FIRST_FEATURE = 0, + ETH_TX_OFFLOAD_VLAN_INSERT = ETH_TX_OFFLOAD_FIRST_FEATURE, + ETH_TX_OFFLOAD_IPV4_CKSUM, + ETH_TX_OFFLOAD_UDP_CKSUM, + ETH_TX_OFFLOAD_TCP_CKSUM, + ETH_TX_OFFLOAD_SCTP_CKSUM, + ETH_TX_OFFLOAD_TCP_TSO, + ETH_TX_OFFLOAD_UDP_TSO, + ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM, + ETH_TX_OFFLOAD_QINQ_INSERT, + ETH_TX_OFFLOAD_VXLAN_TNL_TSO, + ETH_TX_OFFLOAD_GRE_TNL_TSO, + ETH_TX_OFFLOAD_IPIP_TNL_TSO, + ETH_TX_OFFLOAD_GENEVE_TNL_TSO, + ETH_TX_OFFLOAD_MACSEC_INSERT, + ETH_TX_OFFLOAD_MT_LOCKFREE, + ETH_TX_OFFLOAD_MULTI_SEGS, + ETH_TX_OFFLOAD_MBUF_FAST_FREE, + ETH_TX_OFFLOAD_SECURITY, + ETH_TX_OFFLOAD_TOTAL_NUM +}; + /* * If new Tx offload capabilities are defined, they also must be * mentioned in rte_tx_offload_names in rte_ethdev.c file. -- 2.7.5
[dpdk-dev] [PATCH v3 0/3] app/testpmd: add new commands to test new Tx/Rx offload API
Existed testpmd commands can't support per queue offload configuration. And there are different commands to enable or disable different offloading. This patch set add following commands to support new Tx/Rx offloading API test. To get Rx offload capability of a port, please run: testpmd > rx_offload get capability To get current Rx offload per queue and per port configuration of a port, run: tesstpmd > rx_offload get configuration To enable or disable a Rx per port offloading, please run: testpmd > rx_offload enable|disable per_port vlan_strip|ipv4_cksum|... To enable or disable a Tx per port offloading, please run: testpmd > rx_offload enable|disable per_queue vlan_strip|ipv4_cksum|... Same commands like "tx_offload ..." are also added to support new Tx offload API test. --- v3: add enum rte_eth_rx_offload_type and enum rte_eth_tx_offload_type free memory of port->rx_offloads and port->tx_offloads when testpmd is existed v2: use rte_eth_dev_rx_offload_name() and rte_eth_dev_tx_offload_name(). remove static const strings of Rx/Tx offload names. Wei Dai (3): ethdev: add enum type for loop on Rx/Tx offloads app/testpmd: add commands to test new Rx offload API app/testpmd: add commands to test new Tx offload API app/test-pmd/cmdline.c| 739 ++ app/test-pmd/testpmd.c| 34 +- app/test-pmd/testpmd.h| 2 + lib/librte_ether/rte_ethdev.h | 44 +++ 4 files changed, 815 insertions(+), 4 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v3 2/3] app/testpmd: add commands to test new Rx offload API
Add following testpmd run-time commands to support test of new Rx offload API: rx_offload get capability rx_offload get configuration rx_offload enable|disable per_port rx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_strip", "ipv4_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 367 + app/test-pmd/testpmd.c | 19 ++- app/test-pmd/testpmd.h | 1 + 3 files changed, 385 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 40b31ad..0475064 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15996,6 +15996,369 @@ cmdline_parse_inst_t cmd_ptype_mapping_update = { }, }; +/* Get Rx offloads capability */ +struct cmd_rx_offload_get_capa_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port_id, UINT16); + +static void +print_rx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_rx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_rx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.rx_queue_offload_capa; + port_offloads = dev_info.rx_offload_capa ^ queue_offloads; + + printf("Rx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_rx_offloads(queue_offloads); + + printf("\n"); + printf(" Per Port :"); + print_rx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_rx_offload_get_capa = { + .f = cmd_rx_offload_get_capa_parsed, + .data = NULL, + .help_str = "rx_offload get capability ", + .tokens = { + (void *)&cmd_rx_offload_get_capa_rx_offload, + (void *)&cmd_rx_offload_get_capa_get, + (void *)&cmd_rx_offload_get_capa_capability, + (void *)&cmd_rx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Rx offloads configuration */ +struct cmd_rx_offload_get_configuration_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_rx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v3 3/3] app/testpmd: add commands to test new Tx offload API
Add following testpmd run-time commands to support test of new Tx offload API: tx_offload get capability tx_offload get configuration tx_offload enable|disable per_port tx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_insert", "udp_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 372 + app/test-pmd/testpmd.c | 15 +- app/test-pmd/testpmd.h | 1 + 3 files changed, 386 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0475064..a142517 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16359,6 +16359,374 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { } }; +/* Get Tx offloads capability */ +struct cmd_tx_offload_get_capa_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_capa_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_tx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +port_id, UINT16); + +static void +print_tx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + int begin; + int end; + int bit; + + if (offloads == 0) + return; + + begin = __builtin_ctzll(offloads); + end = sizeof(offloads) * CHAR_BIT - __builtin_clzll(offloads); + + single_offload = 1 << begin; + for (bit = begin; bit < end; bit++) { + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_tx_offload_name(single_offload)); + single_offload <<= 1; + } +} + +static void +cmd_tx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.tx_queue_offload_capa; + port_offloads = dev_info.tx_offload_capa ^ queue_offloads; + + printf("Tx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_tx_offloads(queue_offloads); + printf("\n"); + printf(" Per Port :"); + print_tx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_tx_offload_get_capa = { + .f = cmd_tx_offload_get_capa_parsed, + .data = NULL, + .help_str = "tx_offload get capability ", + .tokens = { + (void *)&cmd_tx_offload_get_capa_tx_offload, + (void *)&cmd_tx_offload_get_capa_get, + (void *)&cmd_tx_offload_get_capa_capability, + (void *)&cmd_tx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Tx offloads configuration */ +struct cmd_tx_offload_get_configuration_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_tx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +port_id, UINT16); + +stat
[dpdk-dev] [PATCH v2 0/2] app/testpmd: add new commands to test new Tx/Rx offload API
Existed testpmd commands can't support per queue offload configuration. And there are different commands to enable or disable different offloading. This patch set add following commands to support new Tx/Rx offloading API test. To get Rx offload capability of a port, please run: testpmd > rx_offload get capability To get current Rx offload per queue and per port configuration of a port, run: tesstpmd > rx_offload get configuration To enable or disable a Rx per port offloading, please run: testpmd > rx_offload enable|disable per_port vlan_strip|ipv4_cksum|... To enable or disable a Tx per port offloading, please run: testpmd > rx_offload enable|disable per_queue vlan_strip|ipv4_cksum|... Same commands like "tx_offload ..." are also added to support new Tx offload API test. --- v2: use rte_eth_dev_rx_offload_name() and rte_eth_dev_tx_offload_name(). remove static const strings of Rx/Tx offload names. Wei Dai (2): app/testpmd: add commands to test new Rx offload API app/testpmd: add commands to test new Tx offload API app/test-pmd/cmdline.c | 863 + app/test-pmd/testpmd.c | 28 +- app/test-pmd/testpmd.h | 2 + 3 files changed, 889 insertions(+), 4 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v2 2/2] app/testpmd: add commands to test new Tx offload API
Add following testpmd run-time commands to support test of new Tx offload API: tx_offload get capability tx_offload get configuration tx_offload enable|disable per_port tx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_insert", "udp_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 439 + app/test-pmd/testpmd.c | 13 +- app/test-pmd/testpmd.h | 1 + 3 files changed, 451 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index dfd0ca6..5c4fcf4 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16416,6 +16416,441 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { } }; +/* Get Tx offloads capability */ +struct cmd_tx_offload_get_capa_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_capa_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_tx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +port_id, UINT16); + +static void +print_tx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + + for (single_offload = DEV_TX_OFFLOAD_VLAN_INSERT; +single_offload <= DEV_TX_OFFLOAD_SECURITY; +single_offload <<= 1) + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_tx_offload_name(single_offload)); +} + +static void +cmd_tx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.tx_queue_offload_capa; + port_offloads = dev_info.tx_offload_capa ^ queue_offloads; + + printf("Tx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_tx_offloads(queue_offloads); + printf("\n"); + printf(" Per Port :"); + print_tx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_tx_offload_get_capa = { + .f = cmd_tx_offload_get_capa_parsed, + .data = NULL, + .help_str = "tx_offload get capability ", + .tokens = { + (void *)&cmd_tx_offload_get_capa_tx_offload, + (void *)&cmd_tx_offload_get_capa_get, + (void *)&cmd_tx_offload_get_capa_capability, + (void *)&cmd_tx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Tx offloads configuration */ +struct cmd_tx_offload_get_configuration_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_tx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +port_id, UINT16); + +static void +cmd_tx_offload_get_configuration_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_offload_get_confi
[dpdk-dev] [PATCH v2 1/2] app/testpmd: add commands to test new Rx offload API
Add following testpmd run-time commands to support test of new Rx offload API: rx_offload get capability rx_offload get configuration rx_offload enable|disable per_port rx_offload enable|disable per_queue Above last 2 commands should be run when the port is stopped. And can be one of "vlan_strip", "ipv4_cksum", ... Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 424 + app/test-pmd/testpmd.c | 15 +- app/test-pmd/testpmd.h | 1 + 3 files changed, 438 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d1dc1de..dfd0ca6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15996,6 +15996,426 @@ cmdline_parse_inst_t cmd_ptype_mapping_update = { }, }; +/* Get Rx offloads capability */ +struct cmd_rx_offload_get_capa_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port_id, UINT16); + +static void +print_rx_offloads(uint64_t offloads) +{ + uint64_t single_offload; + + for (single_offload = DEV_RX_OFFLOAD_VLAN_STRIP; +single_offload <= DEV_RX_OFFLOAD_SECURITY; +single_offload <<= 1) + if (offloads & single_offload) + printf(" %s", + rte_eth_dev_rx_offload_name(single_offload)); +} + +static void +cmd_rx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.rx_queue_offload_capa; + port_offloads = dev_info.rx_offload_capa ^ queue_offloads; + + printf("Rx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + print_rx_offloads(queue_offloads); + + printf("\n"); + printf(" Per Port :"); + print_rx_offloads(port_offloads); + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_rx_offload_get_capa = { + .f = cmd_rx_offload_get_capa_parsed, + .data = NULL, + .help_str = "rx_offload get capability ", + .tokens = { + (void *)&cmd_rx_offload_get_capa_rx_offload, + (void *)&cmd_rx_offload_get_capa_get, + (void *)&cmd_rx_offload_get_capa_capability, + (void *)&cmd_rx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Rx offloads configuration */ +struct cmd_rx_offload_get_configuration_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_configuration = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +configuration, "configuration"); +cmdline_parse_token_num_t cmd_rx_offload_get_configuration_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +port_id, UINT16); + +static void +cmd_rx_offload_get_configuration_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_confi
[dpdk-dev] [PATCH 1/2] app/testpmd: add commands to test new Rx offload API
Add following testpmd run-time commands to support test of new Rx offload API: rx_offload get capability rx_offload get configuration rx_offload enable|disable per_port vlan_strip|ipv4_cksum... rx_offload enable|disable per_queue vlan_strip|iipv4_cksum... Above last 2 commands should be run when the port is stopped. Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 456 + app/test-pmd/testpmd.c | 15 +- app/test-pmd/testpmd.h | 1 + 3 files changed, 470 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d1dc1de..1a08b3d 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15996,6 +15996,458 @@ cmdline_parse_inst_t cmd_ptype_mapping_update = { }, }; +static const char * const rx_offload_names[] = { + "VLAN_STRIP", + "IPV4_CKSUM", + "UDP_CKSUM", + "TCP_CKSUM", + "TCP_LRO", + "QINQ_STRIP", + "OUTER_IPV4_CKSUM", + "MACSEC_STRIP", + "HEADER_SPLIT", + "VLAN_FILTER", + "VLAN_EXTEND", + "JUMBO_FRAME", + "CRC_STRIP", + "SCATTER", + "TIMESTAMP", + "SECURITY" +}; + +#define MAX_NUM_OF_RX_OFFLOADS \ + ((int)(sizeof(rx_offload_names)/sizeof(rx_offload_names[0]))) + +/* Get Rx offloads capability */ +struct cmd_rx_offload_get_capa_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_capa_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_rx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_rx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_rx_offload_get_capa_result, +port_id, UINT16); + +static void +cmd_rx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_rx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + uint64_t mask; + int k; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.rx_queue_offload_capa; + port_offloads = dev_info.rx_offload_capa ^ queue_offloads; + + printf("Rx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + mask = 1; + for (k = 0; k < MAX_NUM_OF_RX_OFFLOADS; k++) { + if (queue_offloads & mask) + printf(" %s", rx_offload_names[k]); + mask <<= 1; + } + printf("\n"); + printf(" Per Port :"); + mask = 1; + for (k = 0; k < MAX_NUM_OF_RX_OFFLOADS; k++) { + if (port_offloads & mask) + printf(" %s", rx_offload_names[k]); + mask <<= 1; + } + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_rx_offload_get_capa = { + .f = cmd_rx_offload_get_capa_parsed, + .data = NULL, + .help_str = "rx_offload get capability ", + .tokens = { + (void *)&cmd_rx_offload_get_capa_rx_offload, + (void *)&cmd_rx_offload_get_capa_get, + (void *)&cmd_rx_offload_get_capa_capability, + (void *)&cmd_rx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Rx offloads configuration */ +struct cmd_rx_offload_get_configuration_result { + cmdline_fixed_string_t rx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_rx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +rx_offload, "rx_offload"); +cmdline_parse_token_string_t cmd_rx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_rx_offload_get_configuration_result, +get, "get"); +cmdline_pa
[dpdk-dev] [PATCH 2/2] app/testpmd: add commands to test new Tx offload API
Add following testpmd run-time commands to support test of new Tx offload API: tx_offload get capability tx_offload get configuration tx_offload enable|disable per_port vlan_insert|udp_cksum... tx_offload enable|disable per_queue vlan_insert|udp_cksum... Above last 2 commands should be run when the port is stopped. Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c | 474 + app/test-pmd/testpmd.c | 13 +- app/test-pmd/testpmd.h | 1 + 3 files changed, 486 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 1a08b3d..dcc7638 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -16448,6 +16448,476 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { } }; +static const char * const tx_offload_names[] = { + "VLAN_INSERT", + "IPV4_CKSUM", + "UDP_CKSUM", + "TCP_CKSUM", + "SCTP_CKSUM", + "TCP_TSO", + "UDP_TSO", + "OUTER_IPV4_CKSUM", + "QINQ_INSERT", + "VXLAN_TNL_TSO", + "GRE_TNL_TSO", + "IPIP_TNL_TSO", + "GENEVE_TNL_TSO", + "MACSEC_INSERT", + "MT_LOCKFREE", + "MULTI_SEGS", + "MBUF_FAST_FREE", + "SECURITY" +}; + +#define MAX_NUM_OF_TX_OFFLOADS \ + ((int)(sizeof(tx_offload_names)/sizeof(tx_offload_names[0]))) + +/* Get Tx offloads capability */ +struct cmd_tx_offload_get_capa_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t capability; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_capa_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +get, "get"); +cmdline_parse_token_string_t cmd_tx_offload_get_capa_capability = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +capability, "capability"); +cmdline_parse_token_num_t cmd_tx_offload_get_capa_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_offload_get_capa_result, +port_id, UINT16); + +static void +cmd_tx_offload_get_capa_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_offload_get_capa_result *res = parsed_result; + struct rte_eth_dev_info dev_info; + portid_t port_id = res->port_id; + uint64_t queue_offloads; + uint64_t port_offloads; + uint64_t mask; + int k; + + rte_eth_dev_info_get(port_id, &dev_info); + queue_offloads = dev_info.tx_queue_offload_capa; + port_offloads = dev_info.tx_offload_capa ^ queue_offloads; + + printf("Tx Offloading Capabilities of port %d :\n", port_id); + printf(" Per Queue :"); + mask = 1; + for (k = 0; k < MAX_NUM_OF_TX_OFFLOADS; k++) { + if (queue_offloads & mask) + printf(" %s", tx_offload_names[k]); + mask <<= 1; + } + printf("\n"); + printf(" Per Port :"); + mask = 1; + for (k = 0; k < MAX_NUM_OF_TX_OFFLOADS; k++) { + if (port_offloads & mask) + printf(" %s", tx_offload_names[k]); + mask <<= 1; + } + printf("\n\n"); +} + +cmdline_parse_inst_t cmd_tx_offload_get_capa = { + .f = cmd_tx_offload_get_capa_parsed, + .data = NULL, + .help_str = "tx_offload get capability ", + .tokens = { + (void *)&cmd_tx_offload_get_capa_tx_offload, + (void *)&cmd_tx_offload_get_capa_get, + (void *)&cmd_tx_offload_get_capa_capability, + (void *)&cmd_tx_offload_get_capa_port_id, + NULL, + } +}; + +/* Get Tx offloads configuration */ +struct cmd_tx_offload_get_configuration_result { + cmdline_fixed_string_t tx_offload; + cmdline_fixed_string_t get; + cmdline_fixed_string_t configuration; + portid_t port_id; +}; + +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_tx_offload = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_get_configuration_result, +tx_offload, "tx_offload"); +cmdline_parse_token_string_t cmd_tx_offload_get_configuration_get = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_offload_g
[dpdk-dev] [PATCH 0/2] app/testpmd: add new commands to test new Tx/Rx offload API
Existed testpmd commands can't support per queue offload configuration. And there are different commands to enable or disable different offloading. This patch set add following commands to support new Tx/Rx offloading API test. To get Rx offload capability of a port, please run: testpmd > rx_offload get capability To get current Rx offload per queue and per port configuration of a port, run: tesstpmd > rx_offload get configuration To enable or disable a Rx per port offloading, please run: testpmd > rx_offload enable|disable per_port vlan_strip|ipv4_cksum|... To enable or disable a Tx per port offloading, please run: testpmd > rx_offload enable|disable per_queue vlan_strip|ipv4_cksum|... Same commands like "tx_offload ..." are also added to support new Tx offload API test. Wei Dai (2): app/testpmd: add commands to test new Rx offload API app/testpmd: add commands to test new Tx offload API app/test-pmd/cmdline.c | 930 + app/test-pmd/testpmd.c | 28 +- app/test-pmd/testpmd.h | 2 + 3 files changed, 956 insertions(+), 4 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v2 1/4] net/ixgbe: support VLAN strip per queue offloading in PF
VLAN strip is a per queue offloading in PF. With this patch it can be enabled or disabled on any Rx queue in PF. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 109 +-- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_rxtx.c | 1 + drivers/net/ixgbe/ixgbe_rxtx.h | 1 + 5 files changed, 51 insertions(+), 69 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4483258..73755d2 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2001,64 +2001,6 @@ ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue) ixgbe_vlan_hw_strip_bitmap_set(dev, queue, 1); } -void -ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev) -{ - struct ixgbe_hw *hw = - IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t ctrl; - uint16_t i; - struct ixgbe_rx_queue *rxq; - - PMD_INIT_FUNC_TRACE(); - - if (hw->mac.type == ixgbe_mac_82598EB) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); - ctrl &= ~IXGBE_VLNCTRL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); - } else { - /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */ - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); - ctrl &= ~IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); - - /* record those setting for HW strip per queue */ - ixgbe_vlan_hw_strip_bitmap_set(dev, i, 0); - } - } -} - -void -ixgbe_vlan_hw_strip_enable_all(struct rte_eth_dev *dev) -{ - struct ixgbe_hw *hw = - IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t ctrl; - uint16_t i; - struct ixgbe_rx_queue *rxq; - - PMD_INIT_FUNC_TRACE(); - - if (hw->mac.type == ixgbe_mac_82598EB) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); - ctrl |= IXGBE_VLNCTRL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); - } else { - /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */ - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); - ctrl |= IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); - - /* record those setting for HW strip per queue */ - ixgbe_vlan_hw_strip_bitmap_set(dev, i, 1); - } - } -} - static void ixgbe_vlan_hw_extend_disable(struct rte_eth_dev *dev) { @@ -2114,14 +2056,57 @@ ixgbe_vlan_hw_extend_enable(struct rte_eth_dev *dev) */ } +void +ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) +{ + struct ixgbe_hw *hw = + IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; + uint32_t ctrl; + uint16_t i; + struct ixgbe_rx_queue *rxq; + bool on; + + PMD_INIT_FUNC_TRACE(); + + if (hw->mac.type == ixgbe_mac_82598EB) { + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) { + ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); + ctrl |= IXGBE_VLNCTRL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); + } else { + ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); + ctrl &= ~IXGBE_VLNCTRL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); + } + } else { + /* +* Other 10G NIC, the VLAN strip can be setup +* per queue in RXDCTL +*/ + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); + if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) { + ctrl |= IXGBE_RXDCTL_VME; + on = TRUE; + } else { + ctrl &= ~IXGBE_RXDCTL_VME; + on = FALSE; + } + IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); + + /* record those setting for HW strip per queue */ +
[dpdk-dev] [PATCH v2 3/4] net/ixgbe: convert to new Rx offloads API
Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit support the new Rx offloads API. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 93 + drivers/net/ixgbe/ixgbe_ipsec.c | 8 +- drivers/net/ixgbe/ixgbe_rxtx.c| 163 ++ drivers/net/ixgbe/ixgbe_rxtx.h| 3 + drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 2 +- 6 files changed, 205 insertions(+), 66 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 8bb67ba..9437f05 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2105,19 +2105,22 @@ ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) static int ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) { + struct rte_eth_rxmode *rxmode; + rxmode = &dev->data->dev_conf.rxmode; + if (mask & ETH_VLAN_STRIP_MASK) { ixgbe_vlan_hw_strip_config(dev); } if (mask & ETH_VLAN_FILTER_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_filter) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER) ixgbe_vlan_hw_filter_enable(dev); else ixgbe_vlan_hw_filter_disable(dev); } if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_extend) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND) ixgbe_vlan_hw_extend_enable(dev); else ixgbe_vlan_hw_extend_disable(dev); @@ -2332,6 +2335,8 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private); struct ixgbe_adapter *adapter = (struct ixgbe_adapter *)dev->data->dev_private; + struct rte_eth_dev_info dev_info; + uint64_t rx_offloads; int ret; PMD_INIT_FUNC_TRACE(); @@ -2343,6 +2348,15 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) return ret; } + ixgbe_dev_info_get(dev, &dev_info); + rx_offloads = dev->data->dev_conf.rxmode.offloads; + if ((rx_offloads & dev_info.rx_offload_capa) != rx_offloads) { + PMD_DRV_LOG(ERR, "Some Rx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + rx_offloads, dev_info.rx_offload_capa); + return -ENOTSUP; + } + /* set flag to update link status after init */ intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; @@ -3632,30 +3646,9 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) else dev_info->max_vmdq_pools = ETH_64_POOLS; dev_info->vmdq_queue_num = dev_info->max_rx_queues; - dev_info->rx_offload_capa = - DEV_RX_OFFLOAD_VLAN_STRIP | - DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM | - DEV_RX_OFFLOAD_CRC_STRIP; - - /* -* RSC is only supported by 82599 and x540 PF devices in a non-SR-IOV -* mode. -*/ - if ((hw->mac.type == ixgbe_mac_82599EB || -hw->mac.type == ixgbe_mac_X540) && - !RTE_ETH_DEV_SRIOV(dev).active) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; - - if (hw->mac.type == ixgbe_mac_82599EB || - hw->mac.type == ixgbe_mac_X540) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_MACSEC_STRIP; - - if (hw->mac.type == ixgbe_mac_X550 || - hw->mac.type == ixgbe_mac_X550EM_x || - hw->mac.type == ixgbe_mac_X550EM_a) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); + dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | +dev_info->rx_queue_offload_capa); dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | @@ -3675,10 +3668,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; #ifdef RTE_LIBRTE_SECURITY - if (dev->security_ctx) { - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_SECURITY; + if (dev->security_ctx) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY; - } #endif dev_info->default_rxconf = (struct rte_eth_rxconf) { @@ -3689,6 +3680,7
[dpdk-dev] [PATCH v2 0/4] ixgbe: convert to new offloads API
This patch set adds support of per queue VLAN strip offloading in ixgbe PF and VF. This patch support new offloads API in ixgbe PF and VF. --- v2: improve error checking Wei Dai (4): net/ixgbe: support VLAN strip per queue offloading in PF net/ixgbe: support VLAN strip per queue offloading in VF net/ixgbe: convert to new Rx offloads API net/ixgbe: convert to new Tx offloads API drivers/net/ixgbe/ixgbe_ethdev.c | 264 ++ drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_ipsec.c | 13 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_rxtx.c| 245 --- drivers/net/ixgbe/ixgbe_rxtx.h| 13 ++ drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 2 +- 8 files changed, 376 insertions(+), 172 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v2 4/4] net/ixgbe: convert to new Tx offloads API
Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new Tx offloads API. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 56 +-- drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++- drivers/net/ixgbe/ixgbe_rxtx.c | 81 ++-- drivers/net/ixgbe/ixgbe_rxtx.h | 9 + 4 files changed, 116 insertions(+), 35 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 9437f05..6288690 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2337,6 +2337,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) (struct ixgbe_adapter *)dev->data->dev_private; struct rte_eth_dev_info dev_info; uint64_t rx_offloads; + uint64_t tx_offloads; int ret; PMD_INIT_FUNC_TRACE(); @@ -2356,6 +2357,13 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) rx_offloads, dev_info.rx_offload_capa); return -ENOTSUP; } + tx_offloads = dev->data->dev_conf.txmode.offloads; + if ((tx_offloads & dev_info.tx_offload_capa) != tx_offloads) { + PMD_DRV_LOG(ERR, "Some Tx offloads are not supported " + "requested 0x%" PRIx64 " supported 0x%" PRIx64, + tx_offloads, dev_info.tx_offload_capa); + return -ENOTSUP; + } /* set flag to update link status after init */ intr->flags |= IXGBE_FLAG_NEED_LINK_UPDATE; @@ -3649,28 +3657,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); - - dev_info->tx_offload_capa = - DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM | - DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; - - if (hw->mac.type == ixgbe_mac_82599EB || - hw->mac.type == ixgbe_mac_X540) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_MACSEC_INSERT; - - if (hw->mac.type == ixgbe_mac_X550 || - hw->mac.type == ixgbe_mac_X550EM_x || - hw->mac.type == ixgbe_mac_X550EM_a) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; - -#ifdef RTE_LIBRTE_SECURITY - if (dev->security_ctx) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY; -#endif + dev_info->tx_queue_offload_capa = ixgbe_get_tx_queue_offloads(dev); + dev_info->tx_offload_capa = ixgbe_get_tx_port_offloads(dev); dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { @@ -3692,7 +3680,9 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOOFFLOADS, +ETH_TXQ_FLAGS_NOOFFLOADS | +ETH_TXQ_FLAGS_IGNORE, + .offloads = 0, }; dev_info->rx_desc_lim = rx_desc_lim; @@ -3776,12 +3766,8 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); - dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM | - DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; + dev_info->tx_queue_offload_capa = ixgbe_get_tx_queue_offloads(dev); + dev_info->tx_offload_capa = ixgbe_get_tx_port_offloads(dev); dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { @@ -3803,7 +3789,9 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOOFFLOADS, +ETH_TXQ_FLAGS_NOOFFLOADS | +ETH_TXQ_FLAGS_IGNORE, +
[dpdk-dev] [PATCH v2 2/4] net/ixgbe: support VLAN strip per queue offloading in VF
VLAN strip is a per queue offloading in VF. With this patch it can be enabled or disabled on any Rx queue in VF. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 73755d2..8bb67ba 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -5215,15 +5215,17 @@ ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ixgbe_rx_queue *rxq; uint16_t i; int on = 0; /* VF function only support hw strip feature, others are not support */ if (mask & ETH_VLAN_STRIP_MASK) { - on = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); - - for (i = 0; i < hw->mac.max_rx_queues; i++) + for (i = 0; i < hw->mac.max_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + on = !!(rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP); ixgbevf_vlan_strip_queue_set(dev, i, on); + } } return 0; -- 2.7.5
[dpdk-dev] [PATCH] net/fm10k: convert to new Rx/Tx offloads API
Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new Rx and Tx offloads API. Signed-off-by: Wei Dai --- drivers/net/fm10k/fm10k.h | 7 +++ drivers/net/fm10k/fm10k_ethdev.c | 33 - drivers/net/fm10k/fm10k_rxtx_vec.c | 6 +++--- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h index 30dad3e..57bd533 100644 --- a/drivers/net/fm10k/fm10k.h +++ b/drivers/net/fm10k/fm10k.h @@ -108,6 +108,11 @@ #define FM10K_SIMPLE_TX_FLAG ((uint32_t)ETH_TXQ_FLAGS_NOMULTSEGS | \ ETH_TXQ_FLAGS_NOOFFLOADS) +#define FM10K_SIMPLE_TX_OFFLOADS ((uint64_t)(DEV_TX_OFFLOAD_MULTI_SEGS | \ +DEV_TX_OFFLOAD_VLAN_INSERT | \ +DEV_TX_OFFLOAD_SCTP_CKSUM | \ +DEV_TX_OFFLOAD_UDP_CKSUM | \ +DEV_TX_OFFLOAD_TCP_CKSUM)) struct fm10k_macvlan_filter_info { uint16_t vlan_num; /* Total VLAN number */ @@ -180,6 +185,7 @@ struct fm10k_rx_queue { uint8_t drop_en; uint8_t rx_deferred_start; /* don't start this queue in dev start. */ uint16_t rx_ftag_en; /* indicates FTAG RX supported */ + uint64_t offloads; /* offloads of DEV_RX_OFFLOAD_* */ }; /* @@ -212,6 +218,7 @@ struct fm10k_tx_queue { uint16_t next_dd; /* Next pos to check DD flag */ volatile uint32_t *tail_ptr; uint32_t txq_flags; /* Holds flags for this TXq */ + uint64_t offloads; /* Offloads of DEV_TX_OFFLOAD_* */ uint16_t nb_desc; uint16_t port_id; uint8_t tx_deferred_start; /** don't start this queue in dev start. */ diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 9423761..5105874 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -444,7 +444,7 @@ fm10k_dev_configure(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); - if (dev->data->dev_conf.rxmode.hw_strip_crc == 0) + if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP) PMD_INIT_LOG(WARNING, "fm10k always strip CRC"); /* multipe queue mode checking */ ret = fm10k_check_mq_mode(dev); @@ -454,6 +454,8 @@ fm10k_dev_configure(struct rte_eth_dev *dev) return ret; } + dev->data->scattered_rx = 0; + return 0; } @@ -756,7 +758,7 @@ fm10k_dev_rx_init(struct rte_eth_dev *dev) /* It adds dual VLAN length for supporting dual VLAN */ if ((dev->data->dev_conf.rxmode.max_rx_pkt_len + 2 * FM10K_VLAN_TAG_SIZE) > buf_size || - dev->data->dev_conf.rxmode.enable_scatter) { + rxq->offloads & DEV_RX_OFFLOAD_SCATTER) { uint32_t reg; dev->data->scattered_rx = 1; reg = FM10K_READ_REG(hw, FM10K_SRRCTL(i)); @@ -1389,11 +1391,17 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, dev_info->vmdq_queue_base= 0; dev_info->max_vmdq_pools = ETH_32_POOLS; dev_info->vmdq_queue_num = FM10K_MAX_QUEUES_PF; + dev_info->rx_queue_offload_capa = DEV_RX_OFFLOAD_SCATTER; dev_info->rx_offload_capa = - DEV_RX_OFFLOAD_VLAN_STRIP | - DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM; + DEV_RX_OFFLOAD_VLAN_STRIP | + DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_IPV4_CKSUM | + DEV_RX_OFFLOAD_UDP_CKSUM | + DEV_RX_OFFLOAD_TCP_CKSUM | + DEV_RX_OFFLOAD_JUMBO_FRAME | + DEV_RX_OFFLOAD_CRC_STRIP | + DEV_RX_OFFLOAD_SCATTER; + dev_info->tx_queue_offload_capa = 0; dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | @@ -1412,6 +1420,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, }, .rx_free_thresh = FM10K_RX_FREE_THRESH_DEFAULT(0), .rx_drop_en = 0, + .offloads = 0, }; dev_info->default_txconf = (struct rte_eth_txconf) { @@ -1423,6 +1432,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, .tx_free_thresh = FM10K_TX_FREE_THRESH_DEFAULT(0), .tx_rs_thresh = FM10K_TX_RS_THRESH_DEFAULT(0), .txq_flags = FM10K_SIMPLE_TX_FLAG, + .offload
[dpdk-dev] [PATCH 2/2] net/e1000: convert to new Tx offloads API
Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new Tx offloads API. Signed-off-by: Wei Dai --- drivers/net/e1000/em_ethdev.c | 1 + drivers/net/e1000/em_rxtx.c| 3 +++ drivers/net/e1000/igb_ethdev.c | 4 drivers/net/e1000/igb_rxtx.c | 3 +++ 4 files changed, 11 insertions(+) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index acd0d22..a9439c2 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1125,6 +1125,7 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) * for better compatibility. */ dev_info->rx_queue_offload_capa = dev_info->rx_offload_capa; + dev_info->tx_queue_offload_capa = dev_info->tx_offload_capa; /* * Starting with 631xESB hw supports 2 TX/RX queues per port. diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 9b328b1..6039c97 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -164,6 +164,7 @@ struct em_tx_queue { uint8_twthresh; /**< Write-back threshold register. */ struct em_ctx_info ctx_cache; /**< Hardware context history.*/ + uint64_t offloads; /**< offloads of DEV_TX_OFFLOAD_* */ }; #if 1 @@ -1270,6 +1271,7 @@ eth_em_tx_queue_setup(struct rte_eth_dev *dev, em_reset_tx_queue(txq); dev->data->tx_queues[queue_idx] = txq; + txq->offloads = tx_conf->offloads; return 0; } @@ -1916,4 +1918,5 @@ em_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, qinfo->conf.tx_thresh.wthresh = txq->wthresh; qinfo->conf.tx_free_thresh = txq->tx_free_thresh; qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh; + qinfo->conf.offloads = txq->offloads; } diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 7c47171..9396502 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2217,6 +2217,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO; + dev_info->tx_queue_offload_capa = dev_info->tx_offload_capa; switch (hw->mac.type) { case e1000_82575: @@ -2289,6 +2290,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .wthresh = IGB_DEFAULT_TX_WTHRESH, }, .txq_flags = 0, + .offloads = 0, }; dev_info->rx_desc_lim = rx_desc_lim; @@ -2348,6 +2350,7 @@ eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO; + dev_info->tx_queue_offload_capa = dev_info->tx_offload_capa; switch (hw->mac.type) { case e1000_vfadapt: dev_info->max_rx_queues = 2; @@ -2382,6 +2385,7 @@ eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .wthresh = IGB_DEFAULT_TX_WTHRESH, }, .txq_flags = 0, + .offloads = 0, }; dev_info->rx_desc_lim = rx_desc_lim; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 9c33fda..0fcd9c4 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -181,6 +181,7 @@ struct igb_tx_queue { /**< Start context position for transmit queue. */ struct igb_advctx_info ctx_cache[IGB_CTX_NUM]; /**< Hardware context history.*/ + uint64_t offloads; /**< offloads of DEV_TX_OFFLOAD_* */ }; #if 1 @@ -1543,6 +1544,7 @@ eth_igb_tx_queue_setup(struct rte_eth_dev *dev, dev->tx_pkt_burst = eth_igb_xmit_pkts; dev->tx_pkt_prepare = ð_igb_prep_pkts; dev->data->tx_queues[queue_idx] = txq; + txq->offloads = tx_conf->offloads; return 0; } @@ -2794,6 +2796,7 @@ igb_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, qinfo->conf.tx_thresh.pthresh = txq->pthresh; qinfo->conf.tx_thresh.hthresh = txq->hthresh; qinfo->conf.tx_thresh.wthresh = txq->wthresh; + qinfo->conf.offloads = txq->offloads; } int -- 2.9.4
[dpdk-dev] [PATCH 1/2] net/e1000: convert to new Rx offloads API
Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit support the new Rx offloads API. Signed-off-by: Wei Dai --- drivers/net/e1000/em_ethdev.c | 32 +++- drivers/net/e1000/em_rxtx.c| 27 ++--- drivers/net/e1000/igb_ethdev.c | 53 + drivers/net/e1000/igb_rxtx.c | 66 +- 4 files changed, 127 insertions(+), 51 deletions(-) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 242375f..acd0d22 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -1105,15 +1105,26 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_pktlen = em_get_max_pktlen(hw); dev_info->max_mac_addrs = hw->mac.rar_entry_count; dev_info->rx_offload_capa = - DEV_RX_OFFLOAD_VLAN_STRIP | - DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM; + DEV_RX_OFFLOAD_VLAN_STRIP | + DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_IPV4_CKSUM | + DEV_RX_OFFLOAD_UDP_CKSUM | + DEV_RX_OFFLOAD_TCP_CKSUM | + DEV_RX_OFFLOAD_CRC_STRIP | + DEV_RX_OFFLOAD_SCATTER; + if (dev_info->max_rx_pktlen > ETHER_MAX_LEN) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_JUMBO_FRAME; dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM; + /* +* As only one Rx/Tx queue can be used, let per queue offloading +* capability be same to per port queue offloading capability +* for better compatibility. +*/ + dev_info->rx_queue_offload_capa = dev_info->rx_offload_capa; /* * Starting with 631xESB hw supports 2 TX/RX queues per port. @@ -1460,15 +1471,18 @@ em_vlan_hw_strip_enable(struct rte_eth_dev *dev) static int eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask) { + struct rte_eth_rxmode *rxmode; + + rxmode = &dev->data->dev_conf.rxmode; if(mask & ETH_VLAN_STRIP_MASK){ - if (dev->data->dev_conf.rxmode.hw_vlan_strip) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) em_vlan_hw_strip_enable(dev); else em_vlan_hw_strip_disable(dev); } if(mask & ETH_VLAN_FILTER_MASK){ - if (dev->data->dev_conf.rxmode.hw_vlan_filter) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER) em_vlan_hw_filter_enable(dev); else em_vlan_hw_filter_disable(dev); @@ -1835,10 +1849,12 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) /* switch to jumbo mode if needed */ if (frame_size > ETHER_MAX_LEN) { - dev->data->dev_conf.rxmode.jumbo_frame = 1; + dev->data->dev_conf.rxmode.offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; rctl |= E1000_RCTL_LPE; } else { - dev->data->dev_conf.rxmode.jumbo_frame = 0; + dev->data->dev_conf.rxmode.offloads &= + ~DEV_RX_OFFLOAD_JUMBO_FRAME; rctl &= ~E1000_RCTL_LPE; } E1000_WRITE_REG(hw, E1000_RCTL, rctl); diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 02fae10..9b328b1 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -85,6 +85,7 @@ struct em_rx_queue { struct em_rx_entry *sw_ring; /**< address of RX software ring. */ struct rte_mbuf *pkt_first_seg; /**< First segment of current packet. */ struct rte_mbuf *pkt_last_seg; /**< Last segment of current packet. */ + uint64_toffloads; /**< Offloads of DEV_RX_OFFLOAD_* */ uint16_tnb_rx_desc; /**< number of RX descriptors. */ uint16_trx_tail;/**< current value of RDT register. */ uint16_tnb_rx_hold; /**< number of held free RX desc. */ @@ -1382,8 +1383,8 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev, rxq->rx_free_thresh = rx_conf->rx_free_thresh; rxq->queue_id = queue_idx; rxq->port_id = dev->data->port_id; - rxq->crc_len = (uint8_t) ((dev->data->dev_conf.rxmode.hw_strip_crc) ? - 0 : ETHER_CRC_LEN); + rxq->crc_len = (uint8_t)((dev->data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_CRC_STRIP) ?
[dpdk-dev] [PATCH 0/2] net/e1000: convert to new Rx/Tx offloads API
This patch set convert net/e1000 to new Rx/Tx offloads API. All Rx offloads are per port features. All Tx offloads of e1000 are per queue and also per packet as they are enabled in Tx descriptor. In the new offload API, per queue offload only need to be set in queue_setup(). So if the maimum number of queues is only one in Rx or Tx path, let all offloads in the path are per queue for better convenience. Wei Dai (2): net/e1000: convert to new Rx offloads API net/e1000: convert to new Tx offloads API drivers/net/e1000/em_ethdev.c | 33 +++- drivers/net/e1000/em_rxtx.c| 30 +++--- drivers/net/e1000/igb_ethdev.c | 57 +++--- drivers/net/e1000/igb_rxtx.c | 69 +- 4 files changed, 138 insertions(+), 51 deletions(-) -- 2.9.4
[dpdk-dev] [PATCH 2/4] net/ixgbe: support VLAN strip per queue offloading in VF
VLAN strip is a per queue offloading in VF. With this patch it can be enabled or disabled on any Rx queue in VF. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 73755d2..8bb67ba 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -5215,15 +5215,17 @@ ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ixgbe_rx_queue *rxq; uint16_t i; int on = 0; /* VF function only support hw strip feature, others are not support */ if (mask & ETH_VLAN_STRIP_MASK) { - on = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); - - for (i = 0; i < hw->mac.max_rx_queues; i++) + for (i = 0; i < hw->mac.max_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + on = !!(rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP); ixgbevf_vlan_strip_queue_set(dev, i, on); + } } return 0; -- 2.7.5
[dpdk-dev] [PATCH 3/4] net/ixgbe: convert to new Rx offloads API
Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit support the new Rx offloads API. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 88 +- drivers/net/ixgbe/ixgbe_ipsec.c | 8 +- drivers/net/ixgbe/ixgbe_rxtx.c| 143 ++ drivers/net/ixgbe/ixgbe_rxtx.h| 3 + drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 2 +- 6 files changed, 180 insertions(+), 66 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 8bb67ba..b9a23eb 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2105,19 +2105,22 @@ ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) static int ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) { + struct rte_eth_rxmode *rxmode; + rxmode = &dev->data->dev_conf.rxmode; + if (mask & ETH_VLAN_STRIP_MASK) { ixgbe_vlan_hw_strip_config(dev); } if (mask & ETH_VLAN_FILTER_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_filter) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER) ixgbe_vlan_hw_filter_enable(dev); else ixgbe_vlan_hw_filter_disable(dev); } if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.hw_vlan_extend) + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND) ixgbe_vlan_hw_extend_enable(dev); else ixgbe_vlan_hw_extend_disable(dev); @@ -2353,6 +2356,15 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) adapter->rx_bulk_alloc_allowed = true; adapter->rx_vec_allowed = true; + /* +* Header split and VLAN strip are per queue offload features, +* clear them first and set them if they are enabled on any Rx queue. +* This is for set_rx_function() called later. +*/ + if (dev->data->dev_conf.rxmode.ignore_offload_bitfield) + dev->data->dev_conf.rxmode.offloads &= + ~(ixgbe_get_rx_port_offloads(dev)); + return 0; } @@ -3632,30 +3644,9 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) else dev_info->max_vmdq_pools = ETH_64_POOLS; dev_info->vmdq_queue_num = dev_info->max_rx_queues; - dev_info->rx_offload_capa = - DEV_RX_OFFLOAD_VLAN_STRIP | - DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM | - DEV_RX_OFFLOAD_CRC_STRIP; - - /* -* RSC is only supported by 82599 and x540 PF devices in a non-SR-IOV -* mode. -*/ - if ((hw->mac.type == ixgbe_mac_82599EB || -hw->mac.type == ixgbe_mac_X540) && - !RTE_ETH_DEV_SRIOV(dev).active) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TCP_LRO; - - if (hw->mac.type == ixgbe_mac_82599EB || - hw->mac.type == ixgbe_mac_X540) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_MACSEC_STRIP; - - if (hw->mac.type == ixgbe_mac_X550 || - hw->mac.type == ixgbe_mac_X550EM_x || - hw->mac.type == ixgbe_mac_X550EM_a) - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; + dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); + dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | +dev_info->rx_queue_offload_capa); dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | @@ -3675,10 +3666,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; #ifdef RTE_LIBRTE_SECURITY - if (dev->security_ctx) { - dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_SECURITY; + if (dev->security_ctx) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY; - } #endif dev_info->default_rxconf = (struct rte_eth_rxconf) { @@ -3689,6 +3678,7 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) }, .rx_free_thresh = IXGBE_DEFAULT_RX_FREE_THRESH, .rx_drop_en = 0, + .offloads = 0, }; dev_info->default_txconf = (struct rte_eth_txconf) { @@ -3781,11 +3771,9 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->max_vmdq_pools = ETH_16_POOLS; else
[dpdk-dev] [PATCH 4/4] net/ixgbe: convert to new Tx offloads API
Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit support the new Tx offloads API. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 40 +++-- drivers/net/ixgbe/ixgbe_ipsec.c | 5 +++- drivers/net/ixgbe/ixgbe_rxtx.c | 65 +--- drivers/net/ixgbe/ixgbe_rxtx.h | 8 + 4 files changed, 83 insertions(+), 35 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index b9a23eb..1f4881e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3647,28 +3647,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); - - dev_info->tx_offload_capa = - DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM | - DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; - - if (hw->mac.type == ixgbe_mac_82599EB || - hw->mac.type == ixgbe_mac_X540) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_MACSEC_INSERT; - - if (hw->mac.type == ixgbe_mac_X550 || - hw->mac.type == ixgbe_mac_X550EM_x || - hw->mac.type == ixgbe_mac_X550EM_a) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; - -#ifdef RTE_LIBRTE_SECURITY - if (dev->security_ctx) - dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_SECURITY; -#endif + dev_info->tx_queue_offload_capa = 0; + dev_info->tx_offload_capa = ixgbe_get_tx_port_offlaods(dev); dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { @@ -3690,7 +3670,9 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOOFFLOADS, +ETH_TXQ_FLAGS_NOOFFLOADS | +ETH_TXQ_FLAGS_IGNORE, + .offloads = 0, }; dev_info->rx_desc_lim = rx_desc_lim; @@ -3774,12 +3756,8 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->rx_queue_offload_capa = ixgbe_get_rx_queue_offloads(dev); dev_info->rx_offload_capa = (ixgbe_get_rx_port_offloads(dev) | dev_info->rx_queue_offload_capa); - dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT | - DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM | - DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_TCP_TSO; + dev_info->tx_queue_offload_capa = 0; + dev_info->tx_offload_capa = ixgbe_get_tx_port_offlaods(dev); dev_info->default_rxconf = (struct rte_eth_rxconf) { .rx_thresh = { @@ -3801,7 +3779,9 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, .tx_free_thresh = IXGBE_DEFAULT_TX_FREE_THRESH, .tx_rs_thresh = IXGBE_DEFAULT_TX_RSBIT_THRESH, .txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | - ETH_TXQ_FLAGS_NOOFFLOADS, +ETH_TXQ_FLAGS_NOOFFLOADS | +ETH_TXQ_FLAGS_IGNORE, + .offloads = 0, }; dev_info->rx_desc_lim = rx_desc_lim; diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c index 29e4728..de7ed36 100644 --- a/drivers/net/ixgbe/ixgbe_ipsec.c +++ b/drivers/net/ixgbe/ixgbe_ipsec.c @@ -599,8 +599,11 @@ ixgbe_crypto_enable_ipsec(struct rte_eth_dev *dev) struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); uint32_t reg; uint64_t rx_offloads; + uint64_t tx_offloads; rx_offloads = dev->data->dev_conf.rxmode.offloads; + tx_offloads = dev->data->dev_conf.txmode.offloads; + /* sanity checks */ if (rx_offloads & DEV_RX_OFFLOAD_TCP_LRO) { PMD_DRV_LOG(ERR, "RSC and IPsec not supported"); @@ -634,7 +637,7 @@ ixgbe_crypto_enable_ipsec(struct rte_eth_dev *dev) return -1; } } - if (dev->data->dev_conf.txmode.offloads & DEV_TX_OFFLOAD_SECURITY) { + if (tx_offloads & DEV_TX_OFF
[dpdk-dev] [PATCH 1/4] net/ixgbe: support VLAN strip per queue offloading in PF
VLAN strip is a per queue offloading in PF. With this patch it can be enabled or disabled on any Rx queue in PF. Signed-off-by: Wei Dai --- drivers/net/ixgbe/ixgbe_ethdev.c | 109 +-- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_rxtx.c | 1 + drivers/net/ixgbe/ixgbe_rxtx.h | 1 + 5 files changed, 51 insertions(+), 69 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4483258..73755d2 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2001,64 +2001,6 @@ ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue) ixgbe_vlan_hw_strip_bitmap_set(dev, queue, 1); } -void -ixgbe_vlan_hw_strip_disable_all(struct rte_eth_dev *dev) -{ - struct ixgbe_hw *hw = - IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t ctrl; - uint16_t i; - struct ixgbe_rx_queue *rxq; - - PMD_INIT_FUNC_TRACE(); - - if (hw->mac.type == ixgbe_mac_82598EB) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); - ctrl &= ~IXGBE_VLNCTRL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); - } else { - /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */ - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); - ctrl &= ~IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); - - /* record those setting for HW strip per queue */ - ixgbe_vlan_hw_strip_bitmap_set(dev, i, 0); - } - } -} - -void -ixgbe_vlan_hw_strip_enable_all(struct rte_eth_dev *dev) -{ - struct ixgbe_hw *hw = - IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t ctrl; - uint16_t i; - struct ixgbe_rx_queue *rxq; - - PMD_INIT_FUNC_TRACE(); - - if (hw->mac.type == ixgbe_mac_82598EB) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); - ctrl |= IXGBE_VLNCTRL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); - } else { - /* Other 10G NIC, the VLAN strip can be setup per queue in RXDCTL */ - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); - ctrl |= IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); - - /* record those setting for HW strip per queue */ - ixgbe_vlan_hw_strip_bitmap_set(dev, i, 1); - } - } -} - static void ixgbe_vlan_hw_extend_disable(struct rte_eth_dev *dev) { @@ -2114,14 +2056,57 @@ ixgbe_vlan_hw_extend_enable(struct rte_eth_dev *dev) */ } +void +ixgbe_vlan_hw_strip_config(struct rte_eth_dev *dev) +{ + struct ixgbe_hw *hw = + IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; + uint32_t ctrl; + uint16_t i; + struct ixgbe_rx_queue *rxq; + bool on; + + PMD_INIT_FUNC_TRACE(); + + if (hw->mac.type == ixgbe_mac_82598EB) { + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) { + ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); + ctrl |= IXGBE_VLNCTRL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); + } else { + ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); + ctrl &= ~IXGBE_VLNCTRL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); + } + } else { + /* +* Other 10G NIC, the VLAN strip can be setup +* per queue in RXDCTL +*/ + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxq->reg_idx)); + if (rxq->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) { + ctrl |= IXGBE_RXDCTL_VME; + on = TRUE; + } else { + ctrl &= ~IXGBE_RXDCTL_VME; + on = FALSE; + } + IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxq->reg_idx), ctrl); + + /* record those setting for HW strip per queue */ +
[dpdk-dev] [PATCH 0/4] ixgbe: convert to new offloads API
This patch set adds support of per queue VLAN strip offloading in ixgbe PF and VF. This patch support new offloads API in ixgbe PF and VF. Wei Dai (4): net/ixgbe: support VLAN strip per queue offloading in PF net/ixgbe: support VLAN strip per queue offloading in VF net/ixgbe: convert to new Rx offloads API net/ixgbe: convert to new Tx offloads API drivers/net/ixgbe/ixgbe_ethdev.c | 243 +- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_ipsec.c | 13 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_rxtx.c| 209 ++--- drivers/net/ixgbe/ixgbe_rxtx.h| 12 ++ drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 2 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 2 +- 8 files changed, 318 insertions(+), 172 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH] ethdev: check consistency of per port offloads
A per port offloading feature should be enabled or disabled at same time in both rte_eth_dev_configure( ) and rte_eth_rx_queue_setup( )/rte_eth_tx_queue_setup( ). This patch check if a per port offloading flag has same configuration in rte_eth_dev_configure( ) and rte_eth_rx_queue_setup( )/rte_eth_tx_queue_setup( ). This patch can make such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. Signed-off-by: Wei Dai --- lib/librte_ether/rte_ethdev.c | 70 +++ 1 file changed, 70 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 78bed1a..7945890 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1404,6 +1404,44 @@ rte_eth_dev_is_removed(uint16_t port_id) return ret; } +/** +* Check if the Rx/Tx queue offloading settings is valid +* @param queue_offloads +* offloads input to rte_eth_rx_queue_setup( ) or rte_eth_tx_queue_setup( ) +* @param port_offloads +* Rx or Tx offloads input to rte_eth_dev_configure( ) +* @param queue_offload_capa +* rx_queue_offload_capa or tx_queue_offload_capa in struct rte_eth_dev_ifnfo +* got from rte_eth_dev_info_get( ) +* @param all_offload_capa +* rx_offload_capa or tx_offload_capa in struct rte_eth_dev_info +* got from rte_eth_dev_info_get( ) +* +* @return +* Nonzero when per-queue offloading setting is valid +*/ +static int +rte_eth_check_queue_offloads(uint64_t queue_offloads, +uint64_t port_offloads, +uint64_t queue_offload_capa, +uint64_t all_offload_capa) +{ + uint64_t pure_port_capa = all_offload_capa ^ queue_offload_capa; + + return !((port_offloads ^ queue_offloads) & pure_port_capa); +} + +static int +rte_eth_check_rx_queue_offloads(uint64_t rx_queue_offloads, + const struct rte_eth_rxmode *rxmode, + const struct rte_eth_dev_info *dev_info) +{ + return rte_eth_check_queue_offloads(rx_queue_offloads, + rxmode->offloads, + dev_info->rx_queue_offload_capa, + dev_info->rx_offload_capa); +} + int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, @@ -1446,6 +1484,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, (int) sizeof(struct rte_pktmbuf_pool_private)); return -ENOSPC; } + mbp_buf_size = rte_pktmbuf_data_room_size(mp); if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) < dev_info.min_rx_bufsize) { @@ -1495,6 +1534,16 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, &local_conf.offloads); } + if (!rte_eth_check_rx_queue_offloads(local_conf.offloads, + &dev->data->dev_conf.rxmode, &dev_info)) { + RTE_PMD_DEBUG_TRACE("%p : Rx queue offloads ox%" PRIx64 + " don't match port offloads 0x%" PRIx64 + " or supported offloads 0x%" PRIx64, + (void *)dev, local_conf.offloads, + dev_info.rx_offload_capa); + return -ENOTSUP; + } + ret = (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, socket_id, &local_conf, mp); if (!ret) { @@ -1555,6 +1604,17 @@ rte_eth_convert_txq_offloads(const uint64_t tx_offloads, uint32_t *txq_flags) *txq_flags = flags; } +static int +rte_eth_check_tx_queue_offloads(uint64_t tx_queue_offloads, + const struct rte_eth_txmode *txmode, + const struct rte_eth_dev_info *dev_info) +{ + return rte_eth_check_queue_offloads(tx_queue_offloads, + txmode->offloads, + dev_info->tx_queue_offload_capa, + dev_info->tx_offload_capa); +} + int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, @@ -1622,6 +1682,16 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, &local_conf.offloads); } + if (!rte_eth_check_tx_queue_offloads(local_conf.offloads, + &dev->data->dev_conf.txmode, &dev_info)) { + RTE_PMD_DEBUG_TRACE("%p : Tx queue offloads ox%" PRIx64 + " don't match port offloads 0x%" PRIx64 + " or su
[dpdk-dev] [PATCH] ethdev: fix comments for offload capabilites
Indeed, rx_offload_capa or tx_offload_capa in struct rte_eth_dev_info includes not only per port offloading features but also per queue ones. This patch make its meaning much clearer. Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API") Fixes: cba7f53b717d ("ethdev: introduce Tx queue offloads API") Cc: sta...@dpdk.org Signed-off-by: Wei Dai --- lib/librte_ether/rte_ethdev.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0361533..6ab6552 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1006,9 +1006,11 @@ struct rte_eth_dev_info { uint16_t max_vfs; /**< Maximum number of VFs. */ uint16_t max_vmdq_pools; /**< Maximum number of VMDq pools. */ uint64_t rx_offload_capa; - /**< Device per port RX offload capabilities. */ + /**< Rx offload capabilities including all per port ones + and all per queue ones. */ uint64_t tx_offload_capa; - /**< Device per port TX offload capabilities. */ + /**< Tx offload capabilities including all per port ones + and all per queue ones. */ uint64_t rx_queue_offload_capa; /**< Device per queue RX offload capabilities. */ uint64_t tx_queue_offload_capa; -- 2.7.5
[dpdk-dev] [PATCH v6 2/2] app/testpmd: fix invalid txq number setting
If an invalid number of TX queues is configured from testpmd run-time command like "port config all txq number" or from --txq in the command to start testpmd, the global variable nb_txq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid txq setting and keeps its last correct value. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Acked-by: Konstantin Ananyev Tested-by: Yuan Peng --- app/test-pmd/cmdline.c| 2 ++ app/test-pmd/parameters.c | 6 +++--- app/test-pmd/testpmd.c| 46 ++ app/test-pmd/testpmd.h| 2 ++ 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f0623b1..6619cb8 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, printf("Warning: Either rx or tx queues should be non zero\n"); return; } + if (check_nb_txq(res->value) != 0) + return; nb_txq = res->value; } else if (!strcmp(res->name, "rxd")) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index c46e734..ca2af65 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -932,12 +932,12 @@ launch_args_parse(int argc, char** argv) } if (!strcmp(lgopts[opt_idx].name, "txq")) { n = atoi(optarg); - if (n >= 0 && n <= (int) MAX_QUEUE_ID) + if (n >= 0 && check_nb_txq((queueid_t)n) == 0) nb_txq = (queueid_t) n; else rte_exit(EXIT_FAILURE, "txq %d invalid - must be" - " >= 0 && <= %d\n", n, - (int) MAX_QUEUE_ID); + " >= 0 && <= %u\n", n, + get_allowed_max_nb_txq(&pid)); } if (!nb_rxq && !nb_txq) { rte_exit(EXIT_FAILURE, "Either rx or tx queues should " diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4e8667d..493e028 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -586,6 +586,52 @@ check_nb_rxq(queueid_t rxq) return 0; } +/* + * Get the allowed maximum number of TX queues. + * *pid return the port id which has minimal value of + * max_tx_queues in all ports. + */ +queueid_t +get_allowed_max_nb_txq(portid_t *pid) +{ + queueid_t allowed_max_txq = MAX_QUEUE_ID; + portid_t pi; + struct rte_eth_dev_info dev_info; + + RTE_ETH_FOREACH_DEV(pi) { + rte_eth_dev_info_get(pi, &dev_info); + if (dev_info.max_tx_queues < allowed_max_txq) { + allowed_max_txq = dev_info.max_tx_queues; + *pid = pi; + } + } + return allowed_max_txq; +} + +/* + * Check input txq is valid or not. + * If input txq is not greater than any of maximum number + * of TX queues of all ports, it is valid. + * if valid, return 0, else return -1 + */ +int +check_nb_txq(queueid_t txq) +{ + queueid_t allowed_max_txq; + portid_t pid = 0; + + allowed_max_txq = get_allowed_max_nb_txq(&pid); + if (txq > allowed_max_txq) { + printf("Fail: input txq (%u) can't be greater " + "than max_tx_queues (%u) of port %u\n", + txq, + allowed_max_txq, + pid); + return -1; + } + return 0; +} + static void init_config(void) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index e815509..fe40892 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -702,6 +702,8 @@ int new_socket_id(unsigned int socket_id); queueid_t get_allowed_max_nb_rxq(portid_t *pid); int check_nb_rxq(queueid_t rxq); +queueid_t get_allowed_max_nb_txq(portid_t *pid); +int check_nb_txq(queueid_t txq); /* * Work-around of a compilation error with ICC on invocations of the -- 2.7.5
[dpdk-dev] [PATCH v6 1/2] app/testpmd: fix invalid rxq number setting
If an invalid number of RX queues is configured from testpmd run-time command like "port config all rxq number" or from --rxq in the command to start testpmd, the global variable nb_rxq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid rxq setting and keeps its last correct value. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Acked-by: Konstantin Ananyev Tested-by: Yuan Peng --- app/test-pmd/cmdline.c| 2 ++ app/test-pmd/parameters.c | 7 --- app/test-pmd/testpmd.c| 46 ++ app/test-pmd/testpmd.h| 3 +++ 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5b2e2ef..f0623b1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, printf("Warning: Either rx or tx queues should be non zero\n"); return; } + if (check_nb_rxq(res->value) != 0) + return; nb_rxq = res->value; } else if (!strcmp(res->name, "txq")) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 304b98d..c46e734 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv) int n, opt; char **argvopt; int opt_idx; + portid_t pid; enum { TX, RX }; static struct option lgopts[] = { @@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv) rss_hf = ETH_RSS_UDP; if (!strcmp(lgopts[opt_idx].name, "rxq")) { n = atoi(optarg); - if (n >= 0 && n <= (int) MAX_QUEUE_ID) + if (n >= 0 && check_nb_rxq((queueid_t)n) == 0) nb_rxq = (queueid_t) n; else rte_exit(EXIT_FAILURE, "rxq %d invalid - must be" - " >= 0 && <= %d\n", n, - (int) MAX_QUEUE_ID); + " >= 0 && <= %u\n", n, + get_allowed_max_nb_rxq(&pid)); } if (!strcmp(lgopts[opt_idx].name, "txq")) { n = atoi(optarg); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 9414d0e..4e8667d 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -540,6 +540,52 @@ check_socket_id(const unsigned int socket_id) return 0; } +/* + * Get the allowed maximum number of RX queues. + * *pid return the port id which has minimal value of + * max_rx_queues in all ports. + */ +queueid_t +get_allowed_max_nb_rxq(portid_t *pid) +{ + queueid_t allowed_max_rxq = MAX_QUEUE_ID; + portid_t pi; + struct rte_eth_dev_info dev_info; + + RTE_ETH_FOREACH_DEV(pi) { + rte_eth_dev_info_get(pi, &dev_info); + if (dev_info.max_rx_queues < allowed_max_rxq) { + allowed_max_rxq = dev_info.max_rx_queues; + *pid = pi; + } + } + return allowed_max_rxq; +} + +/* + * Check input rxq is valid or not. + * If input rxq is not greater than any of maximum number + * of RX queues of all ports, it is valid. + * if valid, return 0, else return -1 + */ +int +check_nb_rxq(queueid_t rxq) +{ + queueid_t allowed_max_rxq; + portid_t pid = 0; + + allowed_max_rxq = get_allowed_max_nb_rxq(&pid); + if (rxq > allowed_max_rxq) { + printf("Fail: input rxq (%u) can't be greater " + "than max_rx_queues (%u) of port %u\n", + rxq, + allowed_max_rxq, + pid); + return -1; + } + return 0; +} + static void init_config(void) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2a266fd..e815509 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -700,6 +700,9 @@ enum print_warning { int port_id_is_invalid(portid_t port_id, enum print_warning warning); int new_socket_id(unsigned int socket_id); +queueid_t get_allowed_max_nb_rxq(portid_t *pid); +int check_nb_rxq(queueid_t rxq); + /* * Work-around of a compilation error with ICC on invocations of the * rte_be_to_cpu_16() function. -- 2.7.5
[dpdk-dev] [PATCH v6 0/2] app/testpmd: fix invalid rxq and txq nubmer settings
If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number" or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence. With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Aced-by: Konstantin Ananyev Tested-by: Yuan Peng --- v6: same as v5. only correct patchwork mail format error for maintainer's convenience. v5: fix building failure with -Werror=maybe-uninitialized by gcc 5.3.1 fix typo error v4: update git log message and rename 2 new added functions v3: follow the guide from Konstantin to use functions to check input rxq and txq instead of usage of new added global variables. v2: fix a bug in v1 Wei Dai (2): app/testpmd: fix invalid rxq number setting app/testpmd: fix invalid txq number setting app/test-pmd/cmdline.c| 4 +++ app/test-pmd/parameters.c | 13 +++ app/test-pmd/testpmd.c| 92 +++ app/test-pmd/testpmd.h| 5 +++ 4 files changed, 108 insertions(+), 6 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v5 2/2] app/testpmd: fix invalid txq number setting
If an invalid number of TX queues is configured from testpmd run-time command like "port config all txq number" or from --txq in the command to start testpmd, the global variable nb_txq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid txq setting and keeps its last correct value. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Acked-by: Konstantin Ananyev --- app/test-pmd/cmdline.c| 2 ++ app/test-pmd/parameters.c | 6 +++--- app/test-pmd/testpmd.c| 46 ++ app/test-pmd/testpmd.h| 2 ++ 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f0623b1..6619cb8 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, printf("Warning: Either rx or tx queues should be non zero\n"); return; } + if (check_nb_txq(res->value) != 0) + return; nb_txq = res->value; } else if (!strcmp(res->name, "rxd")) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index c46e734..ca2af65 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -932,12 +932,12 @@ launch_args_parse(int argc, char** argv) } if (!strcmp(lgopts[opt_idx].name, "txq")) { n = atoi(optarg); - if (n >= 0 && n <= (int) MAX_QUEUE_ID) + if (n >= 0 && check_nb_txq((queueid_t)n) == 0) nb_txq = (queueid_t) n; else rte_exit(EXIT_FAILURE, "txq %d invalid - must be" - " >= 0 && <= %d\n", n, - (int) MAX_QUEUE_ID); + " >= 0 && <= %u\n", n, + get_allowed_max_nb_txq(&pid)); } if (!nb_rxq && !nb_txq) { rte_exit(EXIT_FAILURE, "Either rx or tx queues should " diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4e8667d..493e028 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -586,6 +586,52 @@ check_nb_rxq(queueid_t rxq) return 0; } +/* + * Get the allowed maximum number of TX queues. + * *pid return the port id which has minimal value of + * max_tx_queues in all ports. + */ +queueid_t +get_allowed_max_nb_txq(portid_t *pid) +{ + queueid_t allowed_max_txq = MAX_QUEUE_ID; + portid_t pi; + struct rte_eth_dev_info dev_info; + + RTE_ETH_FOREACH_DEV(pi) { + rte_eth_dev_info_get(pi, &dev_info); + if (dev_info.max_tx_queues < allowed_max_txq) { + allowed_max_txq = dev_info.max_tx_queues; + *pid = pi; + } + } + return allowed_max_txq; +} + +/* + * Check input txq is valid or not. + * If input txq is not greater than any of maximum number + * of TX queues of all ports, it is valid. + * if valid, return 0, else return -1 + */ +int +check_nb_txq(queueid_t txq) +{ + queueid_t allowed_max_txq; + portid_t pid = 0; + + allowed_max_txq = get_allowed_max_nb_txq(&pid); + if (txq > allowed_max_txq) { + printf("Fail: input txq (%u) can't be greater " + "than max_tx_queues (%u) of port %u\n", + txq, + allowed_max_txq, + pid); + return -1; + } + return 0; +} + static void init_config(void) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index e815509..fe40892 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -702,6 +702,8 @@ int new_socket_id(unsigned int socket_id); queueid_t get_allowed_max_nb_rxq(portid_t *pid); int check_nb_rxq(queueid_t rxq); +queueid_t get_allowed_max_nb_txq(portid_t *pid); +int check_nb_txq(queueid_t txq); /* * Work-around of a compilation error with ICC on invocations of the -- 2.7.5
[dpdk-dev] [PATCH v5 1/2] app/testpmd: fix invalid rxq number setting
If an invalid number of RX queues is configured from testpmd run-time command like "port config all rxq number" or from --rxq in the command to start testpmd, the global variable nb_rxq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid rxq setting and keeps its last correct value. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Acked-by: Konstantin Ananyev --- app/test-pmd/cmdline.c| 2 ++ app/test-pmd/parameters.c | 7 --- app/test-pmd/testpmd.c| 46 ++ app/test-pmd/testpmd.h| 3 +++ 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5b2e2ef..f0623b1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, printf("Warning: Either rx or tx queues should be non zero\n"); return; } + if (check_nb_rxq(res->value) != 0) + return; nb_rxq = res->value; } else if (!strcmp(res->name, "txq")) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 304b98d..c46e734 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv) int n, opt; char **argvopt; int opt_idx; + portid_t pid; enum { TX, RX }; static struct option lgopts[] = { @@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv) rss_hf = ETH_RSS_UDP; if (!strcmp(lgopts[opt_idx].name, "rxq")) { n = atoi(optarg); - if (n >= 0 && n <= (int) MAX_QUEUE_ID) + if (n >= 0 && check_nb_rxq((queueid_t)n) == 0) nb_rxq = (queueid_t) n; else rte_exit(EXIT_FAILURE, "rxq %d invalid - must be" - " >= 0 && <= %d\n", n, - (int) MAX_QUEUE_ID); + " >= 0 && <= %u\n", n, + get_allowed_max_nb_rxq(&pid)); } if (!strcmp(lgopts[opt_idx].name, "txq")) { n = atoi(optarg); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 9414d0e..4e8667d 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -540,6 +540,52 @@ check_socket_id(const unsigned int socket_id) return 0; } +/* + * Get the allowed maximum number of RX queues. + * *pid return the port id which has minimal value of + * max_rx_queues in all ports. + */ +queueid_t +get_allowed_max_nb_rxq(portid_t *pid) +{ + queueid_t allowed_max_rxq = MAX_QUEUE_ID; + portid_t pi; + struct rte_eth_dev_info dev_info; + + RTE_ETH_FOREACH_DEV(pi) { + rte_eth_dev_info_get(pi, &dev_info); + if (dev_info.max_rx_queues < allowed_max_rxq) { + allowed_max_rxq = dev_info.max_rx_queues; + *pid = pi; + } + } + return allowed_max_rxq; +} + +/* + * Check input rxq is valid or not. + * If input rxq is not greater than any of maximum number + * of RX queues of all ports, it is valid. + * if valid, return 0, else return -1 + */ +int +check_nb_rxq(queueid_t rxq) +{ + queueid_t allowed_max_rxq; + portid_t pid = 0; + + allowed_max_rxq = get_allowed_max_nb_rxq(&pid); + if (rxq > allowed_max_rxq) { + printf("Fail: input rxq (%u) can't be greater " + "than max_rx_queues (%u) of port %u\n", + rxq, + allowed_max_rxq, + pid); + return -1; + } + return 0; +} + static void init_config(void) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2a266fd..e815509 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -700,6 +700,9 @@ enum print_warning { int port_id_is_invalid(portid_t port_id, enum print_warning warning); int new_socket_id(unsigned int socket_id); +queueid_t get_allowed_max_nb_rxq(portid_t *pid); +int check_nb_rxq(queueid_t rxq); + /* * Work-around of a compilation error with ICC on invocations of the * rte_be_to_cpu_16() function. -- 2.7.5
[dpdk-dev] [PATCH v5 0/2] app/testpmd: fix invalid rxq and txq nubmer settings
If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence. With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Aced-by: Konstantin Ananyev --- v5: fix building failure with -Werror=maybe-uninitialized by gcc 5.3.1 fix typo error v4: update git log message and rename 2 new added functions v3: follow the guide from Konstantin to use functions to check input rxq and txq instead of usage of new added global variables. v2: fix a bug in v1 Wei Dai (2): app/testpmd: fix invalid rxq number setting app/testpmd: fix invalid txq number setting app/test-pmd/cmdline.c| 4 +++ app/test-pmd/parameters.c | 13 +++ app/test-pmd/testpmd.c| 92 +++ app/test-pmd/testpmd.h| 5 +++ 4 files changed, 108 insertions(+), 6 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v4 0/2] app/testpmd: fix invalid rxq and txq nubmer settings
If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". or from --rxq and --txq in the command to start testpmd. The global variable nb_rxq or nb_txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence. With these 2 patches, if an invalid input is detected, it is refused and testpmd keeps last correct values of nb_rxq and nb_txq. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Aced-by: Konstantin Ananyev --- v4: update git log message and rename 2 new added functions v3: follow the guide from Konstantin to use functions to check input rxq and txq instead of usage of new added global variables. v2: fix a bug in v1 Wei Dai (2): app/testpmd: fix invalid rxq number setting app/testpmd: fix invalid txq number setting app/test-pmd/cmdline.c| 4 +++ app/test-pmd/parameters.c | 13 +++ app/test-pmd/testpmd.c| 92 +++ app/test-pmd/testpmd.h| 5 +++ 4 files changed, 108 insertions(+), 6 deletions(-) -- 2.7.5
[dpdk-dev] [PATCH v4 1/2] app/testpmd: fix invalid rxq number setting
If an invalid number of RX queues is configured from testpmd run-time command like "port config all rxq number" or from --rxq in the command to start testpmd, the global variable nb_rxq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid rxq setting and keeps its last correct value. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Acked-by: Konstantin Ananyev --- app/test-pmd/cmdline.c| 2 ++ app/test-pmd/parameters.c | 7 --- app/test-pmd/testpmd.c| 46 ++ app/test-pmd/testpmd.h| 3 +++ 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5b2e2ef..f0623b1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, printf("Warning: Either rx or tx queues should be non zero\n"); return; } + if (check_nb_rxq(res->value) != 0) + return; nb_rxq = res->value; } else if (!strcmp(res->name, "txq")) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 304b98d..c46e734 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv) int n, opt; char **argvopt; int opt_idx; + portid_t pid; enum { TX, RX }; static struct option lgopts[] = { @@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv) rss_hf = ETH_RSS_UDP; if (!strcmp(lgopts[opt_idx].name, "rxq")) { n = atoi(optarg); - if (n >= 0 && n <= (int) MAX_QUEUE_ID) + if (n >= 0 && check_nb_rxq((queueid_t)n) == 0) nb_rxq = (queueid_t) n; else rte_exit(EXIT_FAILURE, "rxq %d invalid - must be" - " >= 0 && <= %d\n", n, - (int) MAX_QUEUE_ID); + " >= 0 && <= %u\n", n, + get_allowed_max_nb_rxq(&pid)); } if (!strcmp(lgopts[opt_idx].name, "txq")) { n = atoi(optarg); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 9414d0e..979c55c 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -540,6 +540,52 @@ check_socket_id(const unsigned int socket_id) return 0; } +/* + * Get the allowed maximum number of RX queues. + * *pid return the port id which has mimumal value of + * max_rx_queues in all ports. + */ +queueid_t +get_allowed_max_nb_rxq(portid_t *pid) +{ + queueid_t allowed_max_rxq = MAX_QUEUE_ID; + portid_t pi; + struct rte_eth_dev_info dev_info; + + RTE_ETH_FOREACH_DEV(pi) { + rte_eth_dev_info_get(pi, &dev_info); + if (dev_info.max_rx_queues < allowed_max_rxq) { + allowed_max_rxq = dev_info.max_rx_queues; + *pid = pi; + } + } + return allowed_max_rxq; +} + +/* + * Check input rxq is valid or not. + * If input rxq is not greater than any of maximum number + * of RX queues of all ports, it is valid. + * if valid, return 0, else return -1 + */ +int +check_nb_rxq(queueid_t rxq) +{ + queueid_t allowed_max_rxq; + portid_t pid; + + allowed_max_rxq = get_allowed_max_nb_rxq(&pid); + if (rxq > allowed_max_rxq) { + printf("Fail: input rxq (%u) can't be greater " + "than max_rx_queues (%u) of port %u\n", + rxq, + allowed_max_rxq, + pid); + return -1; + } + return 0; +} + static void init_config(void) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2a266fd..e815509 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -700,6 +700,9 @@ enum print_warning { int port_id_is_invalid(portid_t port_id, enum print_warning warning); int new_socket_id(unsigned int socket_id); +queueid_t get_allowed_max_nb_rxq(portid_t *pid); +int check_nb_rxq(queueid_t rxq); + /* * Work-around of a compilation error with ICC on invocations of the * rte_be_to_cpu_16() function. -- 2.7.5
[dpdk-dev] [PATCH v4 2/2] app/testpmd: fix invalid txq number setting
If an invalid number of TX queues is configured from testpmd run-time command like "port config all txq number" or from --txq in the command to start testpmd, the global variable nb_txq is updated by this invalid value without this patch. It may cause testpmd crash. This patch refuses invalid txq setting and keeps its last correct value. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai Acked-by: Konstantin Ananyev --- app/test-pmd/cmdline.c| 2 ++ app/test-pmd/parameters.c | 6 +++--- app/test-pmd/testpmd.c| 46 ++ app/test-pmd/testpmd.h| 2 ++ 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f0623b1..6619cb8 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, printf("Warning: Either rx or tx queues should be non zero\n"); return; } + if (check_nb_txq(res->value) != 0) + return; nb_txq = res->value; } else if (!strcmp(res->name, "rxd")) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index c46e734..ca2af65 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -932,12 +932,12 @@ launch_args_parse(int argc, char** argv) } if (!strcmp(lgopts[opt_idx].name, "txq")) { n = atoi(optarg); - if (n >= 0 && n <= (int) MAX_QUEUE_ID) + if (n >= 0 && check_nb_txq((queueid_t)n) == 0) nb_txq = (queueid_t) n; else rte_exit(EXIT_FAILURE, "txq %d invalid - must be" - " >= 0 && <= %d\n", n, - (int) MAX_QUEUE_ID); + " >= 0 && <= %u\n", n, + get_allowed_max_nb_txq(&pid)); } if (!nb_rxq && !nb_txq) { rte_exit(EXIT_FAILURE, "Either rx or tx queues should " diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 979c55c..bf7fd3b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -586,6 +586,52 @@ check_nb_rxq(queueid_t rxq) return 0; } +/* + * Get the allowed maximum number of TX queues. + * *pid return the port id which has mimumal value of + * max_tx_queues in all ports. + */ +queueid_t +get_allowed_max_nb_txq(portid_t *pid) +{ + queueid_t allowed_max_txq = MAX_QUEUE_ID; + portid_t pi; + struct rte_eth_dev_info dev_info; + + RTE_ETH_FOREACH_DEV(pi) { + rte_eth_dev_info_get(pi, &dev_info); + if (dev_info.max_tx_queues < allowed_max_txq) { + allowed_max_txq = dev_info.max_tx_queues; + *pid = pi; + } + } + return allowed_max_txq; +} + +/* + * Check input txq is valid or not. + * If input txq is not greater than any of maximum number + * of TX queues of all ports, it is valid. + * if valid, return 0, else return -1 + */ +int +check_nb_txq(queueid_t txq) +{ + queueid_t allowed_max_txq; + portid_t pid; + + allowed_max_txq = get_allowed_max_nb_txq(&pid); + if (txq > allowed_max_txq) { + printf("Fail: input txq (%u) can't be greater " + "than max_tx_queues (%u) of port %u\n", + txq, + allowed_max_txq, + pid); + return -1; + } + return 0; +} + static void init_config(void) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index e815509..fe40892 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -702,6 +702,8 @@ int new_socket_id(unsigned int socket_id); queueid_t get_allowed_max_nb_rxq(portid_t *pid); int check_nb_rxq(queueid_t rxq); +queueid_t get_allowed_max_nb_txq(portid_t *pid); +int check_nb_txq(queueid_t txq); /* * Work-around of a compilation error with ICC on invocations of the -- 2.7.5
[dpdk-dev] [PATCH v3 1/2] app/testpmd: fix invalid rxq number setting
If an invalid RX queue is configured from testpmd command like "port config all rxq number", the global variable rxq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid rxq number configured is detected. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c| 2 ++ app/test-pmd/parameters.c | 7 --- app/test-pmd/testpmd.c| 47 +++ app/test-pmd/testpmd.h| 3 +++ 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5b2e2ef..f0623b1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1518,6 +1518,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, printf("Warning: Either rx or tx queues should be non zero\n"); return; } + if (check_nb_rxq(res->value) != 0) + return; nb_rxq = res->value; } else if (!strcmp(res->name, "txq")) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 304b98d..eac1826 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -536,6 +536,7 @@ launch_args_parse(int argc, char** argv) int n, opt; char **argvopt; int opt_idx; + portid_t pid; enum { TX, RX }; static struct option lgopts[] = { @@ -922,12 +923,12 @@ launch_args_parse(int argc, char** argv) rss_hf = ETH_RSS_UDP; if (!strcmp(lgopts[opt_idx].name, "rxq")) { n = atoi(optarg); - if (n >= 0 && n <= (int) MAX_QUEUE_ID) + if (n >= 0 && check_nb_rxq((queueid_t)n) == 0) nb_rxq = (queueid_t) n; else rte_exit(EXIT_FAILURE, "rxq %d invalid - must be" - " >= 0 && <= %d\n", n, - (int) MAX_QUEUE_ID); + " >= 0 && <= %u\n", n, + get_allowed_nb_rxq(&pid)); } if (!strcmp(lgopts[opt_idx].name, "txq")) { n = atoi(optarg); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 9414d0e..1203b17 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -540,6 +540,53 @@ check_socket_id(const unsigned int socket_id) return 0; } +/* + * Get the allowed maximum number of RX queues. + * *pid return the port id which has mimumal value of + * max_rx_queues in all ports. + */ + +queueid_t +get_allowed_nb_rxq(portid_t *pid) +{ + queueid_t allowed_max_rxq = MAX_QUEUE_ID; + portid_t pi; + struct rte_eth_dev_info dev_info; + + RTE_ETH_FOREACH_DEV(pi) { + rte_eth_dev_info_get(pi, &dev_info); + if (dev_info.max_rx_queues < allowed_max_rxq) { + allowed_max_rxq = dev_info.max_rx_queues; + *pid = pi; + } + } + return allowed_max_rxq; +} + +/* + * Check input rxq is valid or not. + * If input rxq is not greater than any of maximum number + * of RX queues of all ports, it is valid. + * if valid, return 0, else return -1 + */ +int +check_nb_rxq(queueid_t rxq) +{ + queueid_t allowed_max_rxq; + portid_t pid; + + allowed_max_rxq = get_allowed_nb_rxq(&pid); + if (rxq > allowed_max_rxq) { + printf("Fail: input rxq (%u) can't be greater " + "than max_rx_queues (%u) of port %u\n", + rxq, + allowed_max_rxq, + pid); + return -1; + } + return 0; +} + static void init_config(void) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2a266fd..1e38f43 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -700,6 +700,9 @@ enum print_warning { int port_id_is_invalid(portid_t port_id, enum print_warning warning); int new_socket_id(unsigned int socket_id); +queueid_t get_allowed_nb_rxq(portid_t *pid); +int check_nb_rxq(queueid_t rxq); + /* * Work-around of a compilation error with ICC on invocations of the * rte_be_to_cpu_16() function. -- 2.7.5
[dpdk-dev] [PATCH v3 2/2] app/testpmd: fix invalid txq number setting
If an invalid TX queue is configured from testpmd command like "port config all txq number", the global variable txq is updated by this invalid value. It may cause testpmd crash. This patch restores its last correct value when an invalid txq number configured is detected. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai --- app/test-pmd/cmdline.c| 2 ++ app/test-pmd/parameters.c | 6 +++--- app/test-pmd/testpmd.c| 47 +++ app/test-pmd/testpmd.h| 2 ++ 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f0623b1..6619cb8 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1527,6 +1527,8 @@ cmd_config_rx_tx_parsed(void *parsed_result, printf("Warning: Either rx or tx queues should be non zero\n"); return; } + if (check_nb_txq(res->value) != 0) + return; nb_txq = res->value; } else if (!strcmp(res->name, "rxd")) { diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index eac1826..6b5925d 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -932,12 +932,12 @@ launch_args_parse(int argc, char** argv) } if (!strcmp(lgopts[opt_idx].name, "txq")) { n = atoi(optarg); - if (n >= 0 && n <= (int) MAX_QUEUE_ID) + if (n >= 0 && check_nb_txq((queueid_t)n) == 0) nb_txq = (queueid_t) n; else rte_exit(EXIT_FAILURE, "txq %d invalid - must be" - " >= 0 && <= %d\n", n, - (int) MAX_QUEUE_ID); + " >= 0 && <= %u\n", n, + get_allowed_nb_txq(&pid)); } if (!nb_rxq && !nb_txq) { rte_exit(EXIT_FAILURE, "Either rx or tx queues should " diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 1203b17..fb8bb48 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -587,6 +587,53 @@ check_nb_rxq(queueid_t rxq) return 0; } +/* + * Get the allowed maximum number of TX queues. + * *pid return the port id which has mimumal value of + * max_tx_queues in all ports. + */ + +queueid_t +get_allowed_nb_txq(portid_t *pid) +{ + queueid_t allowed_max_txq = MAX_QUEUE_ID; + portid_t pi; + struct rte_eth_dev_info dev_info; + + RTE_ETH_FOREACH_DEV(pi) { + rte_eth_dev_info_get(pi, &dev_info); + if (dev_info.max_tx_queues < allowed_max_txq) { + allowed_max_txq = dev_info.max_tx_queues; + *pid = pi; + } + } + return allowed_max_txq; +} + +/* + * Check input txq is valid or not. + * If input txq is not greater than any of maximum number + * of TX queues of all ports, it is valid. + * if valid, return 0, else return -1 + */ +int +check_nb_txq(queueid_t txq) +{ + queueid_t allowed_max_txq; + portid_t pid; + + allowed_max_txq = get_allowed_nb_txq(&pid); + if (txq > allowed_max_txq) { + printf("Fail: input txq (%u) can't be greater " + "than max_tx_queues (%u) of port %u\n", + txq, + allowed_max_txq, + pid); + return -1; + } + return 0; +} + static void init_config(void) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1e38f43..b848364 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -702,6 +702,8 @@ int new_socket_id(unsigned int socket_id); queueid_t get_allowed_nb_rxq(portid_t *pid); int check_nb_rxq(queueid_t rxq); +queueid_t get_allowed_nb_txq(portid_t *pid); +int check_nb_txq(queueid_t txq); /* * Work-around of a compilation error with ICC on invocations of the -- 2.7.5
[dpdk-dev] [PATCH v3 0/2] app/testpmd: fix invalid rxq and txq nubmer setting
If an invlaid number of RX or TX queues is configured from testpmd command like "port config all rxq number" or "port config all txq number". The global variable rxq or txq is updated by the invalid input. This can cause testpmd crash. For example, if the maximum number of RX or TX queues is 4, testpmd will crash after running commands "port config all rxq 5", "port config all txq 5" and "start" in sequence. These 2 patches reserve the last correct rxq and txq, if an invalid input is detected, it is restored to the backup value to avoid crash. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Cc: sta...@dpdk.org Signed-off-by: Wei Dai --- v3: follow the guide from Konstantin to use functions to check input rxq and txq instead of usage of new added global variables. v2: fix a bug in v1 Wei Dai (2): app/testpmd: fix invalid rxq number setting app/testpmd: fix invalid txq number setting app/test-pmd/cmdline.c| 4 ++ app/test-pmd/parameters.c | 13 --- app/test-pmd/testpmd.c| 94 +++ app/test-pmd/testpmd.h| 5 +++ 4 files changed, 110 insertions(+), 6 deletions(-) -- 2.7.5