* [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API @ 2017-11-23 12:07 Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev " Shahaf Shuler ` (6 more replies) 0 siblings, 7 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-11-23 12:07 UTC (permalink / raw) To: jingjing.wu; +Cc: dev This series is to convert testpmd application to the new offloads API [1]. [1] http://dpdk.org/ml/archives/dev/2017-October/077329.html Shahaf Shuler (5): app/testpmd: convert to new Ethdev offloads API app/testpmd: remove txqflags app/testpmd: add command line option for multiseg app/testpmd: add command line option for mbuf fast free app/testpmd: enforce offloads caps app/test-pmd/cmdline.c | 311 ++++++++++++++--------- app/test-pmd/config.c | 103 +++++--- app/test-pmd/parameters.c | 62 ++--- app/test-pmd/testpmd.c | 55 ++-- app/test-pmd/testpmd.h | 2 +- doc/guides/testpmd_app_ug/run_app.rst | 20 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 - 7 files changed, 332 insertions(+), 232 deletions(-) -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev offloads API 2017-11-23 12:07 [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API Shahaf Shuler @ 2017-11-23 12:08 ` Shahaf Shuler 2017-12-04 22:31 ` Ferruh Yigit 2017-11-23 12:08 ` [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags Shahaf Shuler ` (5 subsequent siblings) 6 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-11-23 12:08 UTC (permalink / raw) To: jingjing.wu; +Cc: dev Ethdev Rx/Tx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") Convert the application to use the new API. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 148 +++++++++++++++++++++++++++++++++-------- app/test-pmd/config.c | 97 +++++++++++++++++++-------- app/test-pmd/parameters.c | 35 +++++----- app/test-pmd/testpmd.c | 24 +++---- 4 files changed, 219 insertions(+), 85 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f71d96301..b0f2325c8 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,6 +1577,7 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_max_pkt_len_result *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1594,14 +1595,16 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, rx_mode.max_rx_pkt_len = res->value; if (res->value > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else - rx_mode.jumbo_frame = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; } else { printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; + init_port_config(); cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1703,6 +1706,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_rx_mode_flag *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1711,48 +1715,48 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, if (!strcmp(res->name, "crc-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_strip_crc = 1; + rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "scatter")) { - if (!strcmp(res->value, "on")) - rx_mode.enable_scatter = 1; - else if (!strcmp(res->value, "off")) - rx_mode.enable_scatter = 0; - else { + if (!strcmp(res->value, "on")) { + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + } else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-cksum")) { if (!strcmp(res->value, "on")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; else if (!strcmp(res->value, "off")) - rx_mode.hw_ip_checksum = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-timestamp")) { if (!strcmp(res->value, "on")) - rx_mode.hw_timestamp = 1; + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; else if (!strcmp(res->value, "off")) - rx_mode.hw_timestamp = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan")) { if (!strcmp(res->value, "on")) { - rx_mode.hw_vlan_filter = 1; - rx_mode.hw_vlan_strip = 1; + rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else if (!strcmp(res->value, "off")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else { printf("Unknown parameter\n"); @@ -1760,27 +1764,27 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, } } else if (!strcmp(res->name, "hw-vlan-filter")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_filter = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_strip = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-extend")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_extend = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; else { printf("Unknown parameter\n"); return; @@ -1798,6 +1802,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; init_port_config(); @@ -3434,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result, { struct cmd_tx_vlan_set_result *res = parsed_result; + if (!all_ports_stopped()) { + printf("Please stop all ports first\n"); + return; + } + tx_vlan_set(res->port_id, res->vlan_id); + + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = @@ -3481,7 +3493,14 @@ cmd_tx_vlan_set_qinq_parsed(void *parsed_result, { struct cmd_tx_vlan_set_qinq_result *res = parsed_result; + if (!all_ports_stopped()) { + printf("Please stop all ports first\n"); + return; + } + tx_qinq_set(res->port_id, res->vlan_id, res->vlan_id_outer); + + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_qinq_tx_vlan = @@ -3587,7 +3606,14 @@ cmd_tx_vlan_reset_parsed(void *parsed_result, { struct cmd_tx_vlan_reset_result *res = parsed_result; + if (!all_ports_stopped()) { + printf("Please stop all ports first\n"); + return; + } + tx_vlan_reset(res->port_id); + + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_reset_tx_vlan = @@ -3680,11 +3706,16 @@ cmd_csum_parsed(void *parsed_result, struct cmd_csum_result *res = parsed_result; int hw = 0; uint16_t mask = 0; + uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); return; } + if (!all_ports_stopped()) { + printf("Please stop all ports first\n"); + return; + } if (!strcmp(res->mode, "set")) { @@ -3693,22 +3724,34 @@ cmd_csum_parsed(void *parsed_result, if (!strcmp(res->proto, "ip")) { mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } - if (hw) + if (hw) { ports[res->port_id].tx_ol_flags |= mask; - else + ports[res->port_id].dev_conf.txmode.offloads |= + csum_offloads; + } else { ports[res->port_id].tx_ol_flags &= (~mask); + ports[res->port_id].dev_conf.txmode.offloads &= + (~csum_offloads); + } } csum_show(res->port_id); + + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); } cmdline_parse_token_string_t cmd_csum_csum = @@ -3832,15 +3875,24 @@ cmd_tso_set_parsed(void *parsed_result, if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!all_ports_stopped()) { + printf("Please stop all ports first\n"); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; - if (ports[res->port_id].tso_segsz == 0) + if (ports[res->port_id].tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_TCP_TSO; printf("TSO for non-tunneled packets is disabled\n"); - else + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_TCP_TSO; printf("TSO segment size for non-tunneled packets is %d\n", ports[res->port_id].tso_segsz); + } /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(res->port_id, &dev_info); @@ -3849,6 +3901,8 @@ cmd_tso_set_parsed(void *parsed_result, printf("Warning: TSO enabled but not " "supported by port %d\n", res->port_id); } + + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); } cmdline_parse_token_string_t cmd_tso_set_tso = @@ -3934,13 +3988,27 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!all_ports_stopped()) { + printf("Please stop all ports first\n"); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - if (ports[res->port_id].tunnel_tso_segsz == 0) + if (ports[res->port_id].tunnel_tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); - else { + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3966,6 +4034,8 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } + + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); } cmdline_parse_token_string_t cmd_tunnel_tso_set_tso = @@ -13004,11 +13074,17 @@ cmd_set_macsec_offload_on_parsed( portid_t port_id = res->port_id; int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0; int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!all_ports_stopped()) { + printf("Please stop all ports first\n"); + return; + } ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif @@ -13017,6 +13093,13 @@ cmd_set_macsec_offload_on_parsed( switch (ret) { case 0: + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_MACSEC_INSERT) == 0) { + printf("Warning: macsec insert enabled but not " + "supported by port %d\n", port_id); + } + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); @@ -13091,14 +13174,21 @@ cmd_set_macsec_offload_off_parsed( if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!all_ports_stopped()) { + printf("Please stop all ports first\n"); + return; + } ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif switch (ret) { case 0: + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index cd2ac1164..9b6ffeca9 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -540,14 +540,12 @@ port_infos_display(portid_t port_id) void port_offload_cap_display(portid_t port_id) { - struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; static const char *info_border = "************"; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - dev = &rte_eth_devices[port_id]; rte_eth_dev_info_get(port_id, &dev_info); printf("\n%s Port %d supported offload features: %s\n", @@ -555,7 +553,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) { printf("VLAN stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_strip) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_STRIP) printf("on\n"); else printf("off\n"); @@ -563,7 +562,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) { printf("Double VLANs stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_extend) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_EXTEND) printf("on\n"); else printf("off\n"); @@ -571,7 +571,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) { printf("RX IPv4 checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -579,7 +580,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) { printf("RX UDP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n"); @@ -587,18 +589,26 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) { printf("RX TCP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n"); } - if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) - printf("RX Outer IPv4 checksum: on"); + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) { + printf("RX Outer IPv4 checksum: "); + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) + printf("on\n"); + else + printf("off\n"); + } if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) { printf("Large receive offload: "); - if (dev->data->dev_conf.rxmode.enable_lro) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_LRO) printf("on\n"); else printf("off\n"); @@ -606,8 +616,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { printf("VLAN insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VLAN_INSERT) printf("on\n"); else printf("off\n"); @@ -615,7 +625,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) { printf("HW timestamp: "); - if (dev->data->dev_conf.rxmode.hw_timestamp) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TIMESTAMP) printf("on\n"); else printf("off\n"); @@ -623,8 +634,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) { printf("Double VLANs insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_QINQ_INSERT) printf("on\n"); else printf("off\n"); @@ -632,7 +643,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) { printf("TX IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -640,7 +652,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) { printf("TX UDP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n"); @@ -648,7 +661,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) { printf("TX TCP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n"); @@ -656,7 +670,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) { printf("TX SCTP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_SCTP_CKSUM) printf("on\n"); else printf("off\n"); @@ -664,8 +679,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { printf("TX Outer IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -673,7 +688,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) { printf("TX TCP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_TSO) printf("on\n"); else printf("off\n"); @@ -681,7 +697,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) { printf("TX UDP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_TSO) printf("on\n"); else printf("off\n"); @@ -689,7 +706,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) { printf("TSO for VXLAN tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VXLAN_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -697,7 +715,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) { printf("TSO for GRE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GRE_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -705,7 +724,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) { printf("TSO for IPIP tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPIP_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -713,7 +733,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) { printf("TSO for GENEVE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GENEVE_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -1658,7 +1679,8 @@ rxtx_config_display(void) printf(" %s packet forwarding%s - CRC stripping %s - " "packets/burst=%d\n", cur_fwd_eng->fwd_mode_name, retry_enabled == 0 ? "" : " with retry", - rx_mode.hw_strip_crc ? "enabled" : "disabled", + (ports[0].dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP) ? + "enabled" : "disabled", nb_pkt_per_burst); if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine) @@ -2758,6 +2780,8 @@ void tx_vlan_set(portid_t port_id, uint16_t vlan_id) { int vlan_offload; + struct rte_eth_dev_info dev_info; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2771,13 +2795,21 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) { + printf("Warning: vlan insert enabled but not " + "supported by port %d\n", port_id); + } } void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) { int vlan_offload; + struct rte_eth_dev_info dev_info; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2793,8 +2825,14 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) { + printf("Warning: qinq insert enabled but not " + "supported by port %d\n", port_id); + } } void @@ -2804,6 +2842,9 @@ tx_vlan_reset(portid_t port_id) return; ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | TESTPMD_TX_OFFLOAD_INSERT_QINQ); + ports[port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_QINQ_INSERT); ports[port_id].tx_vlan_id = 0; ports[port_id].tx_vlan_id_outer = 0; } diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 84e7a63ef..0ba73cad5 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -566,6 +566,8 @@ launch_args_parse(int argc, char** argv) char **argvopt; int opt_idx; enum { TX, RX }; + /* Default Rx offloads for all ports. */ + uint64_t rx_offloads = rx_mode.offloads; static struct option lgopts[] = { { "help", 0, 0, 0 }, @@ -804,7 +806,8 @@ launch_args_parse(int argc, char** argv) if (n >= ETHER_MIN_LEN) { rx_mode.max_rx_pkt_len = (uint32_t) n; if (n > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; } else rte_exit(EXIT_FAILURE, "Invalid max-pkt-len=%d - should be > %d\n", @@ -897,34 +900,31 @@ launch_args_parse(int argc, char** argv) } #endif if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; if (!strcmp(lgopts[opt_idx].name, "enable-lro")) - rx_mode.enable_lro = 1; - if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) - rx_mode.enable_scatter = 1; + rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; + if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) { + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; + } if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; if (!strcmp(lgopts[opt_idx].name, "enable-rx-timestamp")) - rx_mode.hw_timestamp = 1; - - if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; - rx_mode.hw_vlan_extend = 0; - } + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-filter")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-strip")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-extend")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; if (!strcmp(lgopts[opt_idx].name, "enable-drop-en")) rx_drop_en = 1; @@ -1140,4 +1140,7 @@ launch_args_parse(int argc, char** argv) break; } } + + /* Set offload configuration from command line parameters. */ + rx_mode.offloads = rx_offloads; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index c3ab44849..e3a7c26b8 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -338,15 +338,10 @@ lcoreid_t latencystats_lcore_id = -1; */ struct rte_eth_rxmode rx_mode = { .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */ - .split_hdr_size = 0, - .header_split = 0, /**< Header Split disabled. */ - .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ - .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ - .hw_vlan_strip = 1, /**< VLAN strip enabled. */ - .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ - .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ - .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ - .hw_timestamp = 0, /**< HW timestamp enabled. */ + .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP | + DEV_RX_OFFLOAD_CRC_STRIP), + .ignore_offload_bitfield = 1, /**< Use rte_eth_rxq_conf offloads API */ }; struct rte_fdir_conf fdir_conf = { @@ -1495,6 +1490,10 @@ start_port(portid_t pid) } if (port->need_reconfig_queues > 0) { port->need_reconfig_queues = 0; + /* Use rte_eth_txq_conf offloads API */ + port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + /* Apply Tx offloads configuration */ + port->tx_conf.offloads = port->dev_conf.txmode.offloads; /* setup tx queues */ for (qi = 0; qi < nb_txq; qi++) { if ((numa_support) && @@ -1521,6 +1520,8 @@ start_port(portid_t pid) port->need_reconfig_queues = 1; return -1; } + /* Apply Rx offloads configuration */ + port->rx_conf.offloads = port->dev_conf.rxmode.offloads; /* setup rx queues */ for (qi = 0; qi < nb_rxq; qi++) { if ((numa_support) && @@ -1534,7 +1535,6 @@ start_port(portid_t pid) rxring_numa[pi]); return -1; } - diag = rte_eth_rx_queue_setup(pi, qi, nb_rxd,rxring_numa[pi], &(port->rx_conf),mp); @@ -2252,7 +2252,7 @@ init_port_dcb_config(portid_t pid, retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en); if (retval < 0) return retval; - port_conf.rxmode.hw_vlan_filter = 1; + port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; /** * Write the configuration into the device. @@ -2301,7 +2301,7 @@ init_port_dcb_config(portid_t pid, rxtx_port_config(rte_port); /* VLAN filter */ - rte_port->dev_conf.rxmode.hw_vlan_filter = 1; + rte_port->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; for (i = 0; i < RTE_DIM(vlan_tags); i++) rx_vft_set(pid, vlan_tags[i], 1); -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev offloads API 2017-11-23 12:08 ` [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev " Shahaf Shuler @ 2017-12-04 22:31 ` Ferruh Yigit 2017-12-05 6:39 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Ferruh Yigit @ 2017-12-04 22:31 UTC (permalink / raw) To: Shahaf Shuler, jingjing.wu; +Cc: dev On 11/23/2017 4:08 AM, Shahaf Shuler wrote: > Ethdev Rx/Tx offloads API has changed since: > > commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") > commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") > > Convert the application to use the new API. Hi Shahaf, As far as I can see patch does a few things: 1- Convert rxmode bitfields usage to rxmode offloads usage. 2- Apply some config options to port config and add some port config checks. 3- Adding device advertised capability checks for some offloads. Would you mind separate 2 and 3 to their own patches, with that 1 should be straightforward and 2 & 3 will be easy to review. And is this update tested with PMDs both support new offload method and old offload method? Thanks, ferruh > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> <...> > } else if (!strcmp(res->name, "hw-vlan-extend")) { > if (!strcmp(res->value, "on")) > - rx_mode.hw_vlan_extend = 1; > + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; Not related to this patch, but since you are touching these, what is the difference between DEV_RX_OFFLOAD_VLAN_EXTEND and DEV_RX_OFFLOAD_QINQ_STRIP ? > @@ -3434,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result, > { > struct cmd_tx_vlan_set_result *res = parsed_result; > > + if (!all_ports_stopped()) { > + printf("Please stop all ports first\n"); > + return; > + } rte_eth_rxmode bitfields to "offloads" conversion is mostly straightforward, but is above kind of modifications part of this conversion or are you adding missing checks? I would prefer making only conversion related changes in this patch, and extra improvements in other patch. > + > tx_vlan_set(res->port_id, res->vlan_id); > + > + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); Is this required for converting bitfield to offloads usage? > } > > cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = > @@ -3481,7 +3493,14 @@ cmd_tx_vlan_set_qinq_parsed(void *parsed_result, > { > struct cmd_tx_vlan_set_qinq_result *res = parsed_result; > > + if (!all_ports_stopped()) { > + printf("Please stop all ports first\n"); > + return; > + } Same for all occurrence of these updates. <...> > @@ -3693,22 +3724,34 @@ cmd_csum_parsed(void *parsed_result, > > if (!strcmp(res->proto, "ip")) { > mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; > } else if (!strcmp(res->proto, "udp")) { > mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; > } else if (!strcmp(res->proto, "tcp")) { > mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; > } else if (!strcmp(res->proto, "sctp")) { > mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; > } else if (!strcmp(res->proto, "outer-ip")) { > mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; > } > > - if (hw) > + if (hw) { > ports[res->port_id].tx_ol_flags |= mask; > - else > + ports[res->port_id].dev_conf.txmode.offloads |= > + csum_offloads; So you are updating port config as well as testpmd internal configuration, again I guess this is not related to conversion to offloads usage. <...> > @@ -13017,6 +13093,13 @@ cmd_set_macsec_offload_on_parsed( > > switch (ret) { > case 0: > + rte_eth_dev_info_get(port_id, &dev_info); > + if ((dev_info.tx_offload_capa & > + DEV_TX_OFFLOAD_MACSEC_INSERT) == 0) { > + printf("Warning: macsec insert enabled but not " > + "supported by port %d\n", port_id); > + } This also adding another layer of check if device advertise requested capability, this is an improvement independent from conversion, can you please separate into its own patch? <...> > @@ -606,8 +616,8 @@ port_offload_cap_display(portid_t port_id) > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { > printf("VLAN insert: "); > - if (ports[port_id].tx_ol_flags & > - TESTPMD_TX_OFFLOAD_INSERT_VLAN) This is removing testpmd local config check, just to double check if all places that updates this local config covered to update device config variable? And do we still need testpmd tx_ol_flags after these changes? <...> > @@ -1658,7 +1679,8 @@ rxtx_config_display(void) > printf(" %s packet forwarding%s - CRC stripping %s - " > "packets/burst=%d\n", cur_fwd_eng->fwd_mode_name, > retry_enabled == 0 ? "" : " with retry", > - rx_mode.hw_strip_crc ? "enabled" : "disabled", > + (ports[0].dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP) ? > + "enabled" : "disabled", There is a global config option in testpmd, for all ports. Previous log was print based on that config option, but now you are printing the value of first port. I believe it is wrong to display only first port values, either log can be updated to say testpmd default configs, or remove completely, or print for all ports, what do you think? <...> > @@ -897,34 +900,31 @@ launch_args_parse(int argc, char** argv) > } > #endif > if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip")) > - rx_mode.hw_strip_crc = 0; > + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; > if (!strcmp(lgopts[opt_idx].name, "enable-lro")) > - rx_mode.enable_lro = 1; > - if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) > - rx_mode.enable_scatter = 1; > + rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; > + if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) { > + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; > + } Can drop "{}" <...> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index c3ab44849..e3a7c26b8 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -338,15 +338,10 @@ lcoreid_t latencystats_lcore_id = -1; > */ > struct rte_eth_rxmode rx_mode = { > .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */ > - .split_hdr_size = 0, > - .header_split = 0, /**< Header Split disabled. */ > - .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ > - .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ > - .hw_vlan_strip = 1, /**< VLAN strip enabled. */ > - .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ > - .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ > - .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ > - .hw_timestamp = 0, /**< HW timestamp enabled. */ > + .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | > + DEV_RX_OFFLOAD_VLAN_STRIP | > + DEV_RX_OFFLOAD_CRC_STRIP), > + .ignore_offload_bitfield = 1, /**< Use rte_eth_rxq_conf offloads API */ Is comment correct? Flag has two meaning I guess, 1) Ignore bitfield values for port based offload configuration. 2) For rxq, use rx_conf.offloads field. testpmd is still using port based offload (rte_eth_rxmode) but "offloads" variable instead of bitfields, right? queue specific ones are copy of port configs. <...> ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev offloads API 2017-12-04 22:31 ` Ferruh Yigit @ 2017-12-05 6:39 ` Shahaf Shuler 2017-12-06 22:57 ` Ferruh Yigit 0 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-05 6:39 UTC (permalink / raw) To: Ferruh Yigit, jingjing.wu; +Cc: dev Tuesday, December 5, 2017 12:31 AM, Ferruh Yigit: > On 11/23/2017 4:08 AM, Shahaf Shuler wrote: > > Ethdev Rx/Tx offloads API has changed since: > > > > commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") commit > > cba7f53b717d ("ethdev: introduce Tx queue offloads API") > > > > Convert the application to use the new API. > > Hi Shahaf, > > As far as I can see patch does a few things: > 1- Convert rxmode bitfields usage to rxmode offloads usage. > 2- Apply some config options to port config and add some port config checks. > 3- Adding device advertised capability checks for some offloads. > > Would you mind separate 2 and 3 to their own patches, with that 1 should be > straightforward and 2 & 3 will be easy to review. See below comments. #2 on your list is actually needed for the conversion patch. I can split the extra cap check if you fill it needs to be in a separate patch. > > > And is this update tested with PMDs both support new offload method and > old offload method? It was tested with mlx5 and mlx4 PMD after the conversion to the new APIs. I put this series early so everyone can try, test and report if something is broken. I will try to do more testing with the old mlx PMD. BTW - we agreed that we set DD for all PMDs to move to the new API by 18.02. I still haven't see patches for that from the rest. > > Thanks, > ferruh > > > > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > > <...> > > > } else if (!strcmp(res->name, "hw-vlan-extend")) { > > if (!strcmp(res->value, "on")) > > - rx_mode.hw_vlan_extend = 1; > > + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; > > Not related to this patch, but since you are touching these, what is the > difference between DEV_RX_OFFLOAD_VLAN_EXTEND and > DEV_RX_OFFLOAD_QINQ_STRIP ? Good question, I could not figure it out either. I guess those are identical. In the old API the hw_vlan_extend was the offload and the DEV_RX_OFFLOAD_QINQ_STRIP was the cap. Now that we merged them we have duplication. From one side, using DEV_RX_OFFLOAD_VLAN_EXTEND is more intuitive for application which previously used hw_vlan_extend to set the offload, For the other side QINQ_STRIP is more explicit with respect to what the feature does, and it is the flag which is currently being used for PMDs. So when we will change it, I guess I am in favor of the QINQ flag. > > > @@ -3434,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result, > { > > struct cmd_tx_vlan_set_result *res = parsed_result; > > > > + if (!all_ports_stopped()) { > > + printf("Please stop all ports first\n"); > > + return; > > + } > > rte_eth_rxmode bitfields to "offloads" conversion is mostly straightforward, > but is above kind of modifications part of this conversion or are you adding > missing checks? It is part of the conversion and this is related to testpmd design. Previously in the old API the tx offloads were set even after the port is started. For this specific example the vlan insert just changed a flag (TESTPMD_TX_OFFLOAD_INSERT_VLAN) on the application port struct to use PKT_TX_VLAN_PKT in the mbuf ol_flags. The application didn't update the PMD in anyway. In fact, it was possible to put txq_flag which says no vlan insertion and then to set vlan insertion through the CLI. This was OK back then because all of the Tx offloads were set by default and we assumed users know what they are doing when setting the txq_flags. Now all the tx offloads are disabled by default. Every Tx offload being used should update the PMD (as it may need to switch tx burst function). This is why the Tx offloads configuration must be done when the port is stopped, and be followed with reconfiguration of the device and the queues. > > I would prefer making only conversion related changes in this patch, and > extra improvements in other patch. > > > + > > tx_vlan_set(res->port_id, res->vlan_id); > > + > > + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); > > Is this required for converting bitfield to offloads usage? Yes, see above. > > > } > > > > cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = @@ -3481,7 > > +3493,14 @@ cmd_tx_vlan_set_qinq_parsed(void *parsed_result, { > > struct cmd_tx_vlan_set_qinq_result *res = parsed_result; > > > > + if (!all_ports_stopped()) { > > + printf("Please stop all ports first\n"); > > + return; > > + } > > Same for all occurrence of these updates. > > <...> > > > @@ -3693,22 +3724,34 @@ cmd_csum_parsed(void *parsed_result, > > > > if (!strcmp(res->proto, "ip")) { > > mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; > > + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; > > } else if (!strcmp(res->proto, "udp")) { > > mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; > > + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; > > } else if (!strcmp(res->proto, "tcp")) { > > mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; > > + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; > > } else if (!strcmp(res->proto, "sctp")) { > > mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; > > + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; > > } else if (!strcmp(res->proto, "outer-ip")) { > > mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; > > + csum_offloads |= > DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; > > } > > > > - if (hw) > > + if (hw) { > > ports[res->port_id].tx_ol_flags |= mask; > > - else > > + ports[res->port_id].dev_conf.txmode.offloads |= > > + csum_offloads; > > So you are updating port config as well as testpmd internal configuration, > again I guess this is not related to conversion to offloads usage. It is. See above. The port config will be used for the reconfiguration of the device and queues. This is a must for the Tx offloads . > > <...> > > > @@ -13017,6 +13093,13 @@ cmd_set_macsec_offload_on_parsed( > > > > switch (ret) { > > case 0: > > + rte_eth_dev_info_get(port_id, &dev_info); > > + if ((dev_info.tx_offload_capa & > > + DEV_TX_OFFLOAD_MACSEC_INSERT) == 0) { > > + printf("Warning: macsec insert enabled but not " > > + "supported by port %d\n", port_id); > > + } > > This also adding another layer of check if device advertise requested > capability, this is an improvement independent from conversion, can you > please separate into its own patch? Yes we can do it. > > <...> > > > @@ -606,8 +616,8 @@ port_offload_cap_display(portid_t port_id) > > > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { > > printf("VLAN insert: "); > > - if (ports[port_id].tx_ol_flags & > > - TESTPMD_TX_OFFLOAD_INSERT_VLAN) > > This is removing testpmd local config check, just to double check if all places > that updates this local config covered to update device config variable? I hope so. If you find something I missed let me know :). > > And do we still need testpmd tx_ol_flags after these changes? Currently those flags are being used. One can prepare another patch to remove those and use the port config flags instead. This is not related to the conversion and could be a nice cleanup. > > <...> > > > @@ -1658,7 +1679,8 @@ rxtx_config_display(void) > > printf(" %s packet forwarding%s - CRC stripping %s - " > > "packets/burst=%d\n", cur_fwd_eng->fwd_mode_name, > > retry_enabled == 0 ? "" : " with retry", > > - rx_mode.hw_strip_crc ? "enabled" : "disabled", > > + (ports[0].dev_conf.rxmode.offloads & > DEV_RX_OFFLOAD_CRC_STRIP) ? > > + "enabled" : "disabled", > > There is a global config option in testpmd, for all ports. Previous log was print > based on that config option, but now you are printing the value of first port. Not exactly (there are multiple wrong issues with this function). For example the next lines are: if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine) printf(" packet len=%u - nb packet segments=%d\n", (unsigned)tx_pkt_length, (int) tx_pkt_nb_segs); struct rte_eth_rxconf *rx_conf = &ports[0].rx_conf; struct rte_eth_txconf *tx_conf = &ports[0].tx_conf; the last were added by commit f2c5125a686a ("app/testpmd: use default Rx/Tx port configuration"). As you can see port[0] is the one being used for the rest of the configuration print. > > I believe it is wrong to display only first port values, either log can be updated > to say testpmd default configs, or remove completely, or print for all ports, > what do you think? IMO it is the best to print for all ports. > > <...> > > > @@ -897,34 +900,31 @@ launch_args_parse(int argc, char** argv) > > } > > #endif > > if (!strcmp(lgopts[opt_idx].name, "disable-crc- > strip")) > > - rx_mode.hw_strip_crc = 0; > > + rx_offloads &= > ~DEV_RX_OFFLOAD_CRC_STRIP; > > if (!strcmp(lgopts[opt_idx].name, "enable-lro")) > > - rx_mode.enable_lro = 1; > > - if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) > > - rx_mode.enable_scatter = 1; > > + rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; > > + if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) > { > > + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; > > + } > > Can drop "{}" Yes. > > <...> > > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > > c3ab44849..e3a7c26b8 100644 > > --- a/app/test-pmd/testpmd.c > > +++ b/app/test-pmd/testpmd.c > > @@ -338,15 +338,10 @@ lcoreid_t latencystats_lcore_id = -1; > > */ > > struct rte_eth_rxmode rx_mode = { > > .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame > length. */ > > - .split_hdr_size = 0, > > - .header_split = 0, /**< Header Split disabled. */ > > - .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ > > - .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ > > - .hw_vlan_strip = 1, /**< VLAN strip enabled. */ > > - .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ > > - .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ > > - .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ > > - .hw_timestamp = 0, /**< HW timestamp enabled. */ > > + .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | > > + DEV_RX_OFFLOAD_VLAN_STRIP | > > + DEV_RX_OFFLOAD_CRC_STRIP), > > + .ignore_offload_bitfield = 1, /**< Use rte_eth_rxq_conf offloads API > > +*/ > > Is comment correct? No I should remove it. > Flag has two meaning I guess, > 1) Ignore bitfield values for port based offload configuration. It is only this meaning. > 2) For rxq, use rx_conf.offloads field. > > testpmd is still using port based offload (rte_eth_rxmode) but "offloads" > variable instead of bitfields, right? Right. queue specific ones are copy of port > configs. > > <...> ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev offloads API 2017-12-05 6:39 ` Shahaf Shuler @ 2017-12-06 22:57 ` Ferruh Yigit 2017-12-07 7:55 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Ferruh Yigit @ 2017-12-06 22:57 UTC (permalink / raw) To: Shahaf Shuler, jingjing.wu; +Cc: dev, Ananyev, Konstantin On 12/4/2017 10:39 PM, Shahaf Shuler wrote: > Tuesday, December 5, 2017 12:31 AM, Ferruh Yigit: >> On 11/23/2017 4:08 AM, Shahaf Shuler wrote: >>> Ethdev Rx/Tx offloads API has changed since: >>> >>> commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") commit >>> cba7f53b717d ("ethdev: introduce Tx queue offloads API") >>> >>> Convert the application to use the new API. >> >> Hi Shahaf, >> >> As far as I can see patch does a few things: >> 1- Convert rxmode bitfields usage to rxmode offloads usage. >> 2- Apply some config options to port config and add some port config checks. >> 3- Adding device advertised capability checks for some offloads. >> >> Would you mind separate 2 and 3 to their own patches, with that 1 should be >> straightforward and 2 & 3 will be easy to review. > > See below comments. #2 on your list is actually needed for the conversion patch. Please see below comment [1] for it. > I can split the extra cap check if you fill it needs to be in a separate patch. I find it hard to review this patch, splitting is to make easier to understand the changes, there is no extra need. > >> >> >> And is this update tested with PMDs both support new offload method and >> old offload method? > > It was tested with mlx5 and mlx4 PMD after the conversion to the new APIs. > I put this series early so everyone can try, test and report if something is broken. > I will try to do more testing with the old mlx PMD. > > BTW - we agreed that we set DD for all PMDs to move to the new API by 18.02. I still haven't see patches for that from the rest.> >> >> Thanks, >> ferruh >> >>> >>> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> >> >> <...> >> >>> } else if (!strcmp(res->name, "hw-vlan-extend")) { >>> if (!strcmp(res->value, "on")) >>> - rx_mode.hw_vlan_extend = 1; >>> + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; >> >> Not related to this patch, but since you are touching these, what is the >> difference between DEV_RX_OFFLOAD_VLAN_EXTEND and >> DEV_RX_OFFLOAD_QINQ_STRIP ? > > Good question, I could not figure it out either. > I guess those are identical. In the old API the hw_vlan_extend was the offload and the DEV_RX_OFFLOAD_QINQ_STRIP was the cap. > Now that we merged them we have duplication. > > From one side, using DEV_RX_OFFLOAD_VLAN_EXTEND is more intuitive for application which previously used hw_vlan_extend to set the offload, > For the other side QINQ_STRIP is more explicit with respect to what the feature does, and it is the flag which is currently being used for PMDs. > > So when we will change it, I guess I am in favor of the QINQ flag. +1 to QINQ. > >> >>> @@ -3434,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result, >> { >>> struct cmd_tx_vlan_set_result *res = parsed_result; >>> >>> + if (!all_ports_stopped()) { >>> + printf("Please stop all ports first\n"); >>> + return; >>> + } >> >> rte_eth_rxmode bitfields to "offloads" conversion is mostly straightforward, >> but is above kind of modifications part of this conversion or are you adding >> missing checks? > > It is part of the conversion and this is related to testpmd design. > > Previously in the old API the tx offloads were set even after the port is started. For this specific example the vlan insert just changed a flag (TESTPMD_TX_OFFLOAD_INSERT_VLAN) on the application port struct to use PKT_TX_VLAN_PKT in the mbuf ol_flags. The application didn't update the PMD in anyway. In fact, it was possible to put txq_flag which says no vlan insertion and then to set vlan insertion through the CLI. As you said, so I am a little concerned if missing something, because otherwise how this was working previously? > This was OK back then because all of the Tx offloads were set by default and we assumed users know what they are doing when setting the txq_flags. > > Now all the tx offloads are disabled by default. Every Tx offload being used should update the PMD (as it may need to switch tx burst function). This is why the Tx offloads configuration must be done when the port is stopped, and be followed with reconfiguration of the device and the queues. [1] Not agree on this part. Indeed you are fixing a behavior of the testpmd, not just converting to new method. Technically you can provide same old config with new flags, like enable all tx offloads, so behavior should be same. Later can fix testpmd in another patch, this gives a better separation. And for example I remember Konstatin mentioned some Intel NICs can accept vlan related configuration updates without stopping the forwarding, we can discuss these kind of things in this fix patch. Just suggesting removing straightforward bitfield to offloads bitwise changes out of way, and focus on what logic is changing. > >> >> I would prefer making only conversion related changes in this patch, and >> extra improvements in other patch. >> >>> + >>> tx_vlan_set(res->port_id, res->vlan_id); >>> + >>> + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); >> >> Is this required for converting bitfield to offloads usage? > > Yes, see above. btw, why RTE_PORT_ALL, just providing a port_id also should be OK. > >> >>> } >>> >>> cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = @@ -3481,7 >>> +3493,14 @@ cmd_tx_vlan_set_qinq_parsed(void *parsed_result, { >>> struct cmd_tx_vlan_set_qinq_result *res = parsed_result; >>> >>> + if (!all_ports_stopped()) { >>> + printf("Please stop all ports first\n"); >>> + return; >>> + } >> >> Same for all occurrence of these updates. >> >> <...> >> >>> @@ -3693,22 +3724,34 @@ cmd_csum_parsed(void *parsed_result, >>> >>> if (!strcmp(res->proto, "ip")) { >>> mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; >>> + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; >>> } else if (!strcmp(res->proto, "udp")) { >>> mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; >>> + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; >>> } else if (!strcmp(res->proto, "tcp")) { >>> mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; >>> + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; >>> } else if (!strcmp(res->proto, "sctp")) { >>> mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; >>> + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; >>> } else if (!strcmp(res->proto, "outer-ip")) { >>> mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; >>> + csum_offloads |= >> DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; >>> } >>> >>> - if (hw) >>> + if (hw) { >>> ports[res->port_id].tx_ol_flags |= mask; >>> - else >>> + ports[res->port_id].dev_conf.txmode.offloads |= >>> + csum_offloads; >> >> So you are updating port config as well as testpmd internal configuration, >> again I guess this is not related to conversion to offloads usage. > > It is. See above. > The port config will be used for the reconfiguration of the device and queues. This is a must for the Tx offloads . > >> >> <...> >> >>> @@ -13017,6 +13093,13 @@ cmd_set_macsec_offload_on_parsed( >>> >>> switch (ret) { >>> case 0: >>> + rte_eth_dev_info_get(port_id, &dev_info); >>> + if ((dev_info.tx_offload_capa & >>> + DEV_TX_OFFLOAD_MACSEC_INSERT) == 0) { >>> + printf("Warning: macsec insert enabled but not " >>> + "supported by port %d\n", port_id); >>> + } >> >> This also adding another layer of check if device advertise requested >> capability, this is an improvement independent from conversion, can you >> please separate into its own patch? > > Yes we can do it. > >> >> <...> >> >>> @@ -606,8 +616,8 @@ port_offload_cap_display(portid_t port_id) >>> >>> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { >>> printf("VLAN insert: "); >>> - if (ports[port_id].tx_ol_flags & >>> - TESTPMD_TX_OFFLOAD_INSERT_VLAN) >> >> This is removing testpmd local config check, just to double check if all places >> that updates this local config covered to update device config variable? > > I hope so. If you find something I missed let me know :). If you are not sure, and if you are not removing tx_ol_flags, what is the benefit of replacing? Whoever does the work removing tx_ol_flags can do replacing, this also ensures all instances updated, no? > >> >> And do we still need testpmd tx_ol_flags after these changes? > > Currently those flags are being used. One can prepare another patch to remove those and use the port config flags instead. > This is not related to the conversion and could be a nice cleanup. > >> >> <...> >> >>> @@ -1658,7 +1679,8 @@ rxtx_config_display(void) >>> printf(" %s packet forwarding%s - CRC stripping %s - " >>> "packets/burst=%d\n", cur_fwd_eng->fwd_mode_name, >>> retry_enabled == 0 ? "" : " with retry", >>> - rx_mode.hw_strip_crc ? "enabled" : "disabled", >>> + (ports[0].dev_conf.rxmode.offloads & >> DEV_RX_OFFLOAD_CRC_STRIP) ? >>> + "enabled" : "disabled", >> >> There is a global config option in testpmd, for all ports. Previous log was print >> based on that config option, but now you are printing the value of first port. > > Not exactly (there are multiple wrong issues with this function). For example the next lines are: > > if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine) > printf(" packet len=%u - nb packet segments=%d\n", > (unsigned)tx_pkt_length, (int) tx_pkt_nb_segs); > > struct rte_eth_rxconf *rx_conf = &ports[0].rx_conf; > struct rte_eth_txconf *tx_conf = &ports[0].tx_conf; > > the last were added by commit f2c5125a686a ("app/testpmd: use default Rx/Tx port configuration"). > > As you can see port[0] is the one being used for the rest of the configuration print. > >> >> I believe it is wrong to display only first port values, either log can be updated >> to say testpmd default configs, or remove completely, or print for all ports, >> what do you think? > > IMO it is the best to print for all ports. +1, can this fix be part of this patchset although it is not directly related to the offload conversion? > >> >> <...> >> >>> @@ -897,34 +900,31 @@ launch_args_parse(int argc, char** argv) >>> } >>> #endif >>> if (!strcmp(lgopts[opt_idx].name, "disable-crc- >> strip")) >>> - rx_mode.hw_strip_crc = 0; >>> + rx_offloads &= >> ~DEV_RX_OFFLOAD_CRC_STRIP; >>> if (!strcmp(lgopts[opt_idx].name, "enable-lro")) >>> - rx_mode.enable_lro = 1; >>> - if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) >>> - rx_mode.enable_scatter = 1; >>> + rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; >>> + if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) >> { >>> + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; >>> + } >> >> Can drop "{}" > > Yes. > >> >> <...> >> >>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index >>> c3ab44849..e3a7c26b8 100644 >>> --- a/app/test-pmd/testpmd.c >>> +++ b/app/test-pmd/testpmd.c >>> @@ -338,15 +338,10 @@ lcoreid_t latencystats_lcore_id = -1; >>> */ >>> struct rte_eth_rxmode rx_mode = { >>> .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame >> length. */ >>> - .split_hdr_size = 0, >>> - .header_split = 0, /**< Header Split disabled. */ >>> - .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ >>> - .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ >>> - .hw_vlan_strip = 1, /**< VLAN strip enabled. */ >>> - .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ >>> - .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ >>> - .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ >>> - .hw_timestamp = 0, /**< HW timestamp enabled. */ >>> + .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | >>> + DEV_RX_OFFLOAD_VLAN_STRIP | >>> + DEV_RX_OFFLOAD_CRC_STRIP), >>> + .ignore_offload_bitfield = 1, /**< Use rte_eth_rxq_conf offloads API >>> +*/ >> >> Is comment correct? > > No I should remove it. > >> Flag has two meaning I guess, >> 1) Ignore bitfield values for port based offload configuration. > > It is only this meaning. > >> 2) For rxq, use rx_conf.offloads field. >> >> testpmd is still using port based offload (rte_eth_rxmode) but "offloads" >> variable instead of bitfields, right? > > Right. > > queue specific ones are copy of port >> configs. >> >> <...> > @@ -1495,6 +1490,10 @@ start_port(portid_t pid) > } > if (port->need_reconfig_queues > 0) { > port->need_reconfig_queues = 0; > + /* Use rte_eth_txq_conf offloads API */ > + port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; Also I just catch this part, during app start txq_flags set via PMD default values (rxtx_port_config), if you overwrite this flag without converting to offloads, for PMDs supporting old method you are loosing configuration. > + /* Apply Tx offloads configuration */ > + port->tx_conf.offloads = port->dev_conf.txmode.offloads; > /* setup tx queues */ > for (qi = 0; qi < nb_txq; qi++) { > if ((numa_support) && > @@ -1521,6 +1520,8 @@ start_port(portid_t pid) > port->need_reconfig_queues = 1; > return -1; > } > + /* Apply Rx offloads configuration */ > + port->rx_conf.offloads = port->dev_conf.rxmode.offloads; > /* setup rx queues */ > for (qi = 0; qi < nb_rxq; qi++) { > if ((numa_support) && > ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev offloads API 2017-12-06 22:57 ` Ferruh Yigit @ 2017-12-07 7:55 ` Shahaf Shuler 0 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-07 7:55 UTC (permalink / raw) To: Ferruh Yigit, jingjing.wu; +Cc: dev, Ananyev, Konstantin Thursday, December 7, 2017 12:58 AM, Ferruh Yigit: > On 12/4/2017 10:39 PM, Shahaf Shuler wrote: > > Tuesday, December 5, 2017 12:31 AM, Ferruh Yigit: > >> On 11/23/2017 4:08 AM, Shahaf Shuler wrote: > >>> Ethdev Rx/Tx offloads API has changed since: > >>> > >>> commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") > >>> commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") > >>> > >>> Convert the application to use the new API. > >> > >> Hi Shahaf, > >> > >> As far as I can see patch does a few things: > >> 1- Convert rxmode bitfields usage to rxmode offloads usage. > >> 2- Apply some config options to port config and add some port config > checks. > >> 3- Adding device advertised capability checks for some offloads. > >> > >> Would you mind separate 2 and 3 to their own patches, with that 1 > >> should be straightforward and 2 & 3 will be easy to review. > > > > See below comments. #2 on your list is actually needed for the conversion > patch. > > Please see below comment [1] for it. > > > I can split the extra cap check if you fill it needs to be in a separate patch. > > I find it hard to review this patch, splitting is to make easier to understand the > changes, there is no extra need. OK will have them splitted on v2. > > > > >> > >> > >> And is this update tested with PMDs both support new offload method > >> and old offload method? > > > > It was tested with mlx5 and mlx4 PMD after the conversion to the new > APIs. > > I put this series early so everyone can try, test and report if something is > broken. > > I will try to do more testing with the old mlx PMD. > > > > BTW - we agreed that we set DD for all PMDs to move to the new API by > > 18.02. I still haven't see patches for that from the rest.> > >> > >> Thanks, > >> ferruh > >> > >>> > >>> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > >> > >> <...> > >> > >>> } else if (!strcmp(res->name, "hw-vlan-extend")) { > >>> if (!strcmp(res->value, "on")) > >>> - rx_mode.hw_vlan_extend = 1; > >>> + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; > >> > >> Not related to this patch, but since you are touching these, what is > >> the difference between DEV_RX_OFFLOAD_VLAN_EXTEND and > >> DEV_RX_OFFLOAD_QINQ_STRIP ? > > > > Good question, I could not figure it out either. > > I guess those are identical. In the old API the hw_vlan_extend was the > offload and the DEV_RX_OFFLOAD_QINQ_STRIP was the cap. > > Now that we merged them we have duplication. > > > > From one side, using DEV_RX_OFFLOAD_VLAN_EXTEND is more intuitive > for > > application which previously used hw_vlan_extend to set the offload, For > the other side QINQ_STRIP is more explicit with respect to what the feature > does, and it is the flag which is currently being used for PMDs. > > > > So when we will change it, I guess I am in favor of the QINQ flag. > > +1 to QINQ. > > > > >> > >>> @@ -3434,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void > *parsed_result, > >> { > >>> struct cmd_tx_vlan_set_result *res = parsed_result; > >>> > >>> + if (!all_ports_stopped()) { > >>> + printf("Please stop all ports first\n"); > >>> + return; > >>> + } > >> > >> rte_eth_rxmode bitfields to "offloads" conversion is mostly > >> straightforward, but is above kind of modifications part of this > >> conversion or are you adding missing checks? > > > > It is part of the conversion and this is related to testpmd design. > > > > Previously in the old API the tx offloads were set even after the port is > started. For this specific example the vlan insert just changed a flag > (TESTPMD_TX_OFFLOAD_INSERT_VLAN) on the application port struct to use > PKT_TX_VLAN_PKT in the mbuf ol_flags. The application didn't update the > PMD in anyway. In fact, it was possible to put txq_flag which says no vlan > insertion and then to set vlan insertion through the CLI. > > As you said, so I am a little concerned if missing something, because > otherwise how this was working previously? Again - because all of the tx offload where enabled by default. This means that the PMDs which supports those offload were using the tx/rx_burst functions which includes the functionally (unless the application disable those offloads using txq_flags). There was no need to futher update the PMD on the Tx offloads being used. As for the conflicts between CLI commands and txq flags - small bug in PMD which wasn't discovered probably because no one did some strange configuration. > > > This was OK back then because all of the Tx offloads were set by default > and we assumed users know what they are doing when setting the > txq_flags. > > > > Now all the tx offloads are disabled by default. Every Tx offload being used > should update the PMD (as it may need to switch tx burst function). This is > why the Tx offloads configuration must be done when the port is stopped, > and be followed with reconfiguration of the device and the queues. > > [1] > Not agree on this part. Indeed you are fixing a behavior of the testpmd, not > just converting to new method. Technically you can provide same old config > with new flags, like enable all tx offloads, so behavior should be same. > > Later can fix testpmd in another patch, this gives a better separation. > > And for example I remember Konstatin mentioned some Intel NICs can > accept vlan related configuration updates without stopping the forwarding, > we can discuss these kind of things in this fix patch. The on the flight VLAN configuration was converted as well and supported. I will make it more explicit on v2 with a separate patch. > > Just suggesting removing straightforward bitfield to offloads bitwise changes > out of way, and focus on what logic is changing. > > > > >> > >> I would prefer making only conversion related changes in this patch, > >> and extra improvements in other patch. > >> > >>> + > >>> tx_vlan_set(res->port_id, res->vlan_id); > >>> + > >>> + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); > >> > >> Is this required for converting bitfield to offloads usage? > > > > Yes, see above. > > btw, why RTE_PORT_ALL, just providing a port_id also should be OK. Yeah, I will switch to port_id. > > > > >> > >>> } > >>> > >>> cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = @@ -3481,7 > >>> +3493,14 @@ cmd_tx_vlan_set_qinq_parsed(void *parsed_result, { > >>> struct cmd_tx_vlan_set_qinq_result *res = parsed_result; > >>> > >>> + if (!all_ports_stopped()) { > >>> + printf("Please stop all ports first\n"); > >>> + return; > >>> + } > >> > >> Same for all occurrence of these updates. > >> > >> <...> > >> > >>> @@ -3693,22 +3724,34 @@ cmd_csum_parsed(void *parsed_result, > >>> > >>> if (!strcmp(res->proto, "ip")) { > >>> mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; > >>> + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; > >>> } else if (!strcmp(res->proto, "udp")) { > >>> mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; > >>> + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; > >>> } else if (!strcmp(res->proto, "tcp")) { > >>> mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; > >>> + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; > >>> } else if (!strcmp(res->proto, "sctp")) { > >>> mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; > >>> + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; > >>> } else if (!strcmp(res->proto, "outer-ip")) { > >>> mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; > >>> + csum_offloads |= > >> DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; > >>> } > >>> > >>> - if (hw) > >>> + if (hw) { > >>> ports[res->port_id].tx_ol_flags |= mask; > >>> - else > >>> + ports[res->port_id].dev_conf.txmode.offloads |= > >>> + csum_offloads; > >> > >> So you are updating port config as well as testpmd internal > >> configuration, again I guess this is not related to conversion to offloads > usage. > > > > It is. See above. > > The port config will be used for the reconfiguration of the device and > queues. This is a must for the Tx offloads . > > > >> > >> <...> > >> > >>> @@ -13017,6 +13093,13 @@ cmd_set_macsec_offload_on_parsed( > >>> > >>> switch (ret) { > >>> case 0: > >>> + rte_eth_dev_info_get(port_id, &dev_info); > >>> + if ((dev_info.tx_offload_capa & > >>> + DEV_TX_OFFLOAD_MACSEC_INSERT) == 0) { > >>> + printf("Warning: macsec insert enabled but not " > >>> + "supported by port %d\n", port_id); > >>> + } > >> > >> This also adding another layer of check if device advertise requested > >> capability, this is an improvement independent from conversion, can > >> you please separate into its own patch? > > > > Yes we can do it. > > > >> > >> <...> > >> > >>> @@ -606,8 +616,8 @@ port_offload_cap_display(portid_t port_id) > >>> > >>> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { > >>> printf("VLAN insert: "); > >>> - if (ports[port_id].tx_ol_flags & > >>> - TESTPMD_TX_OFFLOAD_INSERT_VLAN) > >> > >> This is removing testpmd local config check, just to double check if > >> all places that updates this local config covered to update device config > variable? > > > > I hope so. If you find something I missed let me know :). > > If you are not sure, and if you are not removing tx_ol_flags, what is the > benefit of replacing? > > Whoever does the work removing tx_ol_flags can do replacing, this also > ensures all instances updated, no? Will provide another patch to remove the ol_flags. > > > > >> > >> And do we still need testpmd tx_ol_flags after these changes? > > > > Currently those flags are being used. One can prepare another patch to > remove those and use the port config flags instead. > > This is not related to the conversion and could be a nice cleanup. > > > >> > >> <...> > >> > >>> @@ -1658,7 +1679,8 @@ rxtx_config_display(void) > >>> printf(" %s packet forwarding%s - CRC stripping %s - " > >>> "packets/burst=%d\n", cur_fwd_eng->fwd_mode_name, > >>> retry_enabled == 0 ? "" : " with retry", > >>> - rx_mode.hw_strip_crc ? "enabled" : "disabled", > >>> + (ports[0].dev_conf.rxmode.offloads & > >> DEV_RX_OFFLOAD_CRC_STRIP) ? > >>> + "enabled" : "disabled", > >> > >> There is a global config option in testpmd, for all ports. Previous > >> log was print based on that config option, but now you are printing the > value of first port. > > > > Not exactly (there are multiple wrong issues with this function). For > example the next lines are: > > > > if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == > &flow_gen_engine) > > printf(" packet len=%u - nb packet segments=%d\n", > > (unsigned)tx_pkt_length, (int) > > tx_pkt_nb_segs); > > > > struct rte_eth_rxconf *rx_conf = &ports[0].rx_conf; > > struct rte_eth_txconf *tx_conf = &ports[0].tx_conf; > > > > the last were added by commit f2c5125a686a ("app/testpmd: use default > Rx/Tx port configuration"). > > > > As you can see port[0] is the one being used for the rest of the > configuration print. > > > >> > >> I believe it is wrong to display only first port values, either log > >> can be updated to say testpmd default configs, or remove completely, > >> or print for all ports, what do you think? > > > > IMO it is the best to print for all ports. > > +1, can this fix be part of this patchset although it is not directly > +related to > the offload conversion? It can. > > > > >> > >> <...> > >> > >>> @@ -897,34 +900,31 @@ launch_args_parse(int argc, char** argv) > >>> } > >>> #endif > >>> if (!strcmp(lgopts[opt_idx].name, "disable-crc- > >> strip")) > >>> - rx_mode.hw_strip_crc = 0; > >>> + rx_offloads &= > >> ~DEV_RX_OFFLOAD_CRC_STRIP; > >>> if (!strcmp(lgopts[opt_idx].name, "enable-lro")) > >>> - rx_mode.enable_lro = 1; > >>> - if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) > >>> - rx_mode.enable_scatter = 1; > >>> + rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; > >>> + if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) > >> { > >>> + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; > >>> + } > >> > >> Can drop "{}" > > > > Yes. > > > >> > >> <...> > >> > >>> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > >>> c3ab44849..e3a7c26b8 100644 > >>> --- a/app/test-pmd/testpmd.c > >>> +++ b/app/test-pmd/testpmd.c > >>> @@ -338,15 +338,10 @@ lcoreid_t latencystats_lcore_id = -1; > >>> */ > >>> struct rte_eth_rxmode rx_mode = { > >>> .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame > >> length. */ > >>> - .split_hdr_size = 0, > >>> - .header_split = 0, /**< Header Split disabled. */ > >>> - .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ > >>> - .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ > >>> - .hw_vlan_strip = 1, /**< VLAN strip enabled. */ > >>> - .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ > >>> - .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ > >>> - .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ > >>> - .hw_timestamp = 0, /**< HW timestamp enabled. */ > >>> + .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | > >>> + DEV_RX_OFFLOAD_VLAN_STRIP | > >>> + DEV_RX_OFFLOAD_CRC_STRIP), > >>> + .ignore_offload_bitfield = 1, /**< Use rte_eth_rxq_conf offloads > >>> +API */ > >> > >> Is comment correct? > > > > No I should remove it. > > > >> Flag has two meaning I guess, > >> 1) Ignore bitfield values for port based offload configuration. > > > > It is only this meaning. > > > >> 2) For rxq, use rx_conf.offloads field. > >> > >> testpmd is still using port based offload (rte_eth_rxmode) but "offloads" > >> variable instead of bitfields, right? > > > > Right. > > > > queue specific ones are copy of port > >> configs. > >> > >> <...> > > > @@ -1495,6 +1490,10 @@ start_port(portid_t pid) > > } > > if (port->need_reconfig_queues > 0) { > > port->need_reconfig_queues = 0; > > + /* Use rte_eth_txq_conf offloads API */ > > + port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; > > Also I just catch this part, during app start txq_flags set via PMD default > values (rxtx_port_config), if you overwrite this flag without converting to > offloads, for PMDs supporting old method you are loosing configuration. Am disagree. The txq_flags are to disable offloads. From application which uses the new API perspective they are all disabled. With the new offloads API, the application is the one to choose the offloads being used, not the PMD therefore there is no point with converting the PMD txq_flags. If the underlying PMD is not supporting the new API, the offloads flags selected by the application will be converted into txq_flags. For example 0 will be converted to all of the TXQ_FLAGS. It is true that before the changes we could still have some offloads enabled (like TSO) when we use the PMD default txq_flags. However I see it as an improvement and not downside. The new application is better because it don't have offloads enabled for nothing. > > > + /* Apply Tx offloads configuration */ > > + port->tx_conf.offloads = port- > >dev_conf.txmode.offloads; > > /* setup tx queues */ > > for (qi = 0; qi < nb_txq; qi++) { > > if ((numa_support) && > > @@ -1521,6 +1520,8 @@ start_port(portid_t pid) > > port->need_reconfig_queues = 1; > > return -1; > > } > > + /* Apply Rx offloads configuration */ > > + port->rx_conf.offloads = port- > >dev_conf.rxmode.offloads; > > /* setup rx queues */ > > for (qi = 0; qi < nb_rxq; qi++) { > > if ((numa_support) && > > ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags 2017-11-23 12:07 [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev " Shahaf Shuler @ 2017-11-23 12:08 ` Shahaf Shuler 2017-12-04 22:31 ` Ferruh Yigit 2017-11-23 12:08 ` [dpdk-dev] [PATCH 3/5] app/testpmd: add command line option for multiseg Shahaf Shuler ` (4 subsequent siblings) 6 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-11-23 12:08 UTC (permalink / raw) To: jingjing.wu; +Cc: dev Since testpmd is now using the new Ethdev offloads API there is no need for the txqflags configuration. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> --- app/test-pmd/cmdline.c | 69 ------------------------ app/test-pmd/config.c | 4 +- app/test-pmd/parameters.c | 14 +---- app/test-pmd/testpmd.c | 8 --- app/test-pmd/testpmd.h | 1 - doc/guides/testpmd_app_ug/run_app.rst | 12 ----- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ---- 7 files changed, 2 insertions(+), 117 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b0f2325c8..9e3f02ec5 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3092,74 +3092,6 @@ cmdline_parse_inst_t cmd_set_txsplit = { }, }; -/* *** CONFIG TX QUEUE FLAGS *** */ - -struct cmd_config_txqflags_result { - cmdline_fixed_string_t port; - cmdline_fixed_string_t config; - cmdline_fixed_string_t all; - cmdline_fixed_string_t what; - int32_t hexvalue; -}; - -static void cmd_config_txqflags_parsed(void *parsed_result, - __attribute__((unused)) struct cmdline *cl, - __attribute__((unused)) void *data) -{ - struct cmd_config_txqflags_result *res = parsed_result; - - if (!all_ports_stopped()) { - printf("Please stop all ports first\n"); - return; - } - - if (strcmp(res->what, "txqflags")) { - printf("Unknown parameter\n"); - return; - } - - if (res->hexvalue >= 0) { - txq_flags = res->hexvalue; - } else { - printf("txqflags must be >= 0\n"); - return; - } - - init_port_config(); - - cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); -} - -cmdline_parse_token_string_t cmd_config_txqflags_port = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, port, - "port"); -cmdline_parse_token_string_t cmd_config_txqflags_config = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, config, - "config"); -cmdline_parse_token_string_t cmd_config_txqflags_all = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, all, - "all"); -cmdline_parse_token_string_t cmd_config_txqflags_what = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, what, - "txqflags"); -cmdline_parse_token_num_t cmd_config_txqflags_value = - TOKEN_NUM_INITIALIZER(struct cmd_config_txqflags_result, - hexvalue, INT32); - -cmdline_parse_inst_t cmd_config_txqflags = { - .f = cmd_config_txqflags_parsed, - .data = NULL, - .help_str = "port config all txqflags <value>", - .tokens = { - (void *)&cmd_config_txqflags_port, - (void *)&cmd_config_txqflags_config, - (void *)&cmd_config_txqflags_all, - (void *)&cmd_config_txqflags_what, - (void *)&cmd_config_txqflags_value, - NULL, - }, -}; - /* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */ struct cmd_rx_vlan_filter_all_result { cmdline_fixed_string_t rx_vlan; @@ -15729,7 +15661,6 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_config_rx_mode_flag, (cmdline_parse_inst_t *)&cmd_config_rss, (cmdline_parse_inst_t *)&cmd_config_rxtx_queue, - (cmdline_parse_inst_t *)&cmd_config_txqflags, (cmdline_parse_inst_t *)&cmd_config_rss_reta, (cmdline_parse_inst_t *)&cmd_showport_reta, (cmdline_parse_inst_t *)&cmd_config_burst, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 9b6ffeca9..089e9f4cf 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -417,7 +417,6 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id) printf("\nTX writeback threshold: %hhu", qinfo.conf.tx_thresh.wthresh); printf("\nTX RS threshold: %hu", qinfo.conf.tx_rs_thresh); printf("\nTX free threshold: %hu", qinfo.conf.tx_free_thresh); - printf("\nTX flags: %#x", qinfo.conf.txq_flags); printf("\nTX deferred start: %s", (qinfo.conf.tx_deferred_start != 0) ? "on" : "off"); printf("\nNumber of TXDs: %hu", qinfo.nb_desc); @@ -1702,8 +1701,7 @@ rxtx_config_display(void) printf(" TX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n", tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + printf(" TX RS bit threshold=%d\n", tx_conf->tx_rs_thresh); } void diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 0ba73cad5..1a145c387 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -99,7 +99,7 @@ usage(char* progname) "--rss-ip | --rss-udp | " "--rxpt= | --rxht= | --rxwt= | --rxfreet= | " "--txpt= | --txht= | --txwt= | --txfreet= | " - "--txrst= | --txqflags= ]\n", + "--txrst= ]\n", progname); #ifdef RTE_LIBRTE_CMDLINE printf(" --interactive: run in interactive mode.\n"); @@ -192,8 +192,6 @@ usage(char* progname) "(0 <= N <= value of txd).\n"); printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N " "(0 <= N <= value of txd).\n"); - printf(" --txqflags=0xXXXXXXXX: hexadecimal bitmask of TX queue flags " - "(0 <= N <= 0x7FFFFFFF).\n"); printf(" --tx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: " "tx queues statistics counters mapping " "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); @@ -630,7 +628,6 @@ launch_args_parse(int argc, char** argv) { "txwt", 1, 0, 0 }, { "txfreet", 1, 0, 0 }, { "txrst", 1, 0, 0 }, - { "txqflags", 1, 0, 0 }, { "rxpt", 1, 0, 0 }, { "rxht", 1, 0, 0 }, { "rxwt", 1, 0, 0 }, @@ -1004,15 +1001,6 @@ launch_args_parse(int argc, char** argv) else rte_exit(EXIT_FAILURE, "txrst must be >= 0\n"); } - if (!strcmp(lgopts[opt_idx].name, "txqflags")) { - char *end = NULL; - n = strtoul(optarg, &end, 16); - if (n >= 0) - txq_flags = (int32_t)n; - else - rte_exit(EXIT_FAILURE, - "txqflags must be >= 0\n"); - } if (!strcmp(lgopts[opt_idx].name, "rxd")) { n = atoi(optarg); if (n > 0) { diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index e3a7c26b8..a97edcadd 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -259,11 +259,6 @@ int16_t tx_free_thresh = RTE_PMD_PARAM_UNSET; int16_t tx_rs_thresh = RTE_PMD_PARAM_UNSET; /* - * Configurable value of TX queue flags. - */ -int32_t txq_flags = RTE_PMD_PARAM_UNSET; - -/* * Receive Side Scaling (RSS) configuration. */ uint64_t rss_hf = ETH_RSS_IP; /* RSS IP by default. */ @@ -2072,9 +2067,6 @@ rxtx_port_config(struct rte_port *port) if (tx_free_thresh != RTE_PMD_PARAM_UNSET) port->tx_conf.tx_free_thresh = tx_free_thresh; - - if (txq_flags != RTE_PMD_PARAM_UNSET) - port->tx_conf.txq_flags = txq_flags; } void diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1639d27e7..6af70e02a 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -427,7 +427,6 @@ extern int16_t rx_free_thresh; extern int8_t rx_drop_en; extern int16_t tx_free_thresh; extern int16_t tx_rs_thresh; -extern int32_t txq_flags; extern uint8_t dcb_config; extern uint8_t dcb_test; diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 4c0d2cede..cb94582b9 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -447,18 +447,6 @@ The commandline options are: Set the transmit RS bit threshold of TX rings to N, where 0 <= N <= value of ``--txd``. The default value is 0. -* ``--txqflags=0xXXXXXXXX`` - - Set the hexadecimal bitmask of TX queue flags, where 0 <= N <= 0x7FFFFFFF. - The default value is 0. - - .. note:: - - When using hardware offload functions such as vlan or checksum - add ``txqflags=0`` to force the full-featured TX code path. - In some PMDs this may already be the default. - - * ``--rx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping)]`` Set the RX queues statistics counters mapping 0 <= mapping <= 15. diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 9789139af..8e73519a4 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -354,8 +354,6 @@ The available information categories are: also modify the default hierarchy or specify the new hierarchy through CLI for implementing QoS scheduler. Requires ``CONFIG_RTE_LIBRTE_PMD_SOFTNIC=y`` ``CONFIG_RTE_LIBRTE_SCHED=y``. -Note: TX timestamping is only available in the "Full Featured" TX path. To force ``testpmd`` into this mode set ``--txqflags=0``. - Example:: testpmd> set fwd rxonly @@ -1681,15 +1679,6 @@ RX scatter mode is off by default. The ``on`` option is equivalent to the ``--enable-scatter`` command-line option. -port config - TX queue flags -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Set a hexadecimal bitmap of TX queue flags for all ports:: - - testpmd> port config all txqflags value - -This command is equivalent to the ``--txqflags`` command-line option. - port config - RX Checksum ~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags 2017-11-23 12:08 ` [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags Shahaf Shuler @ 2017-12-04 22:31 ` Ferruh Yigit 2017-12-05 6:48 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Ferruh Yigit @ 2017-12-04 22:31 UTC (permalink / raw) To: Shahaf Shuler, jingjing.wu; +Cc: dev On 11/23/2017 4:08 AM, Shahaf Shuler wrote: > Since testpmd is now using the new Ethdev offloads API there is no > need for the txqflags configuration. txqflag command-line option (--txqflags=0xXXXXXXXX) and command (port config all txqflags value) are way to dynamically provide Tx offload configuration to testpmd. Why you are removing them without providing equivalent feature with new offload APIs? Patch 3/4 & 4/5 adds new command-line options to enable some of recently introduced Tx offloads in testpmd, why not add a generic way to update all Tx offloads instead of those two specific offloads? Also this patch removing ability to display current Tx offload configuration.... > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> <...> ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags 2017-12-04 22:31 ` Ferruh Yigit @ 2017-12-05 6:48 ` Shahaf Shuler 2017-12-06 23:04 ` Ferruh Yigit 0 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-05 6:48 UTC (permalink / raw) To: Ferruh Yigit, jingjing.wu; +Cc: dev Tuesday, December 5, 2017 12:31 AM, Ferruh Yigit: > On 11/23/2017 4:08 AM, Shahaf Shuler wrote: > > Since testpmd is now using the new Ethdev offloads API there is no > > need for the txqflags configuration. > > txqflag command-line option (--txqflags=0xXXXXXXXX) and command (port > config all txqflags value) are way to dynamically provide Tx offload > configuration to testpmd. > > Why you are removing them without providing equivalent feature with new > offload APIs? There is one, and this is why the new offloads API simplifies applications life. The txq_flags were introduced so application can disable some of the Tx offloads from the time the Tx offloads were set by default. Now the Tx offloads are all disabled by default. And there is an option to set each one of the using DEV_TX_OFFLOAD_* flags. Look on the Rx side (there the Rx offloads were disabled by default in the old API). there is no rxq_flags. > > Patch 3/4 & 4/5 adds new command-line options to enable some of recently > introduced Tx offloads in testpmd, why not add a generic way to update all > Tx offloads instead of those two specific offloads? Because those 2 new offloads were missing a way to set in testpmd. The rest of the offloads can be set using the CLI commands exists today. Am not sure we want every Tx offloads to be set from both CLI and command line arguments. It wasn't before (for example there was no --disable-tso flags). > > Also this patch removing ability to display current Tx offload configuration.... Can you point where ? > > > > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > > Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> > > <...> ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags 2017-12-05 6:48 ` Shahaf Shuler @ 2017-12-06 23:04 ` Ferruh Yigit 2017-12-07 7:56 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Ferruh Yigit @ 2017-12-06 23:04 UTC (permalink / raw) To: Shahaf Shuler, jingjing.wu; +Cc: dev On 12/4/2017 10:48 PM, Shahaf Shuler wrote: > Tuesday, December 5, 2017 12:31 AM, Ferruh Yigit: >> On 11/23/2017 4:08 AM, Shahaf Shuler wrote: >>> Since testpmd is now using the new Ethdev offloads API there is no >>> need for the txqflags configuration. >> >> txqflag command-line option (--txqflags=0xXXXXXXXX) and command (port >> config all txqflags value) are way to dynamically provide Tx offload >> configuration to testpmd. >> >> Why you are removing them without providing equivalent feature with new >> offload APIs? > > There is one, and this is why the new offloads API simplifies applications life. > The txq_flags were introduced so application can disable some of the Tx offloads from the time the Tx offloads were set by default. > > Now the Tx offloads are all disabled by default. And there is an option to set each one of the using DEV_TX_OFFLOAD_* flags. > Look on the Rx side (there the Rx offloads were disabled by default in the old API). there is no rxq_flags. I mean providing a testpmd command and command-line option. Or am I missing it, after this update is there a way to update enabled Tx offloads in testpmd via command and command-line? > >> >> Patch 3/4 & 4/5 adds new command-line options to enable some of recently >> introduced Tx offloads in testpmd, why not add a generic way to update all >> Tx offloads instead of those two specific offloads? > > Because those 2 new offloads were missing a way to set in testpmd. > The rest of the offloads can be set using the CLI commands exists today. > > Am not sure we want every Tx offloads to be set from both CLI and command line arguments. > It wasn't before (for example there was no --disable-tso flags). I was thinking a generic command-line instead of introducing one for all, overall single variable represents all offload values, why not set it at once, as --txqflags you are removing in this patch. > >> >> Also this patch removing ability to display current Tx offload configuration.... > > Can you point where ? I mean following: - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + printf(" TX RS bit threshold=%d\n", tx_conf->tx_rs_thresh); Why not an offloads replacement of this one? > >> >>> >>> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> >>> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> >> >> <...> > ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags 2017-12-06 23:04 ` Ferruh Yigit @ 2017-12-07 7:56 ` Shahaf Shuler 2017-12-12 12:45 ` Maciej Czekaj 0 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-07 7:56 UTC (permalink / raw) To: Ferruh Yigit, jingjing.wu; +Cc: dev Thursday, December 7, 2017 1:05 AM, Ferruh Yigit: > On 12/4/2017 10:48 PM, Shahaf Shuler wrote: > > Tuesday, December 5, 2017 12:31 AM, Ferruh Yigit: > >> On 11/23/2017 4:08 AM, Shahaf Shuler wrote: > >>> Since testpmd is now using the new Ethdev offloads API there is no > >>> need for the txqflags configuration. > >> > >> txqflag command-line option (--txqflags=0xXXXXXXXX) and command > (port > >> config all txqflags value) are way to dynamically provide Tx offload > >> configuration to testpmd. > >> > >> Why you are removing them without providing equivalent feature with > >> new offload APIs? > > > > There is one, and this is why the new offloads API simplifies applications > life. > > The txq_flags were introduced so application can disable some of the Tx > offloads from the time the Tx offloads were set by default. > > > > Now the Tx offloads are all disabled by default. And there is an option to > set each one of the using DEV_TX_OFFLOAD_* flags. > > Look on the Rx side (there the Rx offloads were disabled by default in the > old API). there is no rxq_flags. > > I mean providing a testpmd command and command-line option. > Or am I missing it, after this update is there a way to update enabled Tx > offloads in testpmd via command and command-line? There is a way to update via CLI For example when doing "tso set <mss> <port>" the DEV_TX_OFFLOAD_TSO will be set When doing tx_vlan add <port> <vlan> the DEV_TX_OFFLOAD_VLAN_INSERT will be set Same for every Tx offloads besides DEV_TX_OFFLOAD_MULTI_SEGS and DEV_TX_OFFLOAD_MBUF_FAST_FREE which I added on separate patches. But to make it precise you didn’t had before (with the txq_flags) a way to disable TSO from the command line (the is no TXQ flag for that) nor the tunnel TSO. > > > > >> > >> Patch 3/4 & 4/5 adds new command-line options to enable some of > >> recently introduced Tx offloads in testpmd, why not add a generic way > >> to update all Tx offloads instead of those two specific offloads? > > > > Because those 2 new offloads were missing a way to set in testpmd. > > The rest of the offloads can be set using the CLI commands exists today. > > > > Am not sure we want every Tx offloads to be set from both CLI and > command line arguments. > > It wasn't before (for example there was no --disable-tso flags). > > I was thinking a generic command-line instead of introducing one for all, > overall single variable represents all offload values, why not set it at once, as > --txqflags you are removing in this patch. We can do it. yes. > > > > >> > >> Also this patch removing ability to display current Tx offload > configuration.... > > > > Can you point where ? > > I mean following: > > - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", > - tx_conf->tx_rs_thresh, tx_conf->txq_flags); > + printf(" TX RS bit threshold=%d\n", tx_conf->tx_rs_thresh); > > Why not an offloads replacement of this one? Will be added. > > > > >> > >>> > >>> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > >>> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> > >> > >> <...> > > ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags 2017-12-07 7:56 ` Shahaf Shuler @ 2017-12-12 12:45 ` Maciej Czekaj 2017-12-13 7:25 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Maciej Czekaj @ 2017-12-12 12:45 UTC (permalink / raw) To: Shahaf Shuler, Ferruh Yigit, jingjing.wu; +Cc: dev -- Oryginal message -- > Thursday, December 7, 2017 1:05 AM, Ferruh Yigit: >> On 12/4/2017 10:48 PM, Shahaf Shuler wrote: >>> Tuesday, December 5, 2017 12:31 AM, Ferruh Yigit: >>>> On 11/23/2017 4:08 AM, Shahaf Shuler wrote: >>>>> Since testpmd is now using the new Ethdev offloads API there is no >>>>> need for the txqflags configuration. >>>> txqflag command-line option (--txqflags=0xXXXXXXXX) and command >> (port >>>> config all txqflags value) are way to dynamically provide Tx offload >>>> configuration to testpmd. >>>> >>>> Why you are removing them without providing equivalent feature with >>>> new offload APIs? >>> There is one, and this is why the new offloads API simplifies applications >> life. >>> The txq_flags were introduced so application can disable some of the Tx >> offloads from the time the Tx offloads were set by default. >>> Now the Tx offloads are all disabled by default. And there is an option to >> set each one of the using DEV_TX_OFFLOAD_* flags. >>> Look on the Rx side (there the Rx offloads were disabled by default in the >> old API). there is no rxq_flags. >> >> I mean providing a testpmd command and command-line option. >> Or am I missing it, after this update is there a way to update enabled Tx >> offloads in testpmd via command and command-line? > There is a way to update via CLI > For example when doing "tso set <mss> <port>" the DEV_TX_OFFLOAD_TSO will be set > When doing tx_vlan add <port> <vlan> the DEV_TX_OFFLOAD_VLAN_INSERT will be set > Same for every Tx offloads besides DEV_TX_OFFLOAD_MULTI_SEGS and DEV_TX_OFFLOAD_MBUF_FAST_FREE which I added on separate patches. > > But to make it precise you didn’t had before (with the txq_flags) a way to disable TSO from the command line (the is no TXQ flag for that) nor the tunnel TSO. > >>>> Patch 3/4 & 4/5 adds new command-line options to enable some of >>>> recently introduced Tx offloads in testpmd, why not add a generic way >>>> to update all Tx offloads instead of those two specific offloads? >>> Because those 2 new offloads were missing a way to set in testpmd. >>> The rest of the offloads can be set using the CLI commands exists today. >>> >>> Am not sure we want every Tx offloads to be set from both CLI and >> command line arguments. >>> It wasn't before (for example there was no --disable-tso flags). >> I was thinking a generic command-line instead of introducing one for all, >> overall single variable represents all offload values, why not set it at once, as >> --txqflags you are removing in this patch. > We can do it. yes. +1 for Ferruh. --txqflags argument was very handy in testing features in batch mode. Let us have something equivalent. > >>>> Also this patch removing ability to display current Tx offload >> configuration.... >>> Can you point where ? >> I mean following: >> >> - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", >> - tx_conf->tx_rs_thresh, tx_conf->txq_flags); >> + printf(" TX RS bit threshold=%d\n", tx_conf->tx_rs_thresh); >> >> Why not an offloads replacement of this one? > Will be added. > >>>>> Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> >>>>> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> >>>> <...> ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags 2017-12-12 12:45 ` Maciej Czekaj @ 2017-12-13 7:25 ` Shahaf Shuler 0 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-13 7:25 UTC (permalink / raw) To: Maciej Czekaj, Ferruh Yigit, jingjing.wu; +Cc: dev >> We can do it. yes. >+1 for Ferruh. --txqflags argument was very handy in testing features in batch mode. Let us have something equivalent. It is there. Checkout v2 of the series, an equivalent parameter was added: tx-offloads. --Shahaf From: Maciej Czekaj [mailto:maciej.czekaj@caviumnetworks.com] Sent: Tuesday, December 12, 2017 2:45 PM To: Shahaf Shuler <shahafs@mellanox.com>; Ferruh Yigit <ferruh.yigit@intel.com>; jingjing.wu@intel.com Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags -- Oryginal message -- Thursday, December 7, 2017 1:05 AM, Ferruh Yigit: On 12/4/2017 10:48 PM, Shahaf Shuler wrote: Tuesday, December 5, 2017 12:31 AM, Ferruh Yigit: On 11/23/2017 4:08 AM, Shahaf Shuler wrote: Since testpmd is now using the new Ethdev offloads API there is no need for the txqflags configuration. txqflag command-line option (--txqflags=0xXXXXXXXX) and command (port config all txqflags value) are way to dynamically provide Tx offload configuration to testpmd. Why you are removing them without providing equivalent feature with new offload APIs? There is one, and this is why the new offloads API simplifies applications life. The txq_flags were introduced so application can disable some of the Tx offloads from the time the Tx offloads were set by default. Now the Tx offloads are all disabled by default. And there is an option to set each one of the using DEV_TX_OFFLOAD_* flags. Look on the Rx side (there the Rx offloads were disabled by default in the old API). there is no rxq_flags. I mean providing a testpmd command and command-line option. Or am I missing it, after this update is there a way to update enabled Tx offloads in testpmd via command and command-line? There is a way to update via CLI For example when doing "tso set <mss> <port>" the DEV_TX_OFFLOAD_TSO will be set When doing tx_vlan add <port> <vlan> the DEV_TX_OFFLOAD_VLAN_INSERT will be set Same for every Tx offloads besides DEV_TX_OFFLOAD_MULTI_SEGS and DEV_TX_OFFLOAD_MBUF_FAST_FREE which I added on separate patches. But to make it precise you didn’t had before (with the txq_flags) a way to disable TSO from the command line (the is no TXQ flag for that) nor the tunnel TSO. Patch 3/4 & 4/5 adds new command-line options to enable some of recently introduced Tx offloads in testpmd, why not add a generic way to update all Tx offloads instead of those two specific offloads? Because those 2 new offloads were missing a way to set in testpmd. The rest of the offloads can be set using the CLI commands exists today. Am not sure we want every Tx offloads to be set from both CLI and command line arguments. It wasn't before (for example there was no --disable-tso flags). I was thinking a generic command-line instead of introducing one for all, overall single variable represents all offload values, why not set it at once, as --txqflags you are removing in this patch. We can do it. yes. +1 for Ferruh. --txqflags argument was very handy in testing features in batch mode. Let us have something equivalent. Also this patch removing ability to display current Tx offload configuration.... Can you point where ? I mean following: - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + printf(" TX RS bit threshold=%d\n", tx_conf->tx_rs_thresh); Why not an offloads replacement of this one? Will be added. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com><mailto:shahafs@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com><mailto:nelio.laranjeiro@6wind.com> <...> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH 3/5] app/testpmd: add command line option for multiseg 2017-11-23 12:07 [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev " Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags Shahaf Shuler @ 2017-11-23 12:08 ` Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 4/5] app/testpmd: add command line option for mbuf fast free Shahaf Shuler ` (3 subsequent siblings) 6 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-11-23 12:08 UTC (permalink / raw) To: jingjing.wu; +Cc: dev This patch enables multi segment send Tx offloads from the command line. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/parameters.c | 8 ++++++++ app/test-pmd/testpmd.c | 4 ++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/run_app.rst | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 1a145c387..8a68a39ea 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -214,6 +214,8 @@ usage(char* progname) "disable print of designated event or all of them.\n"); printf(" --flow-isolate-all: " "requests flow API isolated mode on all ports at initialization time.\n"); + printf(" --enable-multiseg: " + "enables multi segment send Tx offload on all ports.\n"); } #ifdef RTE_LIBRTE_CMDLINE @@ -566,6 +568,8 @@ launch_args_parse(int argc, char** argv) enum { TX, RX }; /* Default Rx offloads for all ports. */ uint64_t rx_offloads = rx_mode.offloads; + /* Default Tx offloads for all ports. */ + uint64_t tx_offloads = tx_mode.offloads; static struct option lgopts[] = { { "help", 0, 0, 0 }, @@ -642,6 +646,7 @@ launch_args_parse(int argc, char** argv) { "no-rmv-interrupt", 0, 0, 0 }, { "print-event", 1, 0, 0 }, { "mask-event", 1, 0, 0 }, + { "enable-multiseg", 0, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1115,6 +1120,8 @@ launch_args_parse(int argc, char** argv) rte_exit(EXIT_FAILURE, "invalid mask-event argument\n"); } + if (!strcmp(lgopts[opt_idx].name, "enable-multiseg")) + tx_offloads |= DEV_TX_OFFLOAD_MULTI_SEGS; break; case 'h': @@ -1131,4 +1138,5 @@ launch_args_parse(int argc, char** argv) /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; + tx_mode.offloads = tx_offloads; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index a97edcadd..2550677c3 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -339,6 +339,8 @@ struct rte_eth_rxmode rx_mode = { .ignore_offload_bitfield = 1, /**< Use rte_eth_rxq_conf offloads API */ }; +struct rte_eth_txmode tx_mode; + struct rte_fdir_conf fdir_conf = { .mode = RTE_FDIR_MODE_NONE, .pballoc = RTE_FDIR_PBALLOC_64K, @@ -599,6 +601,8 @@ init_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; + /* Apply default Tx configuration for all ports */ + port->dev_conf.txmode = tx_mode; rte_eth_dev_info_get(pid, &port->dev_info); if (numa_support) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 6af70e02a..8e572704e 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -415,6 +415,7 @@ extern portid_t fwd_ports_ids[RTE_MAX_ETHPORTS]; extern struct rte_port *ports; extern struct rte_eth_rxmode rx_mode; +extern struct rte_eth_txmode tx_mode; extern uint64_t rss_hf; extern queueid_t nb_rxq; diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index cb94582b9..b21a1fe8a 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -497,3 +497,7 @@ The commandline options are: configured flow rules only (see flow command). Ports that do not support this mode are automatically discarded. + +* ``--enable-multiseg`` + + Enables multi segment send Tx offload on all ports. -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH 4/5] app/testpmd: add command line option for mbuf fast free 2017-11-23 12:07 [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API Shahaf Shuler ` (2 preceding siblings ...) 2017-11-23 12:08 ` [dpdk-dev] [PATCH 3/5] app/testpmd: add command line option for multiseg Shahaf Shuler @ 2017-11-23 12:08 ` Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 5/5] app/testpmd: enforce offloads caps Shahaf Shuler ` (2 subsequent siblings) 6 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-11-23 12:08 UTC (permalink / raw) To: jingjing.wu; +Cc: dev This patch enables mbuf fast free Tx offloads from the command line. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/parameters.c | 5 +++++ doc/guides/testpmd_app_ug/run_app.rst | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 8a68a39ea..cc18cb767 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -216,6 +216,8 @@ usage(char* progname) "requests flow API isolated mode on all ports at initialization time.\n"); printf(" --enable-multiseg: " "enables multi segment send Tx offload on all ports.\n"); + printf(" --enable-fast-free: " + "enables mbuf fast free Tx offload on all ports.\n"); } #ifdef RTE_LIBRTE_CMDLINE @@ -647,6 +649,7 @@ launch_args_parse(int argc, char** argv) { "print-event", 1, 0, 0 }, { "mask-event", 1, 0, 0 }, { "enable-multiseg", 0, 0, 0 }, + { "enable-fast-free", 0, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1122,6 +1125,8 @@ launch_args_parse(int argc, char** argv) } if (!strcmp(lgopts[opt_idx].name, "enable-multiseg")) tx_offloads |= DEV_TX_OFFLOAD_MULTI_SEGS; + if (!strcmp(lgopts[opt_idx].name, "enable-fast-free")) + tx_offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE; break; case 'h': diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index b21a1fe8a..1311cce41 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -501,3 +501,7 @@ The commandline options are: * ``--enable-multiseg`` Enables multi segment send Tx offload on all ports. + +* ``--enable-fast-free`` + + Enables mbuf fast free Tx offload on all ports. -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH 5/5] app/testpmd: enforce offloads caps 2017-11-23 12:07 [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API Shahaf Shuler ` (3 preceding siblings ...) 2017-11-23 12:08 ` [dpdk-dev] [PATCH 4/5] app/testpmd: add command line option for mbuf fast free Shahaf Shuler @ 2017-11-23 12:08 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler 6 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-11-23 12:08 UTC (permalink / raw) To: jingjing.wu; +Cc: dev In the current design it was possible for offload to be set even though the device is not supporting it. A warning message was printed instead. This is a wrong behaviour, as application should set only the offloads reported by the capabilities of the device. This patch adds verification for the offloads being set and make sure the offload configuration passed to the device always match its capabilities. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 132 ++++++++++++++++++++++++++++---------------- app/test-pmd/config.c | 22 ++++---- app/test-pmd/testpmd.c | 21 ++++++- 3 files changed, 115 insertions(+), 60 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 9e3f02ec5..2f099a8e6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3639,6 +3639,7 @@ cmd_csum_parsed(void *parsed_result, int hw = 0; uint16_t mask = 0; uint64_t csum_offloads = 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); @@ -3649,26 +3650,58 @@ cmd_csum_parsed(void *parsed_result, return; } + rte_eth_dev_info_get(res->port_id, &dev_info); if (!strcmp(res->mode, "set")) { if (!strcmp(res->hwsw, "hw")) hw = 1; if (!strcmp(res->proto, "ip")) { - mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_IPV4_CKSUM) { + mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + } else { + printf("IP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "udp")) { - mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_UDP_CKSUM) { + mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + } else { + printf("UDP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "tcp")) { - mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_TCP_CKSUM) { + mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + } else { + printf("TCP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "sctp")) { - mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_SCTP_CKSUM) { + mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + } else { + printf("SCTP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "outer-ip")) { - mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; - csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { + mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; + csum_offloads |= + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + } else { + printf("Outer IP checksum offload is not " + "supported by port %u\n", res->port_id); + } } if (hw) { @@ -3815,6 +3848,14 @@ cmd_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; + rte_eth_dev_info_get(res->port_id, &dev_info); + if ((ports[res->port_id].tso_segsz != 0) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0) { + printf("Error: TSO is not supported by port %d\n", + res->port_id); + return; + } + if (ports[res->port_id].tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_TCP_TSO; @@ -3826,14 +3867,6 @@ cmd_tso_set_parsed(void *parsed_result, ports[res->port_id].tso_segsz); } - /* display warnings if configuration is not supported by the NIC */ - rte_eth_dev_info_get(res->port_id, &dev_info); - if ((ports[res->port_id].tso_segsz != 0) && - (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0) { - printf("Warning: TSO enabled but not " - "supported by port %d\n", res->port_id); - } - cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); } @@ -3891,24 +3924,25 @@ struct cmd_tunnel_tso_set_result { portid_t port_id; }; -static void +static struct rte_eth_dev_info check_tunnel_tso_nic_support(portid_t port_id) { struct rte_eth_dev_info dev_info; rte_eth_dev_info_get(port_id, &dev_info); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO)) - printf("Warning: TSO enabled but VXLAN TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: VXLAN TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO)) - printf("Warning: TSO enabled but GRE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GRE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO)) - printf("Warning: TSO enabled but IPIP TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: IPIP TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO)) - printf("Warning: TSO enabled but GENEVE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GENEVE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); + return dev_info; } static void @@ -3917,6 +3951,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_tunnel_tso_set_result *res = parsed_result; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -3928,6 +3963,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; + dev_info = check_tunnel_tso_nic_support(res->port_id); if (ports[res->port_id].tunnel_tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | @@ -3936,11 +3972,13 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); } else { + uint64_t tso_offloads = (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + ports[res->port_id].dev_conf.txmode.offloads |= - (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | - DEV_TX_OFFLOAD_GRE_TNL_TSO | - DEV_TX_OFFLOAD_IPIP_TNL_TSO | - DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + (tso_offloads & dev_info.tx_offload_capa); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3955,7 +3993,6 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, * is not necessary for IPv6 tunneled pkts because there's no * checksum in IP header anymore. */ - check_tunnel_tso_nic_support(res->port_id); if (!(ports[res->port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL)) @@ -13014,23 +13051,20 @@ cmd_set_macsec_offload_on_parsed( printf("Please stop all ports first\n"); return; } - - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; - ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); + ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif + } RTE_SET_USED(en); RTE_SET_USED(rp); switch (ret) { case 0: - rte_eth_dev_info_get(port_id, &dev_info); - if ((dev_info.tx_offload_capa & - DEV_TX_OFFLOAD_MACSEC_INSERT) == 0) { - printf("Warning: macsec insert enabled but not " - "supported by port %d\n", port_id); - } + ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); break; case -ENODEV: @@ -13102,6 +13136,7 @@ cmd_set_macsec_offload_off_parsed( { struct cmd_macsec_offload_off_result *res = parsed_result; int ret = -ENOTSUP; + struct rte_eth_dev_info dev_info; portid_t port_id = res->port_id; if (port_id_is_invalid(port_id, ENABLED_WARN)) @@ -13110,16 +13145,17 @@ cmd_set_macsec_offload_off_parsed( printf("Please stop all ports first\n"); return; } - - ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; - ports[port_id].dev_conf.txmode.offloads &= - ~DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_disable(port_id); + ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif - + } switch (ret) { case 0: + ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); break; case -ENODEV: diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 089e9f4cf..a20df307b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2790,16 +2790,17 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) printf("Error, as QinQ has been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) { + printf("Error: vlan insert is not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; - rte_eth_dev_info_get(port_id, &dev_info); - if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) { - printf("Warning: vlan insert enabled but not " - "supported by port %d\n", port_id); - } } void @@ -2820,17 +2821,18 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) printf("Error, as QinQ hasn't been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) { + printf("Error: qinq insert not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; - rte_eth_dev_info_get(port_id, &dev_info); - if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) { - printf("Warning: qinq insert enabled but not " - "supported by port %d\n", port_id); - } } void diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 2550677c3..2b8142162 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -601,10 +601,18 @@ init_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; + rte_eth_dev_info_get(pid, &port->dev_info); /* Apply default Tx configuration for all ports */ port->dev_conf.txmode = tx_mode; - rte_eth_dev_info_get(pid, &port->dev_info); - + if ((port->dev_info.tx_offload_capa & tx_mode.offloads) != + tx_mode.offloads) { + printf("Some Tx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + pid, tx_mode.offloads, + port->dev_info.tx_offload_capa); + port->dev_conf.txmode.offloads &= + port->dev_info.tx_offload_capa; + } if (numa_support) { if (port_numa[pid] != NUMA_NO_CONFIG) port_per_socket[port_numa[pid]]++; @@ -2082,6 +2090,15 @@ init_port_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; port->dev_conf.rxmode = rx_mode; + if ((port->dev_info.rx_offload_capa & rx_mode.offloads) != + rx_mode.offloads) { + printf("Some Rx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + pid, rx_mode.offloads, + port->dev_info.rx_offload_capa); + port->dev_conf.rxmode.offloads &= + port->dev_info.rx_offload_capa; + } port->dev_conf.fdir_conf = fdir_conf; if (nb_rxq > 1) { port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL; -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API 2017-11-23 12:07 [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API Shahaf Shuler ` (4 preceding siblings ...) 2017-11-23 12:08 ` [dpdk-dev] [PATCH 5/5] app/testpmd: enforce offloads caps Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 01/10] app/testpmd: fix port configuration print Shahaf Shuler ` (10 more replies) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler 6 siblings, 11 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev This series is to convert testpmd application to the new offloads API [1]. on v2: - Splited the patchset to multiple patches to help with the review. - Removed wrong comments. - Removed redundent parenthesis. - Fixed port print parameters. - Introduced a new method to check if single port is stopped. - Cleanup for internal Tx offloads flags. [1] http://dpdk.org/ml/archives/dev/2017-October/077329.html Shahaf Shuler (10): app/testpmd: fix port configuration print app/testpmd: convert to new Ethdev Rx offloads API app/testpmd: support check of single port stop app/testpmd: convert to new Ethdev Tx offloads API app/testpmd: fix flowgen forwarding ol flags app/testpmd: cleanup internal Tx offloads flags field app/testpmd: add command line option for Tx offloads app/testpmd: remove txqflags app/testpmd: enforce offloads caps app/testpmd: fix on the flight VLAN configuration app/test-pmd/cmdline.c | 501 +++++++++++++---------- app/test-pmd/config.c | 177 +++++--- app/test-pmd/csumonly.c | 40 +- app/test-pmd/flowgen.c | 12 +- app/test-pmd/macfwd.c | 8 +- app/test-pmd/macswap.c | 8 +- app/test-pmd/parameters.c | 59 +-- app/test-pmd/testpmd.c | 77 ++-- app/test-pmd/testpmd.h | 26 +- app/test-pmd/txonly.c | 8 +- doc/guides/testpmd_app_ug/run_app.rst | 17 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 - 12 files changed, 541 insertions(+), 403 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 01/10] app/testpmd: fix port configuration print 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler ` (9 subsequent siblings) 10 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev, pablo.de.lara.guarch, stable The print of the port configuration was only according to configuration of the first port. Fixes: f2c5125a686a ("app/testpmd: use default Rx/Tx port configuration") Cc: pablo.de.lara.guarch@intel.com Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/config.c | 48 +++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index cd2ac11..8a2d30c 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1655,33 +1655,45 @@ struct igb_ring_desc_16_bytes { void rxtx_config_display(void) { - printf(" %s packet forwarding%s - CRC stripping %s - " - "packets/burst=%d\n", cur_fwd_eng->fwd_mode_name, + portid_t pid; + + printf(" %s packet forwarding%s packets/burst=%d\n", + cur_fwd_eng->fwd_mode_name, retry_enabled == 0 ? "" : " with retry", - rx_mode.hw_strip_crc ? "enabled" : "disabled", nb_pkt_per_burst); if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine) printf(" packet len=%u - nb packet segments=%d\n", (unsigned)tx_pkt_length, (int) tx_pkt_nb_segs); - struct rte_eth_rxconf *rx_conf = &ports[0].rx_conf; - struct rte_eth_txconf *tx_conf = &ports[0].tx_conf; - printf(" nb forwarding cores=%d - nb forwarding ports=%d\n", nb_fwd_lcores, nb_fwd_ports); - printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", - nb_rxq, nb_rxd, rx_conf->rx_free_thresh); - printf(" RX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n", - rx_conf->rx_thresh.pthresh, rx_conf->rx_thresh.hthresh, - rx_conf->rx_thresh.wthresh); - printf(" TX queues=%d - TX desc=%d - TX free threshold=%d\n", - nb_txq, nb_txd, tx_conf->tx_free_thresh); - printf(" TX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n", - tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, - tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + + RTE_ETH_FOREACH_DEV(pid) { + struct rte_eth_rxconf *rx_conf = &ports[pid].rx_conf; + struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf; + + printf(" port %d:\n", (unsigned int)pid); + printf(" CRC stripping %s\n", + ports[pid].dev_conf.rxmode.hw_strip_crc ? + "enabled" : "disabled"); + printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", + nb_rxq, nb_rxd, rx_conf->rx_free_thresh); + printf(" RX threshold registers: pthresh=%d hthresh=%d " + " wthresh=%d\n", + rx_conf->rx_thresh.pthresh, + rx_conf->rx_thresh.hthresh, + rx_conf->rx_thresh.wthresh); + printf(" TX queues=%d - TX desc=%d - TX free threshold=%d\n", + nb_txq, nb_txd, tx_conf->tx_free_thresh); + printf(" TX threshold registers: pthresh=%d hthresh=%d " + " wthresh=%d\n", + tx_conf->tx_thresh.pthresh, + tx_conf->tx_thresh.hthresh, + tx_conf->tx_thresh.wthresh); + printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", + tx_conf->tx_rs_thresh, tx_conf->txq_flags); + } } void -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 02/10] app/testpmd: convert to new Ethdev Rx offloads API 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 01/10] app/testpmd: fix port configuration print Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 03/10] app/testpmd: support check of single port stop Shahaf Shuler ` (8 subsequent siblings) 10 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") Convert the application to use the new API. The is no functionality changes rather simple conversion of the flags. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 51 +++++++++++++++++++++++------------------- app/test-pmd/config.c | 36 +++++++++++++++++++---------- app/test-pmd/parameters.c | 32 +++++++++++++------------- app/test-pmd/testpmd.c | 19 +++++++--------- 4 files changed, 77 insertions(+), 61 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f71d963..d8c73a9 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,6 +1577,7 @@ struct cmd_config_max_pkt_len_result { __attribute__((unused)) void *data) { struct cmd_config_max_pkt_len_result *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1594,14 +1595,16 @@ struct cmd_config_max_pkt_len_result { rx_mode.max_rx_pkt_len = res->value; if (res->value > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else - rx_mode.jumbo_frame = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; } else { printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; + init_port_config(); cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1703,6 +1706,7 @@ struct cmd_config_rx_mode_flag { __attribute__((unused)) void *data) { struct cmd_config_rx_mode_flag *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1711,48 +1715,48 @@ struct cmd_config_rx_mode_flag { if (!strcmp(res->name, "crc-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_strip_crc = 1; + rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "scatter")) { - if (!strcmp(res->value, "on")) - rx_mode.enable_scatter = 1; - else if (!strcmp(res->value, "off")) - rx_mode.enable_scatter = 0; - else { + if (!strcmp(res->value, "on")) { + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + } else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-cksum")) { if (!strcmp(res->value, "on")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; else if (!strcmp(res->value, "off")) - rx_mode.hw_ip_checksum = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-timestamp")) { if (!strcmp(res->value, "on")) - rx_mode.hw_timestamp = 1; + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; else if (!strcmp(res->value, "off")) - rx_mode.hw_timestamp = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan")) { if (!strcmp(res->value, "on")) { - rx_mode.hw_vlan_filter = 1; - rx_mode.hw_vlan_strip = 1; + rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else if (!strcmp(res->value, "off")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else { printf("Unknown parameter\n"); @@ -1760,27 +1764,27 @@ struct cmd_config_rx_mode_flag { } } else if (!strcmp(res->name, "hw-vlan-filter")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_filter = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_strip = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-extend")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_extend = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; else { printf("Unknown parameter\n"); return; @@ -1798,6 +1802,7 @@ struct cmd_config_rx_mode_flag { printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; init_port_config(); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 8a2d30c..2fdc051 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -540,14 +540,12 @@ struct rss_type_info { void port_offload_cap_display(portid_t port_id) { - struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; static const char *info_border = "************"; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - dev = &rte_eth_devices[port_id]; rte_eth_dev_info_get(port_id, &dev_info); printf("\n%s Port %d supported offload features: %s\n", @@ -555,7 +553,8 @@ struct rss_type_info { if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) { printf("VLAN stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_strip) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_STRIP) printf("on\n"); else printf("off\n"); @@ -563,7 +562,8 @@ struct rss_type_info { if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) { printf("Double VLANs stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_extend) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_EXTEND) printf("on\n"); else printf("off\n"); @@ -571,7 +571,8 @@ struct rss_type_info { if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) { printf("RX IPv4 checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -579,7 +580,8 @@ struct rss_type_info { if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) { printf("RX UDP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n"); @@ -587,18 +589,26 @@ struct rss_type_info { if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) { printf("RX TCP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n"); } - if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) - printf("RX Outer IPv4 checksum: on"); + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) { + printf("RX Outer IPv4 checksum: "); + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) + printf("on\n"); + else + printf("off\n"); + } if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) { printf("Large receive offload: "); - if (dev->data->dev_conf.rxmode.enable_lro) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_LRO) printf("on\n"); else printf("off\n"); @@ -615,7 +625,8 @@ struct rss_type_info { if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) { printf("HW timestamp: "); - if (dev->data->dev_conf.rxmode.hw_timestamp) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TIMESTAMP) printf("on\n"); else printf("off\n"); @@ -1675,7 +1686,8 @@ struct igb_ring_desc_16_bytes { printf(" port %d:\n", (unsigned int)pid); printf(" CRC stripping %s\n", - ports[pid].dev_conf.rxmode.hw_strip_crc ? + (ports[pid].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_CRC_STRIP) ? "enabled" : "disabled"); printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", nb_rxq, nb_rxd, rx_conf->rx_free_thresh); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 84e7a63..263651c 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -566,6 +566,8 @@ char **argvopt; int opt_idx; enum { TX, RX }; + /* Default Rx offloads for all ports. */ + uint64_t rx_offloads = rx_mode.offloads; static struct option lgopts[] = { { "help", 0, 0, 0 }, @@ -804,7 +806,8 @@ if (n >= ETHER_MIN_LEN) { rx_mode.max_rx_pkt_len = (uint32_t) n; if (n > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; } else rte_exit(EXIT_FAILURE, "Invalid max-pkt-len=%d - should be > %d\n", @@ -897,34 +900,30 @@ } #endif if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; if (!strcmp(lgopts[opt_idx].name, "enable-lro")) - rx_mode.enable_lro = 1; + rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) - rx_mode.enable_scatter = 1; + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; if (!strcmp(lgopts[opt_idx].name, "enable-rx-timestamp")) - rx_mode.hw_timestamp = 1; - - if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; - rx_mode.hw_vlan_extend = 0; - } + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-filter")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-strip")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-extend")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; if (!strcmp(lgopts[opt_idx].name, "enable-drop-en")) rx_drop_en = 1; @@ -1140,4 +1139,7 @@ break; } } + + /* Set offload configuration from command line parameters. */ + rx_mode.offloads = rx_offloads; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index c3ab448..6785b09 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -338,15 +338,10 @@ struct fwd_engine * fwd_engines[] = { */ struct rte_eth_rxmode rx_mode = { .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */ - .split_hdr_size = 0, - .header_split = 0, /**< Header Split disabled. */ - .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ - .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ - .hw_vlan_strip = 1, /**< VLAN strip enabled. */ - .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ - .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ - .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ - .hw_timestamp = 0, /**< HW timestamp enabled. */ + .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP | + DEV_RX_OFFLOAD_CRC_STRIP), + .ignore_offload_bitfield = 1, }; struct rte_fdir_conf fdir_conf = { @@ -1521,6 +1516,8 @@ static int eth_event_callback(portid_t port_id, port->need_reconfig_queues = 1; return -1; } + /* Apply Rx offloads configuration */ + port->rx_conf.offloads = port->dev_conf.rxmode.offloads; /* setup rx queues */ for (qi = 0; qi < nb_rxq; qi++) { if ((numa_support) && @@ -2252,7 +2249,7 @@ uint8_t port_is_bonding_slave(portid_t slave_pid) retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en); if (retval < 0) return retval; - port_conf.rxmode.hw_vlan_filter = 1; + port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; /** * Write the configuration into the device. @@ -2301,7 +2298,7 @@ uint8_t port_is_bonding_slave(portid_t slave_pid) rxtx_port_config(rte_port); /* VLAN filter */ - rte_port->dev_conf.rxmode.hw_vlan_filter = 1; + rte_port->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; for (i = 0; i < RTE_DIM(vlan_tags); i++) rx_vft_set(pid, vlan_tags[i], 1); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 03/10] app/testpmd: support check of single port stop 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 01/10] app/testpmd: fix port configuration print Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler ` (7 subsequent siblings) 10 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev This patch adds supports for checking if a single port is stopped. currently there is a function to check only for all ports. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/testpmd.c | 16 ++++++++++++---- app/test-pmd/testpmd.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 6785b09..77154ef 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1394,15 +1394,23 @@ static int eth_event_callback(portid_t port_id, } int +port_is_stopped(portid_t port_id) +{ + struct rte_port *port = &ports[port_id]; + + if ((port->port_status != RTE_PORT_STOPPED) && + (port->slave_flag == 0)) + return 0; + return 1; +} + +int all_ports_stopped(void) { portid_t pi; - struct rte_port *port; RTE_ETH_FOREACH_DEV(pi) { - port = &ports[pi]; - if ((port->port_status != RTE_PORT_STOPPED) && - (port->slave_flag == 0)) + if (!port_is_stopped(pi)) return 0; } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1639d27..ab74d39 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -682,6 +682,7 @@ int init_port_dcb_config(portid_t pid, enum dcb_mode_enable dcb_mode, void attach_port(char *identifier); void detach_port(portid_t port_id); int all_ports_stopped(void); +int port_is_stopped(portid_t port_id); int port_is_started(portid_t port_id); void pmd_test_exit(void); void fdir_get_infos(portid_t port_id); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (2 preceding siblings ...) 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 03/10] app/testpmd: support check of single port stop Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2018-01-05 18:11 ` Maciej Czekaj 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler ` (6 subsequent siblings) 10 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") Convert the application to use the new API. This patch mandates the port to be stopped when configure the Tx offloads. This is because the PMD must be aware to the offloads changes on the device and queue configuration. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 90 ++++++++++++++++++++++++++++++++++++++++++--- app/test-pmd/config.c | 55 ++++++++++++++++++--------- app/test-pmd/testpmd.c | 3 ++ 3 files changed, 124 insertions(+), 24 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d8c73a9..5812583 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3439,7 +3439,14 @@ struct cmd_tx_vlan_set_result { { struct cmd_tx_vlan_set_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_vlan_set(res->port_id, res->vlan_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = @@ -3486,7 +3493,14 @@ struct cmd_tx_vlan_set_qinq_result { { struct cmd_tx_vlan_set_qinq_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_qinq_set(res->port_id, res->vlan_id, res->vlan_id_outer); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_qinq_tx_vlan = @@ -3592,7 +3606,14 @@ struct cmd_tx_vlan_reset_result { { struct cmd_tx_vlan_reset_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_vlan_reset(res->port_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_reset_tx_vlan = @@ -3685,11 +3706,16 @@ struct cmd_csum_result { struct cmd_csum_result *res = parsed_result; int hw = 0; uint16_t mask = 0; + uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); return; } + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) { @@ -3698,22 +3724,34 @@ struct cmd_csum_result { if (!strcmp(res->proto, "ip")) { mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } - if (hw) + if (hw) { ports[res->port_id].tx_ol_flags |= mask; - else + ports[res->port_id].dev_conf.txmode.offloads |= + csum_offloads; + } else { ports[res->port_id].tx_ol_flags &= (~mask); + ports[res->port_id].dev_conf.txmode.offloads &= + (~csum_offloads); + } } csum_show(res->port_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_csum_csum = @@ -3837,15 +3875,24 @@ struct cmd_tso_set_result { if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; - if (ports[res->port_id].tso_segsz == 0) + if (ports[res->port_id].tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_TCP_TSO; printf("TSO for non-tunneled packets is disabled\n"); - else + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_TCP_TSO; printf("TSO segment size for non-tunneled packets is %d\n", ports[res->port_id].tso_segsz); + } /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(res->port_id, &dev_info); @@ -3854,6 +3901,8 @@ struct cmd_tso_set_result { printf("Warning: TSO enabled but not " "supported by port %d\n", res->port_id); } + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tso_set_tso = @@ -3939,13 +3988,27 @@ struct cmd_tunnel_tso_set_result { if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - if (ports[res->port_id].tunnel_tso_segsz == 0) + if (ports[res->port_id].tunnel_tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); - else { + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3971,6 +4034,8 @@ struct cmd_tunnel_tso_set_result { printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tunnel_tso_set_tso = @@ -13012,8 +13077,13 @@ struct cmd_macsec_offload_on_result { if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!port_is_stopped(port_id)) { + printf("Please stop port %d first\n", port_id); + return; + } ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif @@ -13022,6 +13092,7 @@ struct cmd_macsec_offload_on_result { switch (ret) { case 0: + cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); @@ -13096,14 +13167,21 @@ struct cmd_macsec_offload_off_result { if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!port_is_stopped(port_id)) { + printf("Please stop port %d first\n", port_id); + return; + } ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif switch (ret) { case 0: + cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 2fdc051..ee7d083 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -616,8 +616,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { printf("VLAN insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VLAN_INSERT) printf("on\n"); else printf("off\n"); @@ -634,8 +634,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) { printf("Double VLANs insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_QINQ_INSERT) printf("on\n"); else printf("off\n"); @@ -643,7 +643,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) { printf("TX IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -651,7 +652,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) { printf("TX UDP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n"); @@ -659,7 +661,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) { printf("TX TCP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n"); @@ -667,7 +670,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) { printf("TX SCTP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_SCTP_CKSUM) printf("on\n"); else printf("off\n"); @@ -675,8 +679,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { printf("TX Outer IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -684,7 +688,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) { printf("TX TCP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_TSO) printf("on\n"); else printf("off\n"); @@ -692,7 +697,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) { printf("TX UDP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_TSO) printf("on\n"); else printf("off\n"); @@ -700,7 +706,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) { printf("TSO for VXLAN tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VXLAN_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -708,7 +715,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) { printf("TSO for GRE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GRE_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -716,7 +724,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) { printf("TSO for IPIP tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPIP_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -724,7 +733,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) { printf("TSO for GENEVE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GENEVE_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -1703,8 +1713,10 @@ struct igb_ring_desc_16_bytes { tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"" + " - TXQ offloads=0x%"PRIx64"\n", + tx_conf->tx_rs_thresh, tx_conf->txq_flags, + tx_conf->offloads); } } @@ -2782,6 +2794,7 @@ struct igb_ring_desc_16_bytes { tx_vlan_set(portid_t port_id, uint16_t vlan_id) { int vlan_offload; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2795,6 +2808,7 @@ struct igb_ring_desc_16_bytes { tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; } @@ -2802,6 +2816,7 @@ struct igb_ring_desc_16_bytes { tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) { int vlan_offload; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2817,6 +2832,7 @@ struct igb_ring_desc_16_bytes { tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; } @@ -2828,6 +2844,9 @@ struct igb_ring_desc_16_bytes { return; ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | TESTPMD_TX_OFFLOAD_INSERT_QINQ); + ports[port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_QINQ_INSERT); ports[port_id].tx_vlan_id = 0; ports[port_id].tx_vlan_id_outer = 0; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 77154ef..0087438 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1498,6 +1498,9 @@ static int eth_event_callback(portid_t port_id, } if (port->need_reconfig_queues > 0) { port->need_reconfig_queues = 0; + port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + /* Apply Tx offloads configuration */ + port->tx_conf.offloads = port->dev_conf.txmode.offloads; /* setup tx queues */ for (qi = 0; qi < nb_txq; qi++) { if ((numa_support) && -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler @ 2018-01-05 18:11 ` Maciej Czekaj 2018-01-07 15:24 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Maciej Czekaj @ 2018-01-05 18:11 UTC (permalink / raw) To: Shahaf Shuler, ferruh.yigit, jingjing.wu; +Cc: dev -- Oryginal message -- > Ethdev Tx offloads API has changed since: > > commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") > > Convert the application to use the new API. > > This patch mandates the port to be stopped when configure the Tx > offloads. This is because the PMD must be aware to the offloads changes > on the device and queue configuration. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > --- > app/test-pmd/cmdline.c | 90 ++++++++++++++++++++++++++++++++++++++++++--- > app/test-pmd/config.c | 55 ++++++++++++++++++--------- > app/test-pmd/testpmd.c | 3 ++ > 3 files changed, 124 insertions(+), 24 deletions(-) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index d8c73a9..5812583 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -3439,7 +3439,14 @@ struct cmd_tx_vlan_set_result { > { > struct cmd_tx_vlan_set_result *res = parsed_result; > > + if (!port_is_stopped(res->port_id)) { > + printf("Please stop port %d first\n", res->port_id); > + return; > + } > + > tx_vlan_set(res->port_id, res->vlan_id); > + > + cmd_reconfig_device_queue(res->port_id, 1, 1); > } > > cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = > @@ -3486,7 +3493,14 @@ struct cmd_tx_vlan_set_qinq_result { > { > struct cmd_tx_vlan_set_qinq_result *res = parsed_result; > > + if (!port_is_stopped(res->port_id)) { > + printf("Please stop port %d first\n", res->port_id); > + return; > + } > + > tx_qinq_set(res->port_id, res->vlan_id, res->vlan_id_outer); > + > + cmd_reconfig_device_queue(res->port_id, 1, 1); > } > > cmdline_parse_token_string_t cmd_tx_vlan_set_qinq_tx_vlan = > @@ -3592,7 +3606,14 @@ struct cmd_tx_vlan_reset_result { > { > struct cmd_tx_vlan_reset_result *res = parsed_result; > > + if (!port_is_stopped(res->port_id)) { > + printf("Please stop port %d first\n", res->port_id); > + return; > + } > + > tx_vlan_reset(res->port_id); > + > + cmd_reconfig_device_queue(res->port_id, 1, 1); > } > > cmdline_parse_token_string_t cmd_tx_vlan_reset_tx_vlan = > @@ -3685,11 +3706,16 @@ struct cmd_csum_result { > struct cmd_csum_result *res = parsed_result; > int hw = 0; > uint16_t mask = 0; > + uint64_t csum_offloads = 0; > > if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { > printf("invalid port %d\n", res->port_id); > return; > } > + if (!port_is_stopped(res->port_id)) { > + printf("Please stop port %d first\n", res->port_id); > + return; > + } > > if (!strcmp(res->mode, "set")) { > > @@ -3698,22 +3724,34 @@ struct cmd_csum_result { > > if (!strcmp(res->proto, "ip")) { > mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; > } else if (!strcmp(res->proto, "udp")) { > mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; > } else if (!strcmp(res->proto, "tcp")) { > mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; > } else if (!strcmp(res->proto, "sctp")) { > mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; > } else if (!strcmp(res->proto, "outer-ip")) { > mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; > + csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; > } > > - if (hw) > + if (hw) { > ports[res->port_id].tx_ol_flags |= mask; > - else > + ports[res->port_id].dev_conf.txmode.offloads |= > + csum_offloads; > + } else { > ports[res->port_id].tx_ol_flags &= (~mask); > + ports[res->port_id].dev_conf.txmode.offloads &= > + (~csum_offloads); > + } > } > csum_show(res->port_id); > + > + cmd_reconfig_device_queue(res->port_id, 1, 1); > } > > cmdline_parse_token_string_t cmd_csum_csum = > @@ -3837,15 +3875,24 @@ struct cmd_tso_set_result { > > if (port_id_is_invalid(res->port_id, ENABLED_WARN)) > return; > + if (!port_is_stopped(res->port_id)) { > + printf("Please stop port %d first\n", res->port_id); > + return; > + } > > if (!strcmp(res->mode, "set")) > ports[res->port_id].tso_segsz = res->tso_segsz; > > - if (ports[res->port_id].tso_segsz == 0) > + if (ports[res->port_id].tso_segsz == 0) { > + ports[res->port_id].dev_conf.txmode.offloads &= > + ~DEV_TX_OFFLOAD_TCP_TSO; > printf("TSO for non-tunneled packets is disabled\n"); > - else > + } else { > + ports[res->port_id].dev_conf.txmode.offloads |= > + DEV_TX_OFFLOAD_TCP_TSO; > printf("TSO segment size for non-tunneled packets is %d\n", > ports[res->port_id].tso_segsz); > + } > > /* display warnings if configuration is not supported by the NIC */ > rte_eth_dev_info_get(res->port_id, &dev_info); > @@ -3854,6 +3901,8 @@ struct cmd_tso_set_result { > printf("Warning: TSO enabled but not " > "supported by port %d\n", res->port_id); > } > + > + cmd_reconfig_device_queue(res->port_id, 1, 1); > } > > cmdline_parse_token_string_t cmd_tso_set_tso = > @@ -3939,13 +3988,27 @@ struct cmd_tunnel_tso_set_result { > > if (port_id_is_invalid(res->port_id, ENABLED_WARN)) > return; > + if (!port_is_stopped(res->port_id)) { > + printf("Please stop port %d first\n", res->port_id); > + return; > + } > > if (!strcmp(res->mode, "set")) > ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; > > - if (ports[res->port_id].tunnel_tso_segsz == 0) > + if (ports[res->port_id].tunnel_tso_segsz == 0) { > + ports[res->port_id].dev_conf.txmode.offloads &= > + ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | > + DEV_TX_OFFLOAD_GRE_TNL_TSO | > + DEV_TX_OFFLOAD_IPIP_TNL_TSO | > + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); > printf("TSO for tunneled packets is disabled\n"); > - else { > + } else { > + ports[res->port_id].dev_conf.txmode.offloads |= > + (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | > + DEV_TX_OFFLOAD_GRE_TNL_TSO | > + DEV_TX_OFFLOAD_IPIP_TNL_TSO | > + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); > printf("TSO segment size for tunneled packets is %d\n", > ports[res->port_id].tunnel_tso_segsz); > > @@ -3971,6 +4034,8 @@ struct cmd_tunnel_tso_set_result { > printf("Warning: csum set outer-ip must be set to hw " > "if outer L3 is IPv4; not necessary for IPv6\n"); > } > + > + cmd_reconfig_device_queue(res->port_id, 1, 1); > } > > cmdline_parse_token_string_t cmd_tunnel_tso_set_tso = > @@ -13012,8 +13077,13 @@ struct cmd_macsec_offload_on_result { > > if (port_id_is_invalid(port_id, ENABLED_WARN)) > return; > + if (!port_is_stopped(port_id)) { > + printf("Please stop port %d first\n", port_id); > + return; > + } > > ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; > + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; > #ifdef RTE_LIBRTE_IXGBE_PMD > ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); > #endif > @@ -13022,6 +13092,7 @@ struct cmd_macsec_offload_on_result { > > switch (ret) { > case 0: > + cmd_reconfig_device_queue(port_id, 1, 1); > break; > case -ENODEV: > printf("invalid port_id %d\n", port_id); > @@ -13096,14 +13167,21 @@ struct cmd_macsec_offload_off_result { > > if (port_id_is_invalid(port_id, ENABLED_WARN)) > return; > + if (!port_is_stopped(port_id)) { > + printf("Please stop port %d first\n", port_id); > + return; > + } > > ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; > + ports[port_id].dev_conf.txmode.offloads &= > + ~DEV_TX_OFFLOAD_MACSEC_INSERT; > #ifdef RTE_LIBRTE_IXGBE_PMD > ret = rte_pmd_ixgbe_macsec_disable(port_id); > #endif > > switch (ret) { > case 0: > + cmd_reconfig_device_queue(port_id, 1, 1); > break; > case -ENODEV: > printf("invalid port_id %d\n", port_id); > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 2fdc051..ee7d083 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -616,8 +616,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { > printf("VLAN insert: "); > - if (ports[port_id].tx_ol_flags & > - TESTPMD_TX_OFFLOAD_INSERT_VLAN) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_VLAN_INSERT) > printf("on\n"); > else > printf("off\n"); > @@ -634,8 +634,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) { > printf("Double VLANs insert: "); > - if (ports[port_id].tx_ol_flags & > - TESTPMD_TX_OFFLOAD_INSERT_QINQ) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_QINQ_INSERT) > printf("on\n"); > else > printf("off\n"); > @@ -643,7 +643,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) { > printf("TX IPv4 checksum: "); > - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_IPV4_CKSUM) > printf("on\n"); > else > printf("off\n"); > @@ -651,7 +652,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) { > printf("TX UDP checksum: "); > - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_UDP_CKSUM) > printf("on\n"); > else > printf("off\n"); > @@ -659,7 +661,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) { > printf("TX TCP checksum: "); > - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_TCP_CKSUM) > printf("on\n"); > else > printf("off\n"); > @@ -667,7 +670,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) { > printf("TX SCTP checksum: "); > - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_SCTP_CKSUM) > printf("on\n"); > else > printf("off\n"); > @@ -675,8 +679,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { > printf("TX Outer IPv4 checksum: "); > - if (ports[port_id].tx_ol_flags & > - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) > printf("on\n"); > else > printf("off\n"); > @@ -684,7 +688,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) { > printf("TX TCP segmentation: "); > - if (ports[port_id].tso_segsz != 0) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_TCP_TSO) > printf("on\n"); > else > printf("off\n"); > @@ -692,7 +697,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) { > printf("TX UDP segmentation: "); > - if (ports[port_id].tso_segsz != 0) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_UDP_TSO) > printf("on\n"); > else > printf("off\n"); > @@ -700,7 +706,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) { > printf("TSO for VXLAN tunnel packet: "); > - if (ports[port_id].tunnel_tso_segsz) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_VXLAN_TNL_TSO) > printf("on\n"); > else > printf("off\n"); > @@ -708,7 +715,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) { > printf("TSO for GRE tunnel packet: "); > - if (ports[port_id].tunnel_tso_segsz) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_GRE_TNL_TSO) > printf("on\n"); > else > printf("off\n"); > @@ -716,7 +724,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) { > printf("TSO for IPIP tunnel packet: "); > - if (ports[port_id].tunnel_tso_segsz) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_IPIP_TNL_TSO) > printf("on\n"); > else > printf("off\n"); > @@ -724,7 +733,8 @@ struct rss_type_info { > > if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) { > printf("TSO for GENEVE tunnel packet: "); > - if (ports[port_id].tunnel_tso_segsz) > + if (ports[port_id].dev_conf.txmode.offloads & > + DEV_TX_OFFLOAD_GENEVE_TNL_TSO) > printf("on\n"); > else > printf("off\n"); > @@ -1703,8 +1713,10 @@ struct igb_ring_desc_16_bytes { > tx_conf->tx_thresh.pthresh, > tx_conf->tx_thresh.hthresh, > tx_conf->tx_thresh.wthresh); > - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", > - tx_conf->tx_rs_thresh, tx_conf->txq_flags); > + printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"" > + " - TXQ offloads=0x%"PRIx64"\n", > + tx_conf->tx_rs_thresh, tx_conf->txq_flags, > + tx_conf->offloads); > } > } > > @@ -2782,6 +2794,7 @@ struct igb_ring_desc_16_bytes { > tx_vlan_set(portid_t port_id, uint16_t vlan_id) > { > int vlan_offload; > + > if (port_id_is_invalid(port_id, ENABLED_WARN)) > return; > if (vlan_id_is_invalid(vlan_id)) > @@ -2795,6 +2808,7 @@ struct igb_ring_desc_16_bytes { > > tx_vlan_reset(port_id); > ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; > + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; > ports[port_id].tx_vlan_id = vlan_id; > } > > @@ -2802,6 +2816,7 @@ struct igb_ring_desc_16_bytes { > tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) > { > int vlan_offload; > + > if (port_id_is_invalid(port_id, ENABLED_WARN)) > return; > if (vlan_id_is_invalid(vlan_id)) > @@ -2817,6 +2832,7 @@ struct igb_ring_desc_16_bytes { > > tx_vlan_reset(port_id); > ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; > + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; > ports[port_id].tx_vlan_id = vlan_id; > ports[port_id].tx_vlan_id_outer = vlan_id_outer; > } > @@ -2828,6 +2844,9 @@ struct igb_ring_desc_16_bytes { > return; > ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | > TESTPMD_TX_OFFLOAD_INSERT_QINQ); > + ports[port_id].dev_conf.txmode.offloads &= > + ~(DEV_TX_OFFLOAD_VLAN_INSERT | > + DEV_TX_OFFLOAD_QINQ_INSERT); > ports[port_id].tx_vlan_id = 0; > ports[port_id].tx_vlan_id_outer = 0; > } > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 77154ef..0087438 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -1498,6 +1498,9 @@ static int eth_event_callback(portid_t port_id, > } > if (port->need_reconfig_queues > 0) { > port->need_reconfig_queues = 0; > + port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; > + /* Apply Tx offloads configuration */ > + port->tx_conf.offloads = port->dev_conf.txmode.offloads; FAST_FREE flag got lost during conversion. Per-queue configuration flags are initialized with PMD-specific default values in rxtx_port_config: rxtx_port_config(struct rte_port *port) { port->rx_conf = port->dev_info.default_rxconf; port->tx_conf = port->dev_info.default_txconf; ... but port->dev_conf.txmode is taken from global variable txmode, not from PMD. See in init_config(): /* Apply default Tx configuration for all ports */ port->dev_conf.txmode = tx_mode; port->dev_conf.rxmode = rx_mode; So the configuration will not be consistent, i.e. different flags in tx_queue_setup() and different in dev_configure(). If the intention is to keep defaults from PMD, let's fix this... If not, please apply FAST_FREE flag as in example patch v3, e.g: + rte_eth_dev_info_get(portid, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) + local_port_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MBUF_FAST_FREE; > /* setup tx queues */ > for (qi = 0; qi < nb_txq; qi++) { > if ((numa_support) && ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v2 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2018-01-05 18:11 ` Maciej Czekaj @ 2018-01-07 15:24 ` Shahaf Shuler 0 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-07 15:24 UTC (permalink / raw) To: Maciej Czekaj, ferruh.yigit, jingjing.wu; +Cc: dev Friday, January 5, 2018 8:11 PM, Maciej Czekaj: >If the intention is to keep defaults from PMD, let's fix this... >If not, please apply FAST_FREE flag as in example patch v3, e.g: > >+ rte_eth_dev_info_get(portid, &dev_info); >+ if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) >+ local_port_conf.txmode.offloads |= >+ DEV_TX_OFFLOAD_MBUF_FAST_FREE; Will take care on next version --Shahaf From: Maciej Czekaj [mailto:maciej.czekaj@caviumnetworks.com] Sent: Friday, January 5, 2018 8:11 PM To: Shahaf Shuler <shahafs@mellanox.com>; ferruh.yigit@intel.com; jingjing.wu@intel.com Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v2 04/10] app/testpmd: convert to new Ethdev Tx offloads API -- Oryginal message -- Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") Convert the application to use the new API. This patch mandates the port to be stopped when configure the Tx offloads. This is because the PMD must be aware to the offloads changes on the device and queue configuration. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com><mailto:shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 90 ++++++++++++++++++++++++++++++++++++++++++--- app/test-pmd/config.c | 55 ++++++++++++++++++--------- app/test-pmd/testpmd.c | 3 ++ 3 files changed, 124 insertions(+), 24 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d8c73a9..5812583 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3439,7 +3439,14 @@ struct cmd_tx_vlan_set_result { { struct cmd_tx_vlan_set_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_vlan_set(res->port_id, res->vlan_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = @@ -3486,7 +3493,14 @@ struct cmd_tx_vlan_set_qinq_result { { struct cmd_tx_vlan_set_qinq_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_qinq_set(res->port_id, res->vlan_id, res->vlan_id_outer); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_qinq_tx_vlan = @@ -3592,7 +3606,14 @@ struct cmd_tx_vlan_reset_result { { struct cmd_tx_vlan_reset_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_vlan_reset(res->port_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_reset_tx_vlan = @@ -3685,11 +3706,16 @@ struct cmd_csum_result { struct cmd_csum_result *res = parsed_result; int hw = 0; uint16_t mask = 0; + uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); return; } + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) { @@ -3698,22 +3724,34 @@ struct cmd_csum_result { if (!strcmp(res->proto, "ip")) { mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } - if (hw) + if (hw) { ports[res->port_id].tx_ol_flags |= mask; - else + ports[res->port_id].dev_conf.txmode.offloads |= + csum_offloads; + } else { ports[res->port_id].tx_ol_flags &= (~mask); + ports[res->port_id].dev_conf.txmode.offloads &= + (~csum_offloads); + } } csum_show(res->port_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_csum_csum = @@ -3837,15 +3875,24 @@ struct cmd_tso_set_result { if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; - if (ports[res->port_id].tso_segsz == 0) + if (ports[res->port_id].tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_TCP_TSO; printf("TSO for non-tunneled packets is disabled\n"); - else + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_TCP_TSO; printf("TSO segment size for non-tunneled packets is %d\n", ports[res->port_id].tso_segsz); + } /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(res->port_id, &dev_info); @@ -3854,6 +3901,8 @@ struct cmd_tso_set_result { printf("Warning: TSO enabled but not " "supported by port %d\n", res->port_id); } + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tso_set_tso = @@ -3939,13 +3988,27 @@ struct cmd_tunnel_tso_set_result { if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - if (ports[res->port_id].tunnel_tso_segsz == 0) + if (ports[res->port_id].tunnel_tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); - else { + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3971,6 +4034,8 @@ struct cmd_tunnel_tso_set_result { printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tunnel_tso_set_tso = @@ -13012,8 +13077,13 @@ struct cmd_macsec_offload_on_result { if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!port_is_stopped(port_id)) { + printf("Please stop port %d first\n", port_id); + return; + } ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif @@ -13022,6 +13092,7 @@ struct cmd_macsec_offload_on_result { switch (ret) { case 0: + cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); @@ -13096,14 +13167,21 @@ struct cmd_macsec_offload_off_result { if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!port_is_stopped(port_id)) { + printf("Please stop port %d first\n", port_id); + return; + } ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif switch (ret) { case 0: + cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 2fdc051..ee7d083 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -616,8 +616,8 @@ struct rss_type_info { if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { printf("VLAN insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VLAN_INSERT) printf("on\n"); else printf("off\n");<mailto:);@@-634,8+634,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_QINQ_INSERT)%7bprintf(> @@ -634,8 +634,8 @@ struct rss_type_info {<mailto:);@@-634,8+634,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_QINQ_INSERT)%7bprintf(> <mailto:);@@-634,8+634,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_QINQ_INSERT)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) {<mailto:);@@-634,8+634,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_QINQ_INSERT)%7bprintf(> printf("<mailto:);@@-634,8+634,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_QINQ_INSERT)%7bprintf(>Double VLANs insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_QINQ_INSERT) printf("on\n"); else printf("off\n");<mailto:);@@-643,7+643,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPV4_CKSUM)%7bprintf(> @@ -643,7 +643,8 @@ struct rss_type_info {<mailto:);@@-643,7+643,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPV4_CKSUM)%7bprintf(> <mailto:);@@-643,7+643,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPV4_CKSUM)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) {<mailto:);@@-643,7+643,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPV4_CKSUM)%7bprintf(> printf("<mailto:);@@-643,7+643,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPV4_CKSUM)%7bprintf(>TX IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n");<mailto:);@@-651,7+652,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_CKSUM)%7bprintf(> @@ -651,7 +652,8 @@ struct rss_type_info {<mailto:);@@-651,7+652,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_CKSUM)%7bprintf(> <mailto:);@@-651,7+652,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_CKSUM)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) {<mailto:);@@-651,7+652,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_CKSUM)%7bprintf(> printf("<mailto:);@@-651,7+652,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_CKSUM)%7bprintf(>TX UDP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n");<mailto:);@@-659,7+661,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_CKSUM)%7bprintf(> @@ -659,7 +661,8 @@ struct rss_type_info {<mailto:);@@-659,7+661,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_CKSUM)%7bprintf(> <mailto:);@@-659,7+661,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_CKSUM)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) {<mailto:);@@-659,7+661,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_CKSUM)%7bprintf(> printf("<mailto:);@@-659,7+661,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_CKSUM)%7bprintf(>TX TCP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n");<mailto:);@@-667,7+670,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_SCTP_CKSUM)%7bprintf(> @@ -667,7 +670,8 @@ struct rss_type_info {<mailto:);@@-667,7+670,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_SCTP_CKSUM)%7bprintf(> <mailto:);@@-667,7+670,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_SCTP_CKSUM)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) {<mailto:);@@-667,7+670,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_SCTP_CKSUM)%7bprintf(> printf("<mailto:);@@-667,7+670,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_SCTP_CKSUM)%7bprintf(>TX SCTP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_SCTP_CKSUM) printf("on\n"); else printf("off\n");<mailto:);@@-675,8+679,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)%7bprintf(> @@ -675,8 +679,8 @@ struct rss_type_info {<mailto:);@@-675,8+679,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)%7bprintf(> <mailto:);@@-675,8+679,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) {<mailto:);@@-675,8+679,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)%7bprintf(> printf("<mailto:);@@-675,8+679,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)%7bprintf(>TX Outer IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) printf("on\n"); else printf("off\n");<mailto:);@@-684,7+688,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_TSO)%7bprintf(> @@ -684,7 +688,8 @@ struct rss_type_info {<mailto:);@@-684,7+688,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_TSO)%7bprintf(> <mailto:);@@-684,7+688,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_TSO)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) {<mailto:);@@-684,7+688,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_TSO)%7bprintf(> printf("<mailto:);@@-684,7+688,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_TCP_TSO)%7bprintf(>TX TCP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_TSO) printf("on\n"); else printf("off\n");<mailto:);@@-692,7+697,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_TSO)%7bprintf(> @@ -692,7 +697,8 @@ struct rss_type_info {<mailto:);@@-692,7+697,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_TSO)%7bprintf(> <mailto:);@@-692,7+697,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_TSO)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) {<mailto:);@@-692,7+697,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_TSO)%7bprintf(> printf("<mailto:);@@-692,7+697,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_UDP_TSO)%7bprintf(>TX UDP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_TSO) printf("on\n"); else printf("off\n");<mailto:);@@-700,7+706,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_VXLAN_TNL_TSO)%7bprintf(> @@ -700,7 +706,8 @@ struct rss_type_info {<mailto:);@@-700,7+706,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_VXLAN_TNL_TSO)%7bprintf(> <mailto:);@@-700,7+706,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_VXLAN_TNL_TSO)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) {<mailto:);@@-700,7+706,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_VXLAN_TNL_TSO)%7bprintf(> printf("<mailto:);@@-700,7+706,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_VXLAN_TNL_TSO)%7bprintf(>TSO for VXLAN tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VXLAN_TNL_TSO) printf("on\n"); else printf("off\n");<mailto:);@@-708,7+715,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GRE_TNL_TSO)%7bprintf(> @@ -708,7 +715,8 @@ struct rss_type_info {<mailto:);@@-708,7+715,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GRE_TNL_TSO)%7bprintf(> <mailto:);@@-708,7+715,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GRE_TNL_TSO)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) {<mailto:);@@-708,7+715,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GRE_TNL_TSO)%7bprintf(> printf("<mailto:);@@-708,7+715,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GRE_TNL_TSO)%7bprintf(>TSO for GRE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GRE_TNL_TSO) printf("on\n"); else printf("off\n");<mailto:);@@-716,7+724,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPIP_TNL_TSO)%7bprintf(> @@ -716,7 +724,8 @@ struct rss_type_info {<mailto:);@@-716,7+724,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPIP_TNL_TSO)%7bprintf(> <mailto:);@@-716,7+724,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPIP_TNL_TSO)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) {<mailto:);@@-716,7+724,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPIP_TNL_TSO)%7bprintf(> printf("<mailto:);@@-716,7+724,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_IPIP_TNL_TSO)%7bprintf(>TSO for IPIP tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPIP_TNL_TSO) printf("on\n"); else printf("off\n");<mailto:);@@-724,7+733,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GENEVE_TNL_TSO)%7bprintf(> @@ -724,7 +733,8 @@ struct rss_type_info {<mailto:);@@-724,7+733,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GENEVE_TNL_TSO)%7bprintf(> <mailto:);@@-724,7+733,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GENEVE_TNL_TSO)%7bprintf(> if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) {<mailto:);@@-724,7+733,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GENEVE_TNL_TSO)%7bprintf(> printf("<mailto:);@@-724,7+733,8@@structrss_type_info%7bif(dev_info.tx_offload_capa&DEV_TX_OFFLOAD_GENEVE_TNL_TSO)%7bprintf(>TSO for GENEVE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GENEVE_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -1703,8 +1713,10 @@ struct igb_ring_desc_16_bytes { tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"" + " - TXQ offloads=0x%"PRIx64"\n", + tx_conf->tx_rs_thresh, tx_conf->txq_flags, + tx_conf->offloads); } } @@ -2782,6 +2794,7 @@ struct igb_ring_desc_16_bytes { tx_vlan_set(portid_t port_id, uint16_t vlan_id) { int vlan_offload; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2795,6 +2808,7 @@ struct igb_ring_desc_16_bytes { tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; } @@ -2802,6 +2816,7 @@ struct igb_ring_desc_16_bytes { tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) { int vlan_offload; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2817,6 +2832,7 @@ struct igb_ring_desc_16_bytes { tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; } @@ -2828,6 +2844,9 @@ struct igb_ring_desc_16_bytes { return; ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | TESTPMD_TX_OFFLOAD_INSERT_QINQ); + ports[port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_QINQ_INSERT); ports[port_id].tx_vlan_id = 0; ports[port_id].tx_vlan_id_outer = 0; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 77154ef..0087438 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1498,6 +1498,9 @@ static int eth_event_callback(portid_t port_id, } if (port->need_reconfig_queues > 0) { port->need_reconfig_queues = 0; + port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + /* Apply Tx offloads configuration */ + port->tx_conf.offloads = port->dev_conf.txmode.offloads; FAST_FREE flag got lost during conversion. Per-queue configuration flags are initialized with PMD-specific default values in rxtx_port_config: rxtx_port_config(struct rte_port *port) { port->rx_conf = port->dev_info.default_rxconf; port->tx_conf = port->dev_info.default_txconf; ... but port->dev_conf.txmode is taken from global variable txmode, not from PMD. See in init_config(): /* Apply default Tx configuration for all ports */ port->dev_conf.txmode = tx_mode; port->dev_conf.rxmode = rx_mode; So the configuration will not be consistent, i.e. different flags in tx_queue_setup() and different in dev_configure(). If the intention is to keep defaults from PMD, let's fix this... If not, please apply FAST_FREE flag as in example patch v3, e.g: + rte_eth_dev_info_get(portid, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) + local_port_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MBUF_FAST_FREE; /* setup tx queues */ for (qi = 0; qi < nb_txq; qi++) { if ((numa_support) && ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 05/10] app/testpmd: fix flowgen forwarding ol flags 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (3 preceding siblings ...) 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2018-01-09 5:32 ` Lu, Wenzhuo 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 06/10] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler ` (5 subsequent siblings) 10 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev, cchemparathy, stable The mbuf ol_flags were taken directly from testpmd internal enumeration leading to incorrect values. addressing only insertion offload flags as the checksum flags by the application design are only with csum forwarding. Fixes: e9e23a617eb8 ("app/testpmd: add flowgen forwarding engine") Cc: cchemparathy@tilera.com Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/flowgen.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index acf9af9..46478fc 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -123,7 +123,7 @@ struct ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; - uint16_t ol_flags; + uint64_t ol_flags; uint16_t nb_rx; uint16_t nb_tx; uint16_t nb_pkt; @@ -151,7 +151,13 @@ mbp = current_fwd_lcore()->mbp; vlan_tci = ports[fs->tx_port].tx_vlan_id; vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer; - ol_flags = ports[fs->tx_port].tx_ol_flags; + + if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + ol_flags = PKT_TX_VLAN_PKT; + if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + ol_flags |= PKT_TX_QINQ_PKT; + if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v2 05/10] app/testpmd: fix flowgen forwarding ol flags 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler @ 2018-01-09 5:32 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 5:32 UTC (permalink / raw) To: Shahaf Shuler, Yigit, Ferruh, Wu, Jingjing; +Cc: dev, cchemparathy, stable Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 12, 2017 8:53 PM > To: Yigit, Ferruh <ferruh.yigit@intel.com>; Wu, Jingjing > <jingjing.wu@intel.com> > Cc: dev@dpdk.org; cchemparathy@tilera.com; stable@dpdk.org > Subject: [dpdk-dev] [PATCH v2 05/10] app/testpmd: fix flowgen forwarding ol > flags > > The mbuf ol_flags were taken directly from testpmd internal enumeration > leading to incorrect values. > > addressing only insertion offload flags as the checksum flags by the > application design are only with csum forwarding. > > Fixes: e9e23a617eb8 ("app/testpmd: add flowgen forwarding engine") > Cc: cchemparathy@tilera.com > Cc: stable@dpdk.org > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 06/10] app/testpmd: cleanup internal Tx offloads flags field 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (4 preceding siblings ...) 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 07/10] app/testpmd: add command line option for Tx offloads Shahaf Shuler ` (4 subsequent siblings) 10 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev The tx_ol_flags field was used in order to control the different Tx offloads set. After the conversion to the new Ethdev Tx offloads API it is not needed anymore as the offloads configuration is stored in ethdev structs. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 49 ++++++++++++++++---------------------------- app/test-pmd/config.c | 4 ---- app/test-pmd/csumonly.c | 40 ++++++++++++++++++------------------ app/test-pmd/flowgen.c | 8 +++++--- app/test-pmd/macfwd.c | 8 +++++--- app/test-pmd/macswap.c | 8 +++++--- app/test-pmd/testpmd.h | 22 +------------------- app/test-pmd/txonly.c | 8 +++++--- 8 files changed, 59 insertions(+), 88 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 5812583..8584821 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3653,45 +3653,45 @@ struct cmd_csum_result { csum_show(int port_id) { struct rte_eth_dev_info dev_info; - uint16_t ol_flags; + uint64_t tx_offloads; - ol_flags = ports[port_id].tx_ol_flags; + tx_offloads = ports[port_id].dev_conf.txmode.offloads; printf("Parse tunnel is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) ? "on" : "off"); + (ports[port_id].parse_tunnel) ? "on" : "off"); printf("IP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ? "hw" : "sw"); printf("UDP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); printf("TCP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); printf("SCTP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); printf("Outer-Ip checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ? "hw" : "sw"); /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(port_id, &dev_info); - if ((ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) { printf("Warning: hardware IP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) { printf("Warning: hardware UDP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) { printf("Warning: hardware TCP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) == 0) { printf("Warning: hardware SCTP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) == 0) { printf("Warning: hardware outer IP checksum enabled but not " "supported by port %d\n", port_id); @@ -3705,7 +3705,6 @@ struct cmd_csum_result { { struct cmd_csum_result *res = parsed_result; int hw = 0; - uint16_t mask = 0; uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { @@ -3723,28 +3722,21 @@ struct cmd_csum_result { hw = 1; if (!strcmp(res->proto, "ip")) { - mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { - mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { - mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { - mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { - mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } if (hw) { - ports[res->port_id].tx_ol_flags |= mask; ports[res->port_id].dev_conf.txmode.offloads |= csum_offloads; } else { - ports[res->port_id].tx_ol_flags &= (~mask); ports[res->port_id].dev_conf.txmode.offloads &= (~csum_offloads); } @@ -3821,11 +3813,9 @@ struct cmd_csum_tunnel_result { return; if (!strcmp(res->onoff, "on")) - ports[res->port_id].tx_ol_flags |= - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL; + ports[res->port_id].parse_tunnel = 1; else - ports[res->port_id].tx_ol_flags &= - (~TESTPMD_TX_OFFLOAD_PARSE_TUNNEL); + ports[res->port_id].parse_tunnel = 0; csum_show(res->port_id); } @@ -4025,12 +4015,11 @@ struct cmd_tunnel_tso_set_result { */ check_tunnel_tso_nic_support(res->port_id); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL)) + if (!ports[res->port_id].parse_tunnel) printf("Warning: csum parse_tunnel must be set " "so that tunneled packets are recognized\n"); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)) + if (!(ports[res->port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)) printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } @@ -13082,7 +13071,6 @@ struct cmd_macsec_offload_on_result { return; } - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); @@ -13172,7 +13160,6 @@ struct cmd_macsec_offload_off_result { return; } - ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ee7d083..57d73aa 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2807,7 +2807,6 @@ struct igb_ring_desc_16_bytes { } tx_vlan_reset(port_id); - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; } @@ -2831,7 +2830,6 @@ struct igb_ring_desc_16_bytes { } tx_vlan_reset(port_id); - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; @@ -2842,8 +2840,6 @@ struct igb_ring_desc_16_bytes { { if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | - TESTPMD_TX_OFFLOAD_INSERT_QINQ); ports[port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT); diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index aa29f5f..dbd2f98 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -316,7 +316,7 @@ struct simple_gre_hdr { * depending on the testpmd command line configuration */ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags) + uint64_t tx_offloads) { struct ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; @@ -347,7 +347,7 @@ struct simple_gre_hdr { if (info->l4_proto == IPPROTO_TCP && tso_segsz) { ol_flags |= PKT_TX_IP_CKSUM; } else { - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ol_flags |= PKT_TX_IP_CKSUM; else ipv4_hdr->hdr_checksum = @@ -363,7 +363,7 @@ struct simple_gre_hdr { /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ol_flags |= PKT_TX_UDP_CKSUM; else { udp_hdr->dgram_cksum = @@ -376,7 +376,7 @@ struct simple_gre_hdr { tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; - else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ol_flags |= PKT_TX_TCP_CKSUM; else { tcp_hdr->cksum = @@ -390,7 +390,7 @@ struct simple_gre_hdr { sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ - if ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && ((ipv4_hdr->total_length & 0x3) == 0)) { ol_flags |= PKT_TX_SCTP_CKSUM; } else { @@ -405,7 +405,7 @@ struct simple_gre_hdr { /* Calculate the checksum of outer header */ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags, int tso_enabled) + uint64_t tx_offloads, int tso_enabled) { struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; @@ -416,7 +416,7 @@ struct simple_gre_hdr { ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_OUTER_IPV4; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ol_flags |= PKT_TX_OUTER_IP_CKSUM; else ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); @@ -646,7 +646,7 @@ struct simple_gre_hdr { uint16_t nb_prep; uint16_t i; uint64_t rx_ol_flags, tx_ol_flags; - uint16_t testpmd_ol_flags; + uint64_t tx_offloads; uint32_t retry; uint32_t rx_bad_ip_csum; uint32_t rx_bad_l4_csum; @@ -678,7 +678,7 @@ struct simple_gre_hdr { gro_enable = gro_ports[fs->rx_port].enable; txp = &ports[fs->tx_port]; - testpmd_ol_flags = txp->tx_ol_flags; + tx_offloads = txp->dev_conf.txmode.offloads; memset(&info, 0, sizeof(info)); info.tso_segsz = txp->tso_segsz; info.tunnel_tso_segsz = txp->tunnel_tso_segsz; @@ -714,7 +714,7 @@ struct simple_gre_hdr { l3_hdr = (char *)eth_hdr + info.l2_len; /* check if it's a supported tunnel */ - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) { + if (txp->parse_tunnel) { if (info.l4_proto == IPPROTO_UDP) { struct udp_hdr *udp_hdr; @@ -754,14 +754,14 @@ struct simple_gre_hdr { /* process checksums of inner headers first */ tx_ol_flags |= process_inner_cksums(l3_hdr, &info, - testpmd_ol_flags); + tx_offloads); /* Then process outer headers if any. Note that the software * checksum will be wrong if one of the inner checksums is * processed in hardware. */ if (info.is_tunnel == 1) { tx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info, - testpmd_ol_flags, + tx_offloads, !!(tx_ol_flags & PKT_TX_TCP_SEG)); } @@ -769,8 +769,8 @@ struct simple_gre_hdr { if (info.is_tunnel == 1) { if (info.tunnel_tso_segsz || - (testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + (tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) { m->outer_l2_len = info.outer_l2_len; m->outer_l3_len = info.outer_l3_len; @@ -832,17 +832,17 @@ struct simple_gre_hdr { rte_be_to_cpu_16(info.outer_ethertype), info.outer_l3_len); /* dump tx packet info */ - if ((testpmd_ol_flags & (TESTPMD_TX_OFFLOAD_IP_CKSUM | - TESTPMD_TX_OFFLOAD_UDP_CKSUM | - TESTPMD_TX_OFFLOAD_TCP_CKSUM | - TESTPMD_TX_OFFLOAD_SCTP_CKSUM)) || + if ((tx_offloads & (DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_SCTP_CKSUM)) || info.tso_segsz != 0) printf("tx: m->l2_len=%d m->l3_len=%d " "m->l4_len=%d\n", m->l2_len, m->l3_len, m->l4_len); if (info.is_tunnel == 1) { - if ((testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + if ((tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) printf("tx: m->outer_l2_len=%d " "m->outer_l3_len=%d\n", diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 46478fc..0531b5d 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -129,6 +129,7 @@ uint16_t nb_pkt; uint16_t i; uint32_t retry; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -152,11 +153,12 @@ vlan_tci = ports[fs->tx_port].tx_vlan_id; vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = ports[fs->tx_port].dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f4a4bf2..56ee3cc 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -84,6 +84,7 @@ uint16_t nb_tx; uint16_t i; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 721865c..e2cc481 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -84,6 +84,7 @@ uint16_t i; uint32_t retry; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index ab74d39..c6baa10 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -138,26 +138,6 @@ struct fwd_stream { #endif }; -/** Offload IP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_IP_CKSUM 0x0001 -/** Offload UDP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_UDP_CKSUM 0x0002 -/** Offload TCP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_TCP_CKSUM 0x0004 -/** Offload SCTP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_SCTP_CKSUM 0x0008 -/** Offload outer IP checksum in csum forward engine for recognized tunnels */ -#define TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM 0x0010 -/** Parse tunnel in csum forward engine. If set, dissect tunnel headers - * of rx packets. If not set, treat inner headers as payload. */ -#define TESTPMD_TX_OFFLOAD_PARSE_TUNNEL 0x0020 -/** Insert VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_VLAN 0x0040 -/** Insert double VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_QINQ 0x0080 -/** Offload MACsec in forward engine */ -#define TESTPMD_TX_OFFLOAD_MACSEC 0x0100 - /** Descriptor for a single flow. */ struct port_flow { size_t size; /**< Allocated space including data[]. */ @@ -215,7 +195,7 @@ struct rte_port { struct fwd_stream *rx_stream; /**< Port RX stream, if unique */ struct fwd_stream *tx_stream; /**< Port TX stream, if unique */ unsigned int socket_id; /**< For NUMA support */ - uint16_t tx_ol_flags;/**< TX Offload Flags (TESTPMD_TX_OFFLOAD...). */ + uint16_t parse_tunnel:1; /**< Parse internal headers */ uint16_t tso_segsz; /**< Segmentation offload MSS for non-tunneled packets. */ uint16_t tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */ uint16_t tx_vlan_id;/**< The tag ID */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 309c738..418901c 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -193,6 +193,7 @@ uint32_t retry; uint64_t ol_flags = 0; uint8_t i; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -206,13 +207,14 @@ mbp = current_fwd_lcore()->mbp; txp = &ports[fs->tx_port]; + tx_offloads = txp->dev_conf.txmode.offloads; vlan_tci = txp->tx_vlan_id; vlan_tci_outer = txp->tx_vlan_id_outer; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 07/10] app/testpmd: add command line option for Tx offloads 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (5 preceding siblings ...) 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 06/10] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 08/10] app/testpmd: remove txqflags Shahaf Shuler ` (3 subsequent siblings) 10 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev This patch adds command line option to set hex value for the ports Tx offloads flags. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/parameters.c | 17 +++++++++++++++-- app/test-pmd/testpmd.c | 4 ++++ app/test-pmd/testpmd.h | 2 ++ doc/guides/testpmd_app_ug/run_app.rst | 5 +++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 263651c..5888942 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -99,7 +99,7 @@ "--rss-ip | --rss-udp | " "--rxpt= | --rxht= | --rxwt= | --rxfreet= | " "--txpt= | --txht= | --txwt= | --txfreet= | " - "--txrst= | --txqflags= ]\n", + "--txrst= | --txqflags= | --tx-offloads ]\n", progname); #ifdef RTE_LIBRTE_CMDLINE printf(" --interactive: run in interactive mode.\n"); @@ -216,6 +216,7 @@ "disable print of designated event or all of them.\n"); printf(" --flow-isolate-all: " "requests flow API isolated mode on all ports at initialization time.\n"); + printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n"); } #ifdef RTE_LIBRTE_CMDLINE @@ -566,8 +567,9 @@ char **argvopt; int opt_idx; enum { TX, RX }; - /* Default Rx offloads for all ports. */ + /* Default offloads for all ports. */ uint64_t rx_offloads = rx_mode.offloads; + uint64_t tx_offloads = tx_mode.offloads; static struct option lgopts[] = { { "help", 0, 0, 0 }, @@ -645,6 +647,7 @@ { "no-rmv-interrupt", 0, 0, 0 }, { "print-event", 1, 0, 0 }, { "mask-event", 1, 0, 0 }, + { "tx-offloads", 1, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1116,6 +1119,15 @@ rmv_interrupt = 0; if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all")) flow_isolate_all = 1; + if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) { + char *end = NULL; + n = strtoull(optarg, &end, 16); + if (n >= 0) + tx_offloads = (uint64_t)n; + else + rte_exit(EXIT_FAILURE, + "tx-offloads must be >= 0\n"); + } if (!strcmp(lgopts[opt_idx].name, "print-event")) if (parse_event_printing_config(optarg, 1)) { rte_exit(EXIT_FAILURE, @@ -1142,4 +1154,5 @@ /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; + tx_mode.offloads = tx_offloads; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 0087438..8065481 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -344,6 +344,8 @@ struct rte_eth_rxmode rx_mode = { .ignore_offload_bitfield = 1, }; +struct rte_eth_txmode tx_mode; + struct rte_fdir_conf fdir_conf = { .mode = RTE_FDIR_MODE_NONE, .pballoc = RTE_FDIR_PBALLOC_64K, @@ -604,6 +606,8 @@ static int eth_event_callback(portid_t port_id, RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; + /* Apply default Tx configuration for all ports */ + port->dev_conf.txmode = tx_mode; rte_eth_dev_info_get(pid, &port->dev_info); if (numa_support) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index c6baa10..3e63edf 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -395,6 +395,8 @@ struct queue_stats_mappings { extern struct rte_port *ports; extern struct rte_eth_rxmode rx_mode; +extern struct rte_eth_txmode tx_mode; + extern uint64_t rss_hf; extern queueid_t nb_rxq; diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 4c0d2ce..fface6f 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -509,3 +509,8 @@ The commandline options are: configured flow rules only (see flow command). Ports that do not support this mode are automatically discarded. + +* ``--tx-offloads=0xXXXXXXXX`` + + Set the hexadecimal bitmask of TX queue offloads. + The default value is 0. -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 08/10] app/testpmd: remove txqflags 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (6 preceding siblings ...) 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 07/10] app/testpmd: add command line option for Tx offloads Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 09/10] app/testpmd: enforce offloads caps Shahaf Shuler ` (2 subsequent siblings) 10 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev Since testpmd is now using the new Ethdev offloads API and there is a way configure each of the tx offloads from CLI or command line, there is no need for the txqflags configuration anymore. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> --- app/test-pmd/cmdline.c | 69 ------------------------ app/test-pmd/config.c | 7 +-- app/test-pmd/parameters.c | 14 +---- app/test-pmd/testpmd.c | 8 --- app/test-pmd/testpmd.h | 1 - doc/guides/testpmd_app_ug/run_app.rst | 12 ----- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ---- 7 files changed, 3 insertions(+), 119 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 8584821..b4ef1d0 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3092,74 +3092,6 @@ struct cmd_set_txsplit_result { }, }; -/* *** CONFIG TX QUEUE FLAGS *** */ - -struct cmd_config_txqflags_result { - cmdline_fixed_string_t port; - cmdline_fixed_string_t config; - cmdline_fixed_string_t all; - cmdline_fixed_string_t what; - int32_t hexvalue; -}; - -static void cmd_config_txqflags_parsed(void *parsed_result, - __attribute__((unused)) struct cmdline *cl, - __attribute__((unused)) void *data) -{ - struct cmd_config_txqflags_result *res = parsed_result; - - if (!all_ports_stopped()) { - printf("Please stop all ports first\n"); - return; - } - - if (strcmp(res->what, "txqflags")) { - printf("Unknown parameter\n"); - return; - } - - if (res->hexvalue >= 0) { - txq_flags = res->hexvalue; - } else { - printf("txqflags must be >= 0\n"); - return; - } - - init_port_config(); - - cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); -} - -cmdline_parse_token_string_t cmd_config_txqflags_port = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, port, - "port"); -cmdline_parse_token_string_t cmd_config_txqflags_config = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, config, - "config"); -cmdline_parse_token_string_t cmd_config_txqflags_all = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, all, - "all"); -cmdline_parse_token_string_t cmd_config_txqflags_what = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, what, - "txqflags"); -cmdline_parse_token_num_t cmd_config_txqflags_value = - TOKEN_NUM_INITIALIZER(struct cmd_config_txqflags_result, - hexvalue, INT32); - -cmdline_parse_inst_t cmd_config_txqflags = { - .f = cmd_config_txqflags_parsed, - .data = NULL, - .help_str = "port config all txqflags <value>", - .tokens = { - (void *)&cmd_config_txqflags_port, - (void *)&cmd_config_txqflags_config, - (void *)&cmd_config_txqflags_all, - (void *)&cmd_config_txqflags_what, - (void *)&cmd_config_txqflags_value, - NULL, - }, -}; - /* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */ struct cmd_rx_vlan_filter_all_result { cmdline_fixed_string_t rx_vlan; @@ -15709,7 +15641,6 @@ struct cmd_cmdfile_result { (cmdline_parse_inst_t *)&cmd_config_rx_mode_flag, (cmdline_parse_inst_t *)&cmd_config_rss, (cmdline_parse_inst_t *)&cmd_config_rxtx_queue, - (cmdline_parse_inst_t *)&cmd_config_txqflags, (cmdline_parse_inst_t *)&cmd_config_rss_reta, (cmdline_parse_inst_t *)&cmd_showport_reta, (cmdline_parse_inst_t *)&cmd_config_burst, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 57d73aa..41855ab 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -417,7 +417,6 @@ struct rss_type_info { printf("\nTX writeback threshold: %hhu", qinfo.conf.tx_thresh.wthresh); printf("\nTX RS threshold: %hu", qinfo.conf.tx_rs_thresh); printf("\nTX free threshold: %hu", qinfo.conf.tx_free_thresh); - printf("\nTX flags: %#x", qinfo.conf.txq_flags); printf("\nTX deferred start: %s", (qinfo.conf.tx_deferred_start != 0) ? "on" : "off"); printf("\nNumber of TXDs: %hu", qinfo.nb_desc); @@ -1713,10 +1712,8 @@ struct igb_ring_desc_16_bytes { tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"" - " - TXQ offloads=0x%"PRIx64"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags, - tx_conf->offloads); + printf(" TX RS bit threshold=%d - TXQ offloads=0x%"PRIx64"\n", + tx_conf->tx_rs_thresh, tx_conf->offloads); } } diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 5888942..fa547df 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -99,7 +99,7 @@ "--rss-ip | --rss-udp | " "--rxpt= | --rxht= | --rxwt= | --rxfreet= | " "--txpt= | --txht= | --txwt= | --txfreet= | " - "--txrst= | --txqflags= | --tx-offloads ]\n", + "--txrst= | --tx-offloads ]\n", progname); #ifdef RTE_LIBRTE_CMDLINE printf(" --interactive: run in interactive mode.\n"); @@ -192,8 +192,6 @@ "(0 <= N <= value of txd).\n"); printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N " "(0 <= N <= value of txd).\n"); - printf(" --txqflags=0xXXXXXXXX: hexadecimal bitmask of TX queue flags " - "(0 <= N <= 0x7FFFFFFF).\n"); printf(" --tx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: " "tx queues statistics counters mapping " "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); @@ -632,7 +630,6 @@ { "txwt", 1, 0, 0 }, { "txfreet", 1, 0, 0 }, { "txrst", 1, 0, 0 }, - { "txqflags", 1, 0, 0 }, { "rxpt", 1, 0, 0 }, { "rxht", 1, 0, 0 }, { "rxwt", 1, 0, 0 }, @@ -1006,15 +1003,6 @@ else rte_exit(EXIT_FAILURE, "txrst must be >= 0\n"); } - if (!strcmp(lgopts[opt_idx].name, "txqflags")) { - char *end = NULL; - n = strtoul(optarg, &end, 16); - if (n >= 0) - txq_flags = (int32_t)n; - else - rte_exit(EXIT_FAILURE, - "txqflags must be >= 0\n"); - } if (!strcmp(lgopts[opt_idx].name, "rxd")) { n = atoi(optarg); if (n > 0) { diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 8065481..91dcb31 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -259,11 +259,6 @@ struct fwd_engine * fwd_engines[] = { int16_t tx_rs_thresh = RTE_PMD_PARAM_UNSET; /* - * Configurable value of TX queue flags. - */ -int32_t txq_flags = RTE_PMD_PARAM_UNSET; - -/* * Receive Side Scaling (RSS) configuration. */ uint64_t rss_hf = ETH_RSS_IP; /* RSS IP by default. */ @@ -2084,9 +2079,6 @@ struct pmd_test_command { if (tx_free_thresh != RTE_PMD_PARAM_UNSET) port->tx_conf.tx_free_thresh = tx_free_thresh; - - if (txq_flags != RTE_PMD_PARAM_UNSET) - port->tx_conf.txq_flags = txq_flags; } void diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 3e63edf..c9af41c 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -409,7 +409,6 @@ struct queue_stats_mappings { extern int8_t rx_drop_en; extern int16_t tx_free_thresh; extern int16_t tx_rs_thresh; -extern int32_t txq_flags; extern uint8_t dcb_config; extern uint8_t dcb_test; diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index fface6f..be9a2cd 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -447,18 +447,6 @@ The commandline options are: Set the transmit RS bit threshold of TX rings to N, where 0 <= N <= value of ``--txd``. The default value is 0. -* ``--txqflags=0xXXXXXXXX`` - - Set the hexadecimal bitmask of TX queue flags, where 0 <= N <= 0x7FFFFFFF. - The default value is 0. - - .. note:: - - When using hardware offload functions such as vlan or checksum - add ``txqflags=0`` to force the full-featured TX code path. - In some PMDs this may already be the default. - - * ``--rx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping)]`` Set the RX queues statistics counters mapping 0 <= mapping <= 15. diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 9789139..8e73519 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -354,8 +354,6 @@ The available information categories are: also modify the default hierarchy or specify the new hierarchy through CLI for implementing QoS scheduler. Requires ``CONFIG_RTE_LIBRTE_PMD_SOFTNIC=y`` ``CONFIG_RTE_LIBRTE_SCHED=y``. -Note: TX timestamping is only available in the "Full Featured" TX path. To force ``testpmd`` into this mode set ``--txqflags=0``. - Example:: testpmd> set fwd rxonly @@ -1681,15 +1679,6 @@ RX scatter mode is off by default. The ``on`` option is equivalent to the ``--enable-scatter`` command-line option. -port config - TX queue flags -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Set a hexadecimal bitmap of TX queue flags for all ports:: - - testpmd> port config all txqflags value - -This command is equivalent to the ``--txqflags`` command-line option. - port config - RX Checksum ~~~~~~~~~~~~~~~~~~~~~~~~~ -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 09/10] app/testpmd: enforce offloads caps 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (7 preceding siblings ...) 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 08/10] app/testpmd: remove txqflags Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 10/10] app/testpmd: fix on the flight VLAN configuration Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler 10 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev In the current design it was possible for offload to be set even though the device is not supporting it. A warning message was printed instead. This is a wrong behaviour, as application should set only the offloads reported by the capabilities of the device. This patch adds verification for the offloads being set and make sure the offload configuration passed to the device always match its capabilities. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 103 +++++++++++++++++++++++++++++++++----------- app/test-pmd/config.c | 14 ++++++ app/test-pmd/testpmd.c | 25 +++++++++++ 3 files changed, 117 insertions(+), 25 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b4ef1d0..d1b8dab 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3638,6 +3638,7 @@ struct cmd_csum_result { struct cmd_csum_result *res = parsed_result; int hw = 0; uint64_t csum_offloads = 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); @@ -3648,21 +3649,53 @@ struct cmd_csum_result { return; } + rte_eth_dev_info_get(res->port_id, &dev_info); if (!strcmp(res->mode, "set")) { if (!strcmp(res->hwsw, "hw")) hw = 1; if (!strcmp(res->proto, "ip")) { - csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_IPV4_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + } else { + printf("IP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "udp")) { - csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_UDP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + } else { + printf("UDP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "tcp")) { - csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_TCP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + } else { + printf("TCP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "sctp")) { - csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_SCTP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + } else { + printf("SCTP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "outer-ip")) { - csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { + csum_offloads |= + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + } else { + printf("Outer IP checksum offload is not " + "supported by port %u\n", res->port_id); + } } if (hw) { @@ -3805,6 +3838,14 @@ struct cmd_tso_set_result { if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; + rte_eth_dev_info_get(res->port_id, &dev_info); + if ((ports[res->port_id].tso_segsz != 0) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0) { + printf("Error: TSO is not supported by port %d\n", + res->port_id); + return; + } + if (ports[res->port_id].tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_TCP_TSO; @@ -3881,24 +3922,25 @@ struct cmd_tunnel_tso_set_result { portid_t port_id; }; -static void +static struct rte_eth_dev_info check_tunnel_tso_nic_support(portid_t port_id) { struct rte_eth_dev_info dev_info; rte_eth_dev_info_get(port_id, &dev_info); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO)) - printf("Warning: TSO enabled but VXLAN TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: VXLAN TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO)) - printf("Warning: TSO enabled but GRE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GRE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO)) - printf("Warning: TSO enabled but IPIP TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: IPIP TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO)) - printf("Warning: TSO enabled but GENEVE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GENEVE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); + return dev_info; } static void @@ -3907,6 +3949,7 @@ struct cmd_tunnel_tso_set_result { __attribute__((unused)) void *data) { struct cmd_tunnel_tso_set_result *res = parsed_result; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -3918,6 +3961,7 @@ struct cmd_tunnel_tso_set_result { if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; + dev_info = check_tunnel_tso_nic_support(res->port_id); if (ports[res->port_id].tunnel_tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | @@ -3926,11 +3970,13 @@ struct cmd_tunnel_tso_set_result { DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); } else { + uint64_t tso_offloads = (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + ports[res->port_id].dev_conf.txmode.offloads |= - (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | - DEV_TX_OFFLOAD_GRE_TNL_TSO | - DEV_TX_OFFLOAD_IPIP_TNL_TSO | - DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + (tso_offloads & dev_info.tx_offload_capa); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3945,7 +3991,6 @@ struct cmd_tunnel_tso_set_result { * is not necessary for IPv6 tunneled pkts because there's no * checksum in IP header anymore. */ - check_tunnel_tso_nic_support(res->port_id); if (!ports[res->port_id].parse_tunnel) printf("Warning: csum parse_tunnel must be set " @@ -12995,6 +13040,7 @@ struct cmd_macsec_offload_on_result { portid_t port_id = res->port_id; int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0; int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -13003,15 +13049,19 @@ struct cmd_macsec_offload_on_result { return; } - ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); + ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif + } RTE_SET_USED(en); RTE_SET_USED(rp); switch (ret) { case 0: + ports[port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: @@ -13083,6 +13133,7 @@ struct cmd_macsec_offload_off_result { { struct cmd_macsec_offload_off_result *res = parsed_result; int ret = -ENOTSUP; + struct rte_eth_dev_info dev_info; portid_t port_id = res->port_id; if (port_id_is_invalid(port_id, ENABLED_WARN)) @@ -13092,14 +13143,16 @@ struct cmd_macsec_offload_off_result { return; } - ports[port_id].dev_conf.txmode.offloads &= - ~DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_disable(port_id); + ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif - + } switch (ret) { case 0: + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 41855ab..33848d8 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2791,6 +2791,7 @@ struct igb_ring_desc_16_bytes { tx_vlan_set(portid_t port_id, uint16_t vlan_id) { int vlan_offload; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -2802,6 +2803,12 @@ struct igb_ring_desc_16_bytes { printf("Error, as QinQ has been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) { + printf("Error: vlan insert is not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; @@ -2812,6 +2819,7 @@ struct igb_ring_desc_16_bytes { tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) { int vlan_offload; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -2825,6 +2833,12 @@ struct igb_ring_desc_16_bytes { printf("Error, as QinQ hasn't been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) { + printf("Error: qinq insert not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 91dcb31..3758410 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1440,6 +1440,28 @@ static int eth_event_callback(portid_t port_id, return 1; } +static void +check_port_offloads_conf(portid_t pi, struct rte_eth_conf *port_conf) +{ + struct rte_eth_dev_info dev_info; + + rte_eth_dev_info_get(pi, &dev_info); + if ((dev_info.tx_offload_capa & port_conf->txmode.offloads) != + port_conf->txmode.offloads) { + printf("Some Tx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + pi, port_conf->txmode.offloads, + dev_info.tx_offload_capa); + } + if ((dev_info.rx_offload_capa & port_conf->rxmode.offloads) != + port_conf->rxmode.offloads) { + printf("Some Rx offloads are not supported " + "by port %d: requested 0x%lx supported 0x%lx\n", + pi, port_conf->rxmode.offloads, + dev_info.rx_offload_capa); + } +} + int start_port(portid_t pid) { @@ -1481,6 +1503,8 @@ static int eth_event_callback(portid_t port_id, printf("Configuring Port %d (socket %u)\n", pi, port->socket_id); + /* Check for unsupported offloads */ + check_port_offloads_conf(pi, &port->dev_conf); /* configure port */ diag = rte_eth_dev_configure(pi, nb_rxq, nb_txq, &(port->dev_conf)); @@ -2263,6 +2287,7 @@ uint8_t port_is_bonding_slave(portid_t slave_pid) * Set the numbers of RX & TX queues to 0, so * the RX & TX queues will not be setup. */ + check_port_offloads_conf(pid, &port_conf); rte_eth_dev_configure(pid, 0, 0, &port_conf); rte_eth_dev_info_get(pid, &rte_port->dev_info); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v2 10/10] app/testpmd: fix on the flight VLAN configuration 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (8 preceding siblings ...) 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 09/10] app/testpmd: enforce offloads caps Shahaf Shuler @ 2017-12-12 12:52 ` Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler 10 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-12 12:52 UTC (permalink / raw) To: ferruh.yigit, jingjing.wu; +Cc: dev On ethdev there is an API to configure VLAN offloads after the port was started and without reconfiguration of the port or queues. In the current design of the application, when the Rx offloads are changed (through "port config all" CLI command) the port configuration is overwritten, therefore the configuration made for the VLAN is lost. This patch is to address the issue by a configuration of each port Rx offloads separately instead of using the global Rx config. Fixes: 6dbb2b336586 ("app/testpmd: convert to new Ethdev Rx offloads API") Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 217 +++++++++++++++++++++++--------------------- app/test-pmd/config.c | 27 ++++-- app/test-pmd/testpmd.c | 2 +- 3 files changed, 135 insertions(+), 111 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d1b8dab..00a229a 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,34 +1577,38 @@ struct cmd_config_max_pkt_len_result { __attribute__((unused)) void *data) { struct cmd_config_max_pkt_len_result *res = parsed_result; - uint64_t rx_offloads = rx_mode.offloads; + portid_t pid; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); return; } - if (!strcmp(res->name, "max-pkt-len")) { - if (res->value < ETHER_MIN_LEN) { - printf("max-pkt-len can not be less than %d\n", - ETHER_MIN_LEN); + RTE_ETH_FOREACH_DEV(pid) { + struct rte_port *port = &ports[pid]; + uint64_t rx_offloads = port->dev_conf.rxmode.offloads; + + if (!strcmp(res->name, "max-pkt-len")) { + if (res->value < ETHER_MIN_LEN) { + printf("max-pkt-len can not be less than %d\n", + ETHER_MIN_LEN); + return; + } + if (res->value == port->dev_conf.rxmode.max_rx_pkt_len) + return; + + port->dev_conf.rxmode.max_rx_pkt_len = res->value; + if (res->value > ETHER_MAX_LEN) + rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; + else + rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; + port->dev_conf.rxmode.offloads = rx_offloads; + } else { + printf("Unknown parameter\n"); return; } - if (res->value == rx_mode.max_rx_pkt_len) - return; - - rx_mode.max_rx_pkt_len = res->value; - if (res->value > ETHER_MAX_LEN) - rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; - else - rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; - } else { - printf("Unknown parameter\n"); - return; } - rx_mode.offloads = rx_offloads; - init_port_config(); cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1706,103 +1710,108 @@ struct cmd_config_rx_mode_flag { __attribute__((unused)) void *data) { struct cmd_config_rx_mode_flag *res = parsed_result; - uint64_t rx_offloads = rx_mode.offloads; + portid_t pid; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); return; } - if (!strcmp(res->name, "crc-strip")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "scatter")) { - if (!strcmp(res->value, "on")) { - rx_offloads |= DEV_RX_OFFLOAD_SCATTER; - } else if (!strcmp(res->value, "off")) { - rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + RTE_ETH_FOREACH_DEV(pid) { + struct rte_port *port; + uint64_t rx_offloads; + + port = &ports[pid]; + rx_offloads = port->dev_conf.rxmode.offloads; + if (!strcmp(res->name, "crc-strip")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "scatter")) { + if (!strcmp(res->value, "on")) { + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + } else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "rx-cksum")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "rx-timestamp")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan")) { + if (!strcmp(res->value, "on")) { + rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); + } else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-filter")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-strip")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-extend")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "drop-en")) { + if (!strcmp(res->value, "on")) + rx_drop_en = 1; + else if (!strcmp(res->value, "off")) + rx_drop_en = 0; + else { + printf("Unknown parameter\n"); + return; + } } else { printf("Unknown parameter\n"); return; } - } else if (!strcmp(res->name, "rx-cksum")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "rx-timestamp")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan")) { - if (!strcmp(res->value, "on")) { - rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | - DEV_RX_OFFLOAD_VLAN_STRIP); - } - else if (!strcmp(res->value, "off")) { - rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | - DEV_RX_OFFLOAD_VLAN_STRIP); - } - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-filter")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-strip")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-extend")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "drop-en")) { - if (!strcmp(res->value, "on")) - rx_drop_en = 1; - else if (!strcmp(res->value, "off")) - rx_drop_en = 0; - else { - printf("Unknown parameter\n"); - return; - } - } else { - printf("Unknown parameter\n"); - return; + port->dev_conf.rxmode.offloads = rx_offloads; } - rx_mode.offloads = rx_offloads; init_port_config(); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 33848d8..3bb99ff 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2664,21 +2664,26 @@ struct igb_ring_desc_16_bytes { { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_EXTEND_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; + } else { vlan_offload &= ~ETH_VLAN_EXTEND_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } void @@ -2686,21 +2691,26 @@ struct igb_ring_desc_16_bytes { { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_STRIP_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } else { vlan_offload &= ~ETH_VLAN_STRIP_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } void @@ -2722,21 +2732,26 @@ struct igb_ring_desc_16_bytes { { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_FILTER_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; + } else { vlan_offload &= ~ETH_VLAN_FILTER_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } int diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 3758410..48021bf 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -603,6 +603,7 @@ static int eth_event_callback(portid_t port_id, port = &ports[pid]; /* Apply default Tx configuration for all ports */ port->dev_conf.txmode = tx_mode; + port->dev_conf.rxmode = rx_mode; rte_eth_dev_info_get(pid, &port->dev_info); if (numa_support) { @@ -2113,7 +2114,6 @@ struct pmd_test_command { RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; - port->dev_conf.rxmode = rx_mode; port->dev_conf.fdir_conf = fdir_conf; if (nb_rxq > 1) { port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL; -- 1.8.3.1 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (9 preceding siblings ...) 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 10/10] app/testpmd: fix on the flight VLAN configuration Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 01/10] app/testpmd: fix port configuration print Shahaf Shuler ` (9 more replies) 10 siblings, 10 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev This series is to convert testpmd application to the new offloads API [1]. on v3: - Remove warn prints on bad offloads configuration from application. on v2: - Splited the patchset to multiple patches to help with the review. - Removed wrong comments. - Removed redundent parenthesis. - Fixed port print parameters. - Introduced a new method to check if single port is stopped. - Cleanup for internal Tx offloads flags. [1] http://dpdk.org/ml/archives/dev/2017-October/077329.html Shahaf Shuler (10): app/testpmd: fix port configuration print app/testpmd: convert to new Ethdev Rx offloads API app/testpmd: support check of single port stop app/testpmd: convert to new Ethdev Tx offloads API app/testpmd: fix flowgen forwarding ol flags app/testpmd: cleanup internal Tx offloads flags field app/testpmd: add command line option for Tx offloads app/testpmd: remove txqflags app/testpmd: enforce offloads caps app/testpmd: fix on the flight VLAN configuration app/test-pmd/cmdline.c | 501 +++++++++++++---------- app/test-pmd/config.c | 177 +++++--- app/test-pmd/csumonly.c | 40 +- app/test-pmd/flowgen.c | 12 +- app/test-pmd/macfwd.c | 8 +- app/test-pmd/macswap.c | 8 +- app/test-pmd/parameters.c | 59 +-- app/test-pmd/testpmd.c | 52 +-- app/test-pmd/testpmd.h | 26 +- app/test-pmd/txonly.c | 8 +- doc/guides/testpmd_app_ug/run_app.rst | 17 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 - 12 files changed, 516 insertions(+), 403 deletions(-) -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 01/10] app/testpmd: fix port configuration print 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2018-01-05 3:33 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler ` (8 subsequent siblings) 9 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev, pablo.de.lara.guarch, stable The print of the port configuration was only according to configuration of the first port. Fixes: f2c5125a686a ("app/testpmd: use default Rx/Tx port configuration") Cc: pablo.de.lara.guarch@intel.com Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/config.c | 48 +++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 86ca3aaef..387fefbaa 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1656,33 +1656,45 @@ fwd_lcores_config_display(void) void rxtx_config_display(void) { - printf(" %s packet forwarding%s - CRC stripping %s - " - "packets/burst=%d\n", cur_fwd_eng->fwd_mode_name, + portid_t pid; + + printf(" %s packet forwarding%s packets/burst=%d\n", + cur_fwd_eng->fwd_mode_name, retry_enabled == 0 ? "" : " with retry", - rx_mode.hw_strip_crc ? "enabled" : "disabled", nb_pkt_per_burst); if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine) printf(" packet len=%u - nb packet segments=%d\n", (unsigned)tx_pkt_length, (int) tx_pkt_nb_segs); - struct rte_eth_rxconf *rx_conf = &ports[0].rx_conf; - struct rte_eth_txconf *tx_conf = &ports[0].tx_conf; - printf(" nb forwarding cores=%d - nb forwarding ports=%d\n", nb_fwd_lcores, nb_fwd_ports); - printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", - nb_rxq, nb_rxd, rx_conf->rx_free_thresh); - printf(" RX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n", - rx_conf->rx_thresh.pthresh, rx_conf->rx_thresh.hthresh, - rx_conf->rx_thresh.wthresh); - printf(" TX queues=%d - TX desc=%d - TX free threshold=%d\n", - nb_txq, nb_txd, tx_conf->tx_free_thresh); - printf(" TX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n", - tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, - tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + + RTE_ETH_FOREACH_DEV(pid) { + struct rte_eth_rxconf *rx_conf = &ports[pid].rx_conf; + struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf; + + printf(" port %d:\n", (unsigned int)pid); + printf(" CRC stripping %s\n", + ports[pid].dev_conf.rxmode.hw_strip_crc ? + "enabled" : "disabled"); + printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", + nb_rxq, nb_rxd, rx_conf->rx_free_thresh); + printf(" RX threshold registers: pthresh=%d hthresh=%d " + " wthresh=%d\n", + rx_conf->rx_thresh.pthresh, + rx_conf->rx_thresh.hthresh, + rx_conf->rx_thresh.wthresh); + printf(" TX queues=%d - TX desc=%d - TX free threshold=%d\n", + nb_txq, nb_txd, tx_conf->tx_free_thresh); + printf(" TX threshold registers: pthresh=%d hthresh=%d " + " wthresh=%d\n", + tx_conf->tx_thresh.pthresh, + tx_conf->tx_thresh.hthresh, + tx_conf->tx_thresh.wthresh); + printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", + tx_conf->tx_rs_thresh, tx_conf->txq_flags); + } } void -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 01/10] app/testpmd: fix port configuration print 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 01/10] app/testpmd: fix port configuration print Shahaf Shuler @ 2018-01-05 3:33 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-05 3:33 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh Cc: dev, De Lara Guarch, Pablo, stable Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 26, 2017 5:44 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > <ferruh.yigit@intel.com> > Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; > stable@dpdk.org > Subject: [dpdk-dev] [PATCH v3 01/10] app/testpmd: fix port configuration > print > > The print of the port configuration was only according to configuration of > the first port. > > Fixes: f2c5125a686a ("app/testpmd: use default Rx/Tx port configuration") > Cc: pablo.de.lara.guarch@intel.com > Cc: stable@dpdk.org > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 01/10] app/testpmd: fix port configuration print Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2018-01-09 3:05 ` Lu, Wenzhuo 2018-01-19 19:30 ` Patil, Harish 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 03/10] app/testpmd: support check of single port stop Shahaf Shuler ` (7 subsequent siblings) 9 siblings, 2 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") Convert the application to use the new API. The is no functionality changes rather simple conversion of the flags. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 51 +++++++++++++++++++++++------------------- app/test-pmd/config.c | 36 +++++++++++++++++++---------- app/test-pmd/parameters.c | 32 +++++++++++++------------- app/test-pmd/testpmd.c | 19 +++++++--------- 4 files changed, 77 insertions(+), 61 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f71d96301..d8c73a9b1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,6 +1577,7 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_max_pkt_len_result *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1594,14 +1595,16 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, rx_mode.max_rx_pkt_len = res->value; if (res->value > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else - rx_mode.jumbo_frame = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; } else { printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; + init_port_config(); cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1703,6 +1706,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_rx_mode_flag *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1711,48 +1715,48 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, if (!strcmp(res->name, "crc-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_strip_crc = 1; + rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "scatter")) { - if (!strcmp(res->value, "on")) - rx_mode.enable_scatter = 1; - else if (!strcmp(res->value, "off")) - rx_mode.enable_scatter = 0; - else { + if (!strcmp(res->value, "on")) { + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + } else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-cksum")) { if (!strcmp(res->value, "on")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; else if (!strcmp(res->value, "off")) - rx_mode.hw_ip_checksum = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-timestamp")) { if (!strcmp(res->value, "on")) - rx_mode.hw_timestamp = 1; + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; else if (!strcmp(res->value, "off")) - rx_mode.hw_timestamp = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan")) { if (!strcmp(res->value, "on")) { - rx_mode.hw_vlan_filter = 1; - rx_mode.hw_vlan_strip = 1; + rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else if (!strcmp(res->value, "off")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else { printf("Unknown parameter\n"); @@ -1760,27 +1764,27 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, } } else if (!strcmp(res->name, "hw-vlan-filter")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_filter = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_strip = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-extend")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_extend = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; else { printf("Unknown parameter\n"); return; @@ -1798,6 +1802,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; init_port_config(); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 387fefbaa..3bc99be76 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -540,14 +540,12 @@ port_infos_display(portid_t port_id) void port_offload_cap_display(portid_t port_id) { - struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; static const char *info_border = "************"; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - dev = &rte_eth_devices[port_id]; rte_eth_dev_info_get(port_id, &dev_info); printf("\n%s Port %d supported offload features: %s\n", @@ -555,7 +553,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) { printf("VLAN stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_strip) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_STRIP) printf("on\n"); else printf("off\n"); @@ -563,7 +562,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) { printf("Double VLANs stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_extend) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_EXTEND) printf("on\n"); else printf("off\n"); @@ -571,7 +571,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) { printf("RX IPv4 checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -579,7 +580,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) { printf("RX UDP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n"); @@ -587,18 +589,26 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) { printf("RX TCP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n"); } - if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) - printf("RX Outer IPv4 checksum: on"); + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) { + printf("RX Outer IPv4 checksum: "); + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) + printf("on\n"); + else + printf("off\n"); + } if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) { printf("Large receive offload: "); - if (dev->data->dev_conf.rxmode.enable_lro) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_LRO) printf("on\n"); else printf("off\n"); @@ -615,7 +625,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) { printf("HW timestamp: "); - if (dev->data->dev_conf.rxmode.hw_timestamp) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TIMESTAMP) printf("on\n"); else printf("off\n"); @@ -1676,7 +1687,8 @@ rxtx_config_display(void) printf(" port %d:\n", (unsigned int)pid); printf(" CRC stripping %s\n", - ports[pid].dev_conf.rxmode.hw_strip_crc ? + (ports[pid].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_CRC_STRIP) ? "enabled" : "disabled"); printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", nb_rxq, nb_rxd, rx_conf->rx_free_thresh); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 84e7a63ef..263651cba 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -566,6 +566,8 @@ launch_args_parse(int argc, char** argv) char **argvopt; int opt_idx; enum { TX, RX }; + /* Default Rx offloads for all ports. */ + uint64_t rx_offloads = rx_mode.offloads; static struct option lgopts[] = { { "help", 0, 0, 0 }, @@ -804,7 +806,8 @@ launch_args_parse(int argc, char** argv) if (n >= ETHER_MIN_LEN) { rx_mode.max_rx_pkt_len = (uint32_t) n; if (n > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; } else rte_exit(EXIT_FAILURE, "Invalid max-pkt-len=%d - should be > %d\n", @@ -897,34 +900,30 @@ launch_args_parse(int argc, char** argv) } #endif if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; if (!strcmp(lgopts[opt_idx].name, "enable-lro")) - rx_mode.enable_lro = 1; + rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) - rx_mode.enable_scatter = 1; + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; if (!strcmp(lgopts[opt_idx].name, "enable-rx-timestamp")) - rx_mode.hw_timestamp = 1; - - if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; - rx_mode.hw_vlan_extend = 0; - } + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-filter")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-strip")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-extend")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; if (!strcmp(lgopts[opt_idx].name, "enable-drop-en")) rx_drop_en = 1; @@ -1140,4 +1139,7 @@ launch_args_parse(int argc, char** argv) break; } } + + /* Set offload configuration from command line parameters. */ + rx_mode.offloads = rx_offloads; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index c3ab44849..6785b095f 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -338,15 +338,10 @@ lcoreid_t latencystats_lcore_id = -1; */ struct rte_eth_rxmode rx_mode = { .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */ - .split_hdr_size = 0, - .header_split = 0, /**< Header Split disabled. */ - .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ - .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ - .hw_vlan_strip = 1, /**< VLAN strip enabled. */ - .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ - .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ - .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ - .hw_timestamp = 0, /**< HW timestamp enabled. */ + .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP | + DEV_RX_OFFLOAD_CRC_STRIP), + .ignore_offload_bitfield = 1, }; struct rte_fdir_conf fdir_conf = { @@ -1521,6 +1516,8 @@ start_port(portid_t pid) port->need_reconfig_queues = 1; return -1; } + /* Apply Rx offloads configuration */ + port->rx_conf.offloads = port->dev_conf.rxmode.offloads; /* setup rx queues */ for (qi = 0; qi < nb_rxq; qi++) { if ((numa_support) && @@ -2252,7 +2249,7 @@ init_port_dcb_config(portid_t pid, retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en); if (retval < 0) return retval; - port_conf.rxmode.hw_vlan_filter = 1; + port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; /** * Write the configuration into the device. @@ -2301,7 +2298,7 @@ init_port_dcb_config(portid_t pid, rxtx_port_config(rte_port); /* VLAN filter */ - rte_port->dev_conf.rxmode.hw_vlan_filter = 1; + rte_port->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; for (i = 0; i < RTE_DIM(vlan_tags); i++) rx_vft_set(pid, vlan_tags[i], 1); -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler @ 2018-01-09 3:05 ` Lu, Wenzhuo 2018-01-19 19:30 ` Patil, Harish 1 sibling, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 3:05 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 26, 2017 5:44 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev > Rx offloads API > > Ethdev Rx offloads API has changed since: > > commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") > > Convert the application to use the new API. The is no functionality changes > rather simple conversion of the flags. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler 2018-01-09 3:05 ` Lu, Wenzhuo @ 2018-01-19 19:30 ` Patil, Harish 2018-01-20 19:29 ` Shahaf Shuler 1 sibling, 1 reply; 78+ messages in thread From: Patil, Harish @ 2018-01-19 19:30 UTC (permalink / raw) To: Shahaf Shuler, jingjing.wu, ferruh.yigit; +Cc: dev -----Original Message----- From: dev <dev-bounces@dpdk.org> on behalf of Shahaf Shuler <shahafs@mellanox.com> Date: Tuesday, December 26, 2017 at 1:44 AM To: "jingjing.wu@intel.com" <jingjing.wu@intel.com>, "ferruh.yigit@intel.com" <ferruh.yigit@intel.com> Cc: "dev@dpdk.org" <dev@dpdk.org> Subject: [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API >Ethdev Rx offloads API has changed since: > >commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") > >Convert the application to use the new API. The is no functionality >changes rather simple conversion of the flags. > >Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> >--- > app/test-pmd/cmdline.c | 51 +++++++++++++++++++++++------------------- > app/test-pmd/config.c | 36 +++++++++++++++++++---------- > app/test-pmd/parameters.c | 32 +++++++++++++------------- > app/test-pmd/testpmd.c | 19 +++++++--------- > 4 files changed, 77 insertions(+), 61 deletions(-) > >diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c >index f71d96301..d8c73a9b1 100644 >--- a/app/test-pmd/cmdline.c >+++ b/app/test-pmd/cmdline.c >@@ -1577,6 +1577,7 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, > __attribute__((unused)) void *data) > { > struct cmd_config_max_pkt_len_result *res = parsed_result; >+ uint64_t rx_offloads = rx_mode.offloads; > > if (!all_ports_stopped()) { > printf("Please stop all ports first\n"); >@@ -1594,14 +1595,16 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, > > rx_mode.max_rx_pkt_len = res->value; > if (res->value > ETHER_MAX_LEN) >- rx_mode.jumbo_frame = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; > else >- rx_mode.jumbo_frame = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; > } else { > printf("Unknown parameter\n"); > return; > } > >+ rx_mode.offloads = rx_offloads; >+ > init_port_config(); > > cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); >@@ -1703,6 +1706,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, > __attribute__((unused)) void *data) > { > struct cmd_config_rx_mode_flag *res = parsed_result; >+ uint64_t rx_offloads = rx_mode.offloads; > > if (!all_ports_stopped()) { > printf("Please stop all ports first\n"); >@@ -1711,48 +1715,48 @@ cmd_config_rx_mode_flag_parsed(void >*parsed_result, > > if (!strcmp(res->name, "crc-strip")) { > if (!strcmp(res->value, "on")) >- rx_mode.hw_strip_crc = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; > else if (!strcmp(res->value, "off")) >- rx_mode.hw_strip_crc = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; > else { > printf("Unknown parameter\n"); > return; > } > } else if (!strcmp(res->name, "scatter")) { >- if (!strcmp(res->value, "on")) >- rx_mode.enable_scatter = 1; >- else if (!strcmp(res->value, "off")) >- rx_mode.enable_scatter = 0; >- else { >+ if (!strcmp(res->value, "on")) { >+ rx_offloads |= DEV_RX_OFFLOAD_SCATTER; >+ } else if (!strcmp(res->value, "off")) { >+ rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; >+ } else { > printf("Unknown parameter\n"); > return; > } > } else if (!strcmp(res->name, "rx-cksum")) { > if (!strcmp(res->value, "on")) >- rx_mode.hw_ip_checksum = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; > else if (!strcmp(res->value, "off")) >- rx_mode.hw_ip_checksum = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; > else { > printf("Unknown parameter\n"); > return; > } > } else if (!strcmp(res->name, "rx-timestamp")) { > if (!strcmp(res->value, "on")) >- rx_mode.hw_timestamp = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; > else if (!strcmp(res->value, "off")) >- rx_mode.hw_timestamp = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; > else { > printf("Unknown parameter\n"); > return; > } > } else if (!strcmp(res->name, "hw-vlan")) { > if (!strcmp(res->value, "on")) { >- rx_mode.hw_vlan_filter = 1; >- rx_mode.hw_vlan_strip = 1; >+ rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | >+ DEV_RX_OFFLOAD_VLAN_STRIP); > } > else if (!strcmp(res->value, "off")) { >- rx_mode.hw_vlan_filter = 0; >- rx_mode.hw_vlan_strip = 0; >+ rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | >+ DEV_RX_OFFLOAD_VLAN_STRIP); > } > else { > printf("Unknown parameter\n"); >@@ -1760,27 +1764,27 @@ cmd_config_rx_mode_flag_parsed(void >*parsed_result, > } > } else if (!strcmp(res->name, "hw-vlan-filter")) { > if (!strcmp(res->value, "on")) >- rx_mode.hw_vlan_filter = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; > else if (!strcmp(res->value, "off")) >- rx_mode.hw_vlan_filter = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; > else { > printf("Unknown parameter\n"); > return; > } > } else if (!strcmp(res->name, "hw-vlan-strip")) { > if (!strcmp(res->value, "on")) >- rx_mode.hw_vlan_strip = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; > else if (!strcmp(res->value, "off")) >- rx_mode.hw_vlan_strip = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; > else { > printf("Unknown parameter\n"); > return; > } > } else if (!strcmp(res->name, "hw-vlan-extend")) { > if (!strcmp(res->value, "on")) >- rx_mode.hw_vlan_extend = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; > else if (!strcmp(res->value, "off")) >- rx_mode.hw_vlan_extend = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; > else { > printf("Unknown parameter\n"); > return; >@@ -1798,6 +1802,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, > printf("Unknown parameter\n"); > return; > } >+ rx_mode.offloads = rx_offloads; > > init_port_config(); > >diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c >index 387fefbaa..3bc99be76 100644 >--- a/app/test-pmd/config.c >+++ b/app/test-pmd/config.c >@@ -540,14 +540,12 @@ port_infos_display(portid_t port_id) > void > port_offload_cap_display(portid_t port_id) > { >- struct rte_eth_dev *dev; > struct rte_eth_dev_info dev_info; > static const char *info_border = "************"; > > if (port_id_is_invalid(port_id, ENABLED_WARN)) > return; > >- dev = &rte_eth_devices[port_id]; > rte_eth_dev_info_get(port_id, &dev_info); > > printf("\n%s Port %d supported offload features: %s\n", >@@ -555,7 +553,8 @@ port_offload_cap_display(portid_t port_id) > > if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) { > printf("VLAN stripped: "); >- if (dev->data->dev_conf.rxmode.hw_vlan_strip) >+ if (ports[port_id].dev_conf.rxmode.offloads & >+ DEV_RX_OFFLOAD_VLAN_STRIP) > printf("on\n"); > else > printf("off\n"); >@@ -563,7 +562,8 @@ port_offload_cap_display(portid_t port_id) > > if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) { > printf("Double VLANs stripped: "); >- if (dev->data->dev_conf.rxmode.hw_vlan_extend) >+ if (ports[port_id].dev_conf.rxmode.offloads & >+ DEV_RX_OFFLOAD_VLAN_EXTEND) > printf("on\n"); > else > printf("off\n"); >@@ -571,7 +571,8 @@ port_offload_cap_display(portid_t port_id) > > if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) { > printf("RX IPv4 checksum: "); >- if (dev->data->dev_conf.rxmode.hw_ip_checksum) >+ if (ports[port_id].dev_conf.rxmode.offloads & >+ DEV_RX_OFFLOAD_IPV4_CKSUM) > printf("on\n"); > else > printf("off\n"); >@@ -579,7 +580,8 @@ port_offload_cap_display(portid_t port_id) > > if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) { > printf("RX UDP checksum: "); >- if (dev->data->dev_conf.rxmode.hw_ip_checksum) >+ if (ports[port_id].dev_conf.rxmode.offloads & >+ DEV_RX_OFFLOAD_UDP_CKSUM) > printf("on\n"); > else > printf("off\n"); >@@ -587,18 +589,26 @@ port_offload_cap_display(portid_t port_id) > > if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) { > printf("RX TCP checksum: "); >- if (dev->data->dev_conf.rxmode.hw_ip_checksum) >+ if (ports[port_id].dev_conf.rxmode.offloads & >+ DEV_RX_OFFLOAD_TCP_CKSUM) > printf("on\n"); > else > printf("off\n"); > } > >- if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) >- printf("RX Outer IPv4 checksum: on"); >+ if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) { >+ printf("RX Outer IPv4 checksum: "); >+ if (ports[port_id].dev_conf.rxmode.offloads & >+ DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) >+ printf("on\n"); >+ else >+ printf("off\n"); >+ } > > if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) { > printf("Large receive offload: "); >- if (dev->data->dev_conf.rxmode.enable_lro) >+ if (ports[port_id].dev_conf.rxmode.offloads & >+ DEV_RX_OFFLOAD_TCP_LRO) > printf("on\n"); > else > printf("off\n"); >@@ -615,7 +625,8 @@ port_offload_cap_display(portid_t port_id) > > if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) { > printf("HW timestamp: "); >- if (dev->data->dev_conf.rxmode.hw_timestamp) >+ if (ports[port_id].dev_conf.rxmode.offloads & >+ DEV_RX_OFFLOAD_TIMESTAMP) > printf("on\n"); > else > printf("off\n"); >@@ -1676,7 +1687,8 @@ rxtx_config_display(void) > > printf(" port %d:\n", (unsigned int)pid); > printf(" CRC stripping %s\n", >- ports[pid].dev_conf.rxmode.hw_strip_crc ? >+ (ports[pid].dev_conf.rxmode.offloads & >+ DEV_RX_OFFLOAD_CRC_STRIP) ? > "enabled" : "disabled"); > printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", > nb_rxq, nb_rxd, rx_conf->rx_free_thresh); >diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c >index 84e7a63ef..263651cba 100644 >--- a/app/test-pmd/parameters.c >+++ b/app/test-pmd/parameters.c >@@ -566,6 +566,8 @@ launch_args_parse(int argc, char** argv) > char **argvopt; > int opt_idx; > enum { TX, RX }; >+ /* Default Rx offloads for all ports. */ >+ uint64_t rx_offloads = rx_mode.offloads; > > static struct option lgopts[] = { > { "help", 0, 0, 0 }, >@@ -804,7 +806,8 @@ launch_args_parse(int argc, char** argv) > if (n >= ETHER_MIN_LEN) { > rx_mode.max_rx_pkt_len = (uint32_t) n; > if (n > ETHER_MAX_LEN) >- rx_mode.jumbo_frame = 1; >+ rx_offloads |= >+ DEV_RX_OFFLOAD_JUMBO_FRAME; > } else > rte_exit(EXIT_FAILURE, > "Invalid max-pkt-len=%d - should be > %d\n", >@@ -897,34 +900,30 @@ launch_args_parse(int argc, char** argv) > } > #endif > if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip")) >- rx_mode.hw_strip_crc = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; > if (!strcmp(lgopts[opt_idx].name, "enable-lro")) >- rx_mode.enable_lro = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; > if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) >- rx_mode.enable_scatter = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_SCATTER; > if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum")) >- rx_mode.hw_ip_checksum = 1; >+ rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; > if (!strcmp(lgopts[opt_idx].name, > "enable-rx-timestamp")) >- rx_mode.hw_timestamp = 1; >- >- if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) { >- rx_mode.hw_vlan_filter = 0; >- rx_mode.hw_vlan_strip = 0; >- rx_mode.hw_vlan_extend = 0; >- } >+ rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; >+ if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) >+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN; > > if (!strcmp(lgopts[opt_idx].name, > "disable-hw-vlan-filter")) >- rx_mode.hw_vlan_filter = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; > > if (!strcmp(lgopts[opt_idx].name, > "disable-hw-vlan-strip")) >- rx_mode.hw_vlan_strip = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; > > if (!strcmp(lgopts[opt_idx].name, > "disable-hw-vlan-extend")) >- rx_mode.hw_vlan_extend = 0; >+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; > > if (!strcmp(lgopts[opt_idx].name, "enable-drop-en")) > rx_drop_en = 1; >@@ -1140,4 +1139,7 @@ launch_args_parse(int argc, char** argv) > break; > } > } >+ >+ /* Set offload configuration from command line parameters. */ >+ rx_mode.offloads = rx_offloads; > } >diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c >index c3ab44849..6785b095f 100644 >--- a/app/test-pmd/testpmd.c >+++ b/app/test-pmd/testpmd.c >@@ -338,15 +338,10 @@ lcoreid_t latencystats_lcore_id = -1; > */ > struct rte_eth_rxmode rx_mode = { > .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */ >- .split_hdr_size = 0, >- .header_split = 0, /**< Header Split disabled. */ >- .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ >- .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ >- .hw_vlan_strip = 1, /**< VLAN strip enabled. */ >- .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ >- .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ >- .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ >- .hw_timestamp = 0, /**< HW timestamp enabled. */ >+ .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | >+ DEV_RX_OFFLOAD_VLAN_STRIP | >+ DEV_RX_OFFLOAD_CRC_STRIP), >+ .ignore_offload_bitfield = 1, > }; > > struct rte_fdir_conf fdir_conf = { >@@ -1521,6 +1516,8 @@ start_port(portid_t pid) > port->need_reconfig_queues = 1; > return -1; > } >+ /* Apply Rx offloads configuration */ >+ port->rx_conf.offloads = port->dev_conf.rxmode.offloads; > /* setup rx queues */ > for (qi = 0; qi < nb_rxq; qi++) { > if ((numa_support) && >@@ -2252,7 +2249,7 @@ init_port_dcb_config(portid_t pid, > retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en); > if (retval < 0) > return retval; >- port_conf.rxmode.hw_vlan_filter = 1; >+ port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; > > /** > * Write the configuration into the device. >@@ -2301,7 +2298,7 @@ init_port_dcb_config(portid_t pid, > > rxtx_port_config(rte_port); > /* VLAN filter */ >- rte_port->dev_conf.rxmode.hw_vlan_filter = 1; >+ rte_port->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; > for (i = 0; i < RTE_DIM(vlan_tags); i++) > rx_vft_set(pid, vlan_tags[i], 1); > >-- >2.12.0 > Hi Shahaf, This testpmd change is causing some issues for qede PMD. In this patch, rte_eth_dev_configure() and RX/TX queue setup functions are called for the second time after applying TX offloads but without calling rte_eth_dev_close() before. Also there is no way in the driver to detect that this is a port reconfiguration condition in which case it needs to do certain resources deallocation/cleanup based on prior configuration. Ideally, we don’t want to maintain port states in driver internally. So is there any suggestions here? Thanks, Harish > ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API 2018-01-19 19:30 ` Patil, Harish @ 2018-01-20 19:29 ` Shahaf Shuler 0 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-20 19:29 UTC (permalink / raw) To: Patil, Harish, jingjing.wu, ferruh.yigit; +Cc: dev Hi Harish, Friday, January 19, 2018 9:30 PM, Patil, Harish: > > > > Hi Shahaf, > This testpmd change is causing some issues for qede PMD. > In this patch, rte_eth_dev_configure() and RX/TX queue setup functions are > called for the second time after applying TX offloads but without calling > rte_eth_dev_close() before. This issue is not related to the patch, rather to how DPDK and ethdev layer is defined. In DPDK, after device probe the device is considered usable from ethdev. Then from ethdev the device can be configured (both port and queues) as long as it is not started yet. The move between device start, stop, port config and queue config can happen multiple times without the need to move through device close. In fact, the only way to make the device usable again after close is by another probe. > Also there is no way in the driver to detect that this is a port > reconfiguration condition in which case it needs to do certain resources > deallocation/cleanup based on prior configuration. Am not sure I understand. You mean it is impossible from your side to detect port configuration in your PMD? Other PMDs do that. > Ideally, we don’t want to maintain port states in driver internally. So is > there any suggestions here? Generally, I think this is a big issue in qede PMD. It is not following the rules of ethdev. I guess that with this misfunctionality you will have bugs also with real applications. As a temporary walk around you can configure the Tx offload you want through --tx-offloads command line parameter and avoid enablement using the CLI. This way the port and queues will be reconfigured only once. > > Thanks, > Harish > > > > > > ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 03/10] app/testpmd: support check of single port stop 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 01/10] app/testpmd: fix port configuration print Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2018-01-09 3:20 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler ` (6 subsequent siblings) 9 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev This patch adds supports for checking if a single port is stopped. currently there is a function to check only for all ports. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/testpmd.c | 16 ++++++++++++---- app/test-pmd/testpmd.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 6785b095f..77154ef3b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1394,15 +1394,23 @@ all_ports_started(void) } int +port_is_stopped(portid_t port_id) +{ + struct rte_port *port = &ports[port_id]; + + if ((port->port_status != RTE_PORT_STOPPED) && + (port->slave_flag == 0)) + return 0; + return 1; +} + +int all_ports_stopped(void) { portid_t pi; - struct rte_port *port; RTE_ETH_FOREACH_DEV(pi) { - port = &ports[pi]; - if ((port->port_status != RTE_PORT_STOPPED) && - (port->slave_flag == 0)) + if (!port_is_stopped(pi)) return 0; } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1639d27e7..ab74d39ce 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -682,6 +682,7 @@ void reset_port(portid_t pid); void attach_port(char *identifier); void detach_port(portid_t port_id); int all_ports_stopped(void); +int port_is_stopped(portid_t port_id); int port_is_started(portid_t port_id); void pmd_test_exit(void); void fdir_get_infos(portid_t port_id); -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 03/10] app/testpmd: support check of single port stop 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 03/10] app/testpmd: support check of single port stop Shahaf Shuler @ 2018-01-09 3:20 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 3:20 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 26, 2017 5:44 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 03/10] app/testpmd: support check of single > port stop > > This patch adds supports for checking if a single port is stopped. > currently there is a function to check only for all ports. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (2 preceding siblings ...) 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 03/10] app/testpmd: support check of single port stop Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2018-01-09 5:27 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler ` (5 subsequent siblings) 9 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") Convert the application to use the new API. This patch mandates the port to be stopped when configure the Tx offloads. This is because the PMD must be aware to the offloads changes on the device and queue configuration. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 90 ++++++++++++++++++++++++++++++++++++++++++--- app/test-pmd/config.c | 55 ++++++++++++++++++--------- app/test-pmd/testpmd.c | 3 ++ 3 files changed, 124 insertions(+), 24 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d8c73a9b1..58125839a 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3439,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result, { struct cmd_tx_vlan_set_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_vlan_set(res->port_id, res->vlan_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = @@ -3486,7 +3493,14 @@ cmd_tx_vlan_set_qinq_parsed(void *parsed_result, { struct cmd_tx_vlan_set_qinq_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_qinq_set(res->port_id, res->vlan_id, res->vlan_id_outer); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_qinq_tx_vlan = @@ -3592,7 +3606,14 @@ cmd_tx_vlan_reset_parsed(void *parsed_result, { struct cmd_tx_vlan_reset_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_vlan_reset(res->port_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_reset_tx_vlan = @@ -3685,11 +3706,16 @@ cmd_csum_parsed(void *parsed_result, struct cmd_csum_result *res = parsed_result; int hw = 0; uint16_t mask = 0; + uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); return; } + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) { @@ -3698,22 +3724,34 @@ cmd_csum_parsed(void *parsed_result, if (!strcmp(res->proto, "ip")) { mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } - if (hw) + if (hw) { ports[res->port_id].tx_ol_flags |= mask; - else + ports[res->port_id].dev_conf.txmode.offloads |= + csum_offloads; + } else { ports[res->port_id].tx_ol_flags &= (~mask); + ports[res->port_id].dev_conf.txmode.offloads &= + (~csum_offloads); + } } csum_show(res->port_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_csum_csum = @@ -3837,15 +3875,24 @@ cmd_tso_set_parsed(void *parsed_result, if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; - if (ports[res->port_id].tso_segsz == 0) + if (ports[res->port_id].tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_TCP_TSO; printf("TSO for non-tunneled packets is disabled\n"); - else + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_TCP_TSO; printf("TSO segment size for non-tunneled packets is %d\n", ports[res->port_id].tso_segsz); + } /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(res->port_id, &dev_info); @@ -3854,6 +3901,8 @@ cmd_tso_set_parsed(void *parsed_result, printf("Warning: TSO enabled but not " "supported by port %d\n", res->port_id); } + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tso_set_tso = @@ -3939,13 +3988,27 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - if (ports[res->port_id].tunnel_tso_segsz == 0) + if (ports[res->port_id].tunnel_tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); - else { + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3971,6 +4034,8 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tunnel_tso_set_tso = @@ -13012,8 +13077,13 @@ cmd_set_macsec_offload_on_parsed( if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!port_is_stopped(port_id)) { + printf("Please stop port %d first\n", port_id); + return; + } ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif @@ -13022,6 +13092,7 @@ cmd_set_macsec_offload_on_parsed( switch (ret) { case 0: + cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); @@ -13096,14 +13167,21 @@ cmd_set_macsec_offload_off_parsed( if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!port_is_stopped(port_id)) { + printf("Please stop port %d first\n", port_id); + return; + } ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif switch (ret) { case 0: + cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 3bc99be76..d0056fa69 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -616,8 +616,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { printf("VLAN insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VLAN_INSERT) printf("on\n"); else printf("off\n"); @@ -634,8 +634,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) { printf("Double VLANs insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_QINQ_INSERT) printf("on\n"); else printf("off\n"); @@ -643,7 +643,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) { printf("TX IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -651,7 +652,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) { printf("TX UDP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n"); @@ -659,7 +661,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) { printf("TX TCP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n"); @@ -667,7 +670,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) { printf("TX SCTP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_SCTP_CKSUM) printf("on\n"); else printf("off\n"); @@ -675,8 +679,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { printf("TX Outer IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -684,7 +688,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) { printf("TX TCP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_TSO) printf("on\n"); else printf("off\n"); @@ -692,7 +697,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) { printf("TX UDP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_TSO) printf("on\n"); else printf("off\n"); @@ -700,7 +706,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) { printf("TSO for VXLAN tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VXLAN_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -708,7 +715,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) { printf("TSO for GRE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GRE_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -716,7 +724,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) { printf("TSO for IPIP tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPIP_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -724,7 +733,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) { printf("TSO for GENEVE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GENEVE_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -1704,8 +1714,10 @@ rxtx_config_display(void) tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"" + " - TXQ offloads=0x%"PRIx64"\n", + tx_conf->tx_rs_thresh, tx_conf->txq_flags, + tx_conf->offloads); } } @@ -2783,6 +2795,7 @@ void tx_vlan_set(portid_t port_id, uint16_t vlan_id) { int vlan_offload; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2796,6 +2809,7 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; } @@ -2803,6 +2817,7 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) { int vlan_offload; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2818,6 +2833,7 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; } @@ -2829,6 +2845,9 @@ tx_vlan_reset(portid_t port_id) return; ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | TESTPMD_TX_OFFLOAD_INSERT_QINQ); + ports[port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_QINQ_INSERT); ports[port_id].tx_vlan_id = 0; ports[port_id].tx_vlan_id_outer = 0; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 77154ef3b..0087438bc 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1498,6 +1498,9 @@ start_port(portid_t pid) } if (port->need_reconfig_queues > 0) { port->need_reconfig_queues = 0; + port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + /* Apply Tx offloads configuration */ + port->tx_conf.offloads = port->dev_conf.txmode.offloads; /* setup tx queues */ for (qi = 0; qi < nb_txq; qi++) { if ((numa_support) && -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler @ 2018-01-09 5:27 ` Lu, Wenzhuo 2018-01-09 6:47 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 5:27 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi Shahaf, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 26, 2017 5:44 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev > Tx offloads API > > Ethdev Tx offloads API has changed since: > > commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") > > Convert the application to use the new API. > > This patch mandates the port to be stopped when configure the Tx offloads. > This is because the PMD must be aware to the offloads changes on the > device and queue configuration. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > --- > app/test-pmd/cmdline.c | 90 > ++++++++++++++++++++++++++++++++++++++++++--- > app/test-pmd/config.c | 55 ++++++++++++++++++--------- app/test- > pmd/testpmd.c | 3 ++ > 3 files changed, 124 insertions(+), 24 deletions(-) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > d8c73a9b1..58125839a 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -3439,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result, { > struct cmd_tx_vlan_set_result *res = parsed_result; > > + if (!port_is_stopped(res->port_id)) { > + printf("Please stop port %d first\n", res->port_id); > + return; > + } > + > tx_vlan_set(res->port_id, res->vlan_id); > + > + cmd_reconfig_device_queue(res->port_id, 1, 1); > } > I do have some concern about this behavior change, 'port_is_stopped' and ' cmd_reconfig_device_queue '. 1, seems this behavior change is not necessary for using the new offload API. Maybe splitting this patch to 2 is better. 2, some NICs doesn't need to be stopped or re-configured to make vlan functions enabled. That's why the original code doesn't have this restriction. Maybe figuring out a way to do the restriction in the driver layer is better. ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2018-01-09 5:27 ` Lu, Wenzhuo @ 2018-01-09 6:47 ` Shahaf Shuler 2018-01-09 7:13 ` Lu, Wenzhuo 0 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2018-01-09 6:47 UTC (permalink / raw) To: Lu, Wenzhuo, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi, Tuesday, January 9, 2018 7:28 AM, Lu, Wenzhuo: > Hi Shahaf, > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > > Sent: Tuesday, December 26, 2017 5:44 PM > > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > > <ferruh.yigit@intel.com> > > Cc: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new > > Ethdev Tx offloads API > > > > Ethdev Tx offloads API has changed since: > > > > commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") > > > > Convert the application to use the new API. > > > > This patch mandates the port to be stopped when configure the Tx > offloads. > > This is because the PMD must be aware to the offloads changes on the > > device and queue configuration. > > > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > > --- > > app/test-pmd/cmdline.c | 90 > > ++++++++++++++++++++++++++++++++++++++++++--- > > app/test-pmd/config.c | 55 ++++++++++++++++++--------- app/test- > > pmd/testpmd.c | 3 ++ > > 3 files changed, 124 insertions(+), 24 deletions(-) > > > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > > d8c73a9b1..58125839a 100644 > > --- a/app/test-pmd/cmdline.c > > +++ b/app/test-pmd/cmdline.c > > @@ -3439,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result, > { > > struct cmd_tx_vlan_set_result *res = parsed_result; > > > > + if (!port_is_stopped(res->port_id)) { > > + printf("Please stop port %d first\n", res->port_id); > > + return; > > + } > > + > > tx_vlan_set(res->port_id, res->vlan_id); > > + > > + cmd_reconfig_device_queue(res->port_id, 1, 1); > > } > > > I do have some concern about this behavior change, 'port_is_stopped' and ' > cmd_reconfig_device_queue '. > 1, seems this behavior change is not necessary for using the new offload API. > Maybe splitting this patch to 2 is better. It is related. Because as part of the offloads API the Tx offloads configuration is set on the rte_eth_dev_configure. To configure a device it must be stopped in advance. Also, per my understanding, the only API which allows offloads configuration on the flight are the Rx VLAN offloads. As you can see, this API is respected and no need to check the port status in it > 2, some NICs doesn't need to be stopped or re-configured to make vlan > functions enabled. Only for the Rx vlan. The Tx vlan insert is not configured on the flight. That's why the original code doesn't have this restriction. > Maybe figuring out a way to do the restriction in the driver layer is better. The original code doesn't have such restriction because testpmd wasn't configuring Tx offloads at all. It used it's own Tx offloads enum (which I removed on later patches) to indicate which offloads is set. From the device perspective all the Tx offloads should be set. It did had a way to configure offloads with txqflags parameter, but this required queues reconfigurations. ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2018-01-09 6:47 ` Shahaf Shuler @ 2018-01-09 7:13 ` Lu, Wenzhuo 2018-01-09 10:02 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 7:13 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi Shahaf, > -----Original Message----- > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > Sent: Tuesday, January 9, 2018 2:48 PM > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing > <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new > Ethdev Tx offloads API > > Hi, > > Tuesday, January 9, 2018 7:28 AM, Lu, Wenzhuo: > > Hi Shahaf, > > > > > -----Original Message----- > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > > > Sent: Tuesday, December 26, 2017 5:44 PM > > > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > > > <ferruh.yigit@intel.com> > > > Cc: dev@dpdk.org > > > Subject: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new > > > Ethdev Tx offloads API > > > > > > Ethdev Tx offloads API has changed since: > > > > > > commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") > > > > > > Convert the application to use the new API. > > > > > > This patch mandates the port to be stopped when configure the Tx > > offloads. > > > This is because the PMD must be aware to the offloads changes on the > > > device and queue configuration. > > > > > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > > > --- > > > app/test-pmd/cmdline.c | 90 > > > ++++++++++++++++++++++++++++++++++++++++++--- > > > app/test-pmd/config.c | 55 ++++++++++++++++++--------- app/test- > > > pmd/testpmd.c | 3 ++ > > > 3 files changed, 124 insertions(+), 24 deletions(-) > > > > > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > > > d8c73a9b1..58125839a 100644 > > > --- a/app/test-pmd/cmdline.c > > > +++ b/app/test-pmd/cmdline.c > > > @@ -3439,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result, > > { > > > struct cmd_tx_vlan_set_result *res = parsed_result; > > > > > > + if (!port_is_stopped(res->port_id)) { > > > + printf("Please stop port %d first\n", res->port_id); > > > + return; > > > + } > > > + > > > tx_vlan_set(res->port_id, res->vlan_id); > > > + > > > + cmd_reconfig_device_queue(res->port_id, 1, 1); > > > } > > > > > I do have some concern about this behavior change, 'port_is_stopped' and > ' > > cmd_reconfig_device_queue '. > > 1, seems this behavior change is not necessary for using the new offload > API. > > Maybe splitting this patch to 2 is better. > > It is related. Because as part of the offloads API the Tx offloads configuration > is set on the rte_eth_dev_configure. To configure a device it must be > stopped in advance. > > Also, per my understanding, the only API which allows offloads configuration > on the flight are the Rx VLAN offloads. > As you can see, this API is respected and no need to check the port status in > it > > > 2, some NICs doesn't need to be stopped or re-configured to make vlan > > functions enabled. > > Only for the Rx vlan. The Tx vlan insert is not configured on the flight. > > That's why the original code doesn't have this restriction. > > Maybe figuring out a way to do the restriction in the driver layer is better. > > The original code doesn't have such restriction because testpmd wasn't > configuring Tx offloads at all. It used it's own Tx offloads enum (which I > removed on later patches) to indicate which offloads is set. From the device > perspective all the Tx offloads should be set. > It did had a way to configure offloads with txqflags parameter, but this > required queues reconfigurations. ' cmd_tx_vlan_set_parsed' is the function which configures TX vlan insertion. This patch adds the restriction in it. For example, on ixgbe it does support on the fly configuration. APP doesn't need to stop the device or reconfigure the queues. ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2018-01-09 7:13 ` Lu, Wenzhuo @ 2018-01-09 10:02 ` Shahaf Shuler 2018-01-09 11:37 ` Lu, Wenzhuo 0 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2018-01-09 10:02 UTC (permalink / raw) To: Lu, Wenzhuo, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Tuesday, January 9, 2018 9:14 AM, Lu, Wenzhuo: > > The original code doesn't have such restriction because testpmd wasn't > > configuring Tx offloads at all. It used it's own Tx offloads enum > > (which I removed on later patches) to indicate which offloads is set. > > From the device perspective all the Tx offloads should be set. > > It did had a way to configure offloads with txqflags parameter, but > > this required queues reconfigurations. > ' cmd_tx_vlan_set_parsed' is the function which configures TX vlan insertion. > This patch adds the restriction in it. > For example, on ixgbe it does support on the fly configuration. APP doesn't > need to stop the device or reconfigure the queues. What is mean is that in the old offloads API, all the Tx offloads were enabled by default, besides the ones which were masked with txqflags. This is why testpmd didn't have any limitation on changing the Tx offloads. All of them were enabled, it just needed to choose with which one to use. Now, with the new offloads API, the Tx offloads are disabled by default, and enabled per application need on device and queue configuration. In order to call device/queue configuration the port must be stopped. This is requirement from ethdev API. Now, there is an API in ethdev to configure Rx VLAN offloads on the flight for supported devices. If there are devices which supports it also in the Tx side, and you see a good use case for that, then need to think of new API in ethdev to configure Tx VLAN offloads on the flight. However, the plain conversion of testpmd from the old to the new API requires the port to be stopped for all of the Tx offloads. ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2018-01-09 10:02 ` Shahaf Shuler @ 2018-01-09 11:37 ` Lu, Wenzhuo 2018-01-09 12:14 ` Ananyev, Konstantin 0 siblings, 1 reply; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 11:37 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi Shahaf, > -----Original Message----- > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > Sent: Tuesday, January 9, 2018 6:02 PM > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing > <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new > Ethdev Tx offloads API > > Tuesday, January 9, 2018 9:14 AM, Lu, Wenzhuo: > > > The original code doesn't have such restriction because testpmd > > > wasn't configuring Tx offloads at all. It used it's own Tx offloads > > > enum (which I removed on later patches) to indicate which offloads is set. > > > From the device perspective all the Tx offloads should be set. > > > It did had a way to configure offloads with txqflags parameter, but > > > this required queues reconfigurations. > > ' cmd_tx_vlan_set_parsed' is the function which configures TX vlan > insertion. > > This patch adds the restriction in it. > > For example, on ixgbe it does support on the fly configuration. APP > > doesn't need to stop the device or reconfigure the queues. > > What is mean is that in the old offloads API, all the Tx offloads were enabled > by default, besides the ones which were masked with txqflags. > This is why testpmd didn't have any limitation on changing the Tx offloads. > All of them were enabled, it just needed to choose with which one to use. > > Now, with the new offloads API, the Tx offloads are disabled by default, and > enabled per application need on device and queue configuration. > In order to call device/queue configuration the port must be stopped. This is > requirement from ethdev API. > > Now, there is an API in ethdev to configure Rx VLAN offloads on the flight for > supported devices. > If there are devices which supports it also in the Tx side, and you see a good > use case for that, then need to think of new API in ethdev to configure Tx > VLAN offloads on the flight. > > However, the plain conversion of testpmd from the old to the new API > requires the port to be stopped for all of the Tx offloads. Let's just talk about TX vlan insertion. Actually there's no ethdev API for it. And no configuration for it. Because vlan insertion is simple, it only need to add a vlan tag when transmitting packets. You can see it's per packet thing. APP can set the ol_flags and vlan_tci in the mbuf of every packet to enable this function for the packet or not. I think it does be a on the fly function on any NIC. ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2018-01-09 11:37 ` Lu, Wenzhuo @ 2018-01-09 12:14 ` Ananyev, Konstantin 2018-01-10 0:37 ` Lu, Wenzhuo 0 siblings, 1 reply; 78+ messages in thread From: Ananyev, Konstantin @ 2018-01-09 12:14 UTC (permalink / raw) To: Lu, Wenzhuo, Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Lu, Wenzhuo > Sent: Tuesday, January 9, 2018 11:37 AM > To: Shahaf Shuler <shahafs@mellanox.com>; Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API > > Hi Shahaf, > > > -----Original Message----- > > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > > Sent: Tuesday, January 9, 2018 6:02 PM > > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing > > <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > > Cc: dev@dpdk.org > > Subject: RE: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new > > Ethdev Tx offloads API > > > > Tuesday, January 9, 2018 9:14 AM, Lu, Wenzhuo: > > > > The original code doesn't have such restriction because testpmd > > > > wasn't configuring Tx offloads at all. It used it's own Tx offloads > > > > enum (which I removed on later patches) to indicate which offloads is set. > > > > From the device perspective all the Tx offloads should be set. > > > > It did had a way to configure offloads with txqflags parameter, but > > > > this required queues reconfigurations. > > > ' cmd_tx_vlan_set_parsed' is the function which configures TX vlan > > insertion. > > > This patch adds the restriction in it. > > > For example, on ixgbe it does support on the fly configuration. APP > > > doesn't need to stop the device or reconfigure the queues. > > > > What is mean is that in the old offloads API, all the Tx offloads were enabled > > by default, besides the ones which were masked with txqflags. > > This is why testpmd didn't have any limitation on changing the Tx offloads. > > All of them were enabled, it just needed to choose with which one to use. > > > > Now, with the new offloads API, the Tx offloads are disabled by default, and > > enabled per application need on device and queue configuration. > > In order to call device/queue configuration the port must be stopped. This is > > requirement from ethdev API. > > > > Now, there is an API in ethdev to configure Rx VLAN offloads on the flight for > > supported devices. > > If there are devices which supports it also in the Tx side, and you see a good > > use case for that, then need to think of new API in ethdev to configure Tx > > VLAN offloads on the flight. > > > > However, the plain conversion of testpmd from the old to the new API > > requires the port to be stopped for all of the Tx offloads. > Let's just talk about TX vlan insertion. Actually there's no ethdev API for it. And no configuration for it. Because vlan insertion is simple, it > only need to add a vlan tag when transmitting packets. You still need an appropriate TX function be selected, otherwise mbuf->vlan_tci will be just ignored. So you still has to specify at queue_setup flag that you would like to have VLAN insertion offload enabled. Konstantin > You can see it's per packet thing. APP can set the ol_flags and vlan_tci in the mbuf of every packet to enable this function for the packet or > not. I think it does be a on the fly function on any NIC. ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API 2018-01-09 12:14 ` Ananyev, Konstantin @ 2018-01-10 0:37 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-10 0:37 UTC (permalink / raw) To: Ananyev, Konstantin, Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi Konstantin, > -----Original Message----- > From: Ananyev, Konstantin > Sent: Tuesday, January 9, 2018 8:15 PM > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Shahaf Shuler > <shahafs@mellanox.com>; Wu, Jingjing <jingjing.wu@intel.com>; Yigit, > Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new > Ethdev Tx offloads API > > > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Lu, Wenzhuo > > Sent: Tuesday, January 9, 2018 11:37 AM > > To: Shahaf Shuler <shahafs@mellanox.com>; Wu, Jingjing > > <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > > Cc: dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new > > Ethdev Tx offloads API > > > > Hi Shahaf, > > > > > -----Original Message----- > > > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > > > Sent: Tuesday, January 9, 2018 6:02 PM > > > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing > > > <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > > > Cc: dev@dpdk.org > > > Subject: RE: [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new > > > Ethdev Tx offloads API > > > > > > Tuesday, January 9, 2018 9:14 AM, Lu, Wenzhuo: > > > > > The original code doesn't have such restriction because testpmd > > > > > wasn't configuring Tx offloads at all. It used it's own Tx > > > > > offloads enum (which I removed on later patches) to indicate which > offloads is set. > > > > > From the device perspective all the Tx offloads should be set. > > > > > It did had a way to configure offloads with txqflags parameter, > > > > > but this required queues reconfigurations. > > > > ' cmd_tx_vlan_set_parsed' is the function which configures TX vlan > > > insertion. > > > > This patch adds the restriction in it. > > > > For example, on ixgbe it does support on the fly configuration. > > > > APP doesn't need to stop the device or reconfigure the queues. > > > > > > What is mean is that in the old offloads API, all the Tx offloads > > > were enabled by default, besides the ones which were masked with > txqflags. > > > This is why testpmd didn't have any limitation on changing the Tx > offloads. > > > All of them were enabled, it just needed to choose with which one to use. > > > > > > Now, with the new offloads API, the Tx offloads are disabled by > > > default, and enabled per application need on device and queue > configuration. > > > In order to call device/queue configuration the port must be > > > stopped. This is requirement from ethdev API. > > > > > > Now, there is an API in ethdev to configure Rx VLAN offloads on the > > > flight for supported devices. > > > If there are devices which supports it also in the Tx side, and you > > > see a good use case for that, then need to think of new API in > > > ethdev to configure Tx VLAN offloads on the flight. > > > > > > However, the plain conversion of testpmd from the old to the new API > > > requires the port to be stopped for all of the Tx offloads. > > Let's just talk about TX vlan insertion. Actually there's no ethdev > > API for it. And no configuration for it. Because vlan insertion is simple, it > only need to add a vlan tag when transmitting packets. > > You still need an appropriate TX function be selected, otherwise mbuf- > >vlan_tci will be just ignored. > So you still has to specify at queue_setup flag that you would like to have > VLAN insertion offload enabled. > Konstantin O, it's a good point. I didn't consider the TX path selection. Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > > > You can see it's per packet thing. APP can set the ol_flags and > > vlan_tci in the mbuf of every packet to enable this function for the packet > or not. I think it does be a on the fly function on any NIC. ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 05/10] app/testpmd: fix flowgen forwarding ol flags 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (3 preceding siblings ...) 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2018-01-09 5:35 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 06/10] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler ` (4 subsequent siblings) 9 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev, cchemparathy, stable The mbuf ol_flags were taken directly from testpmd internal enumeration leading to incorrect values. addressing only insertion offload flags as the checksum flags by the application design are only with csum forwarding. Fixes: e9e23a617eb8 ("app/testpmd: add flowgen forwarding engine") Cc: cchemparathy@tilera.com Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/flowgen.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index acf9af941..46478fc3a 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -123,7 +123,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; - uint16_t ol_flags; + uint64_t ol_flags; uint16_t nb_rx; uint16_t nb_tx; uint16_t nb_pkt; @@ -151,7 +151,13 @@ pkt_burst_flow_gen(struct fwd_stream *fs) mbp = current_fwd_lcore()->mbp; vlan_tci = ports[fs->tx_port].tx_vlan_id; vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer; - ol_flags = ports[fs->tx_port].tx_ol_flags; + + if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + ol_flags = PKT_TX_VLAN_PKT; + if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + ol_flags |= PKT_TX_QINQ_PKT; + if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp); -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 05/10] app/testpmd: fix flowgen forwarding ol flags 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler @ 2018-01-09 5:35 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 5:35 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev, stable Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 26, 2017 5:44 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > <ferruh.yigit@intel.com> > Cc: dev@dpdk.org; cchemparathy@tilera.com; stable@dpdk.org > Subject: [dpdk-dev] [PATCH v3 05/10] app/testpmd: fix flowgen forwarding ol > flags > > The mbuf ol_flags were taken directly from testpmd internal enumeration > leading to incorrect values. > > addressing only insertion offload flags as the checksum flags by the > application design are only with csum forwarding. > > Fixes: e9e23a617eb8 ("app/testpmd: add flowgen forwarding engine") > Cc: cchemparathy@tilera.com > Cc: stable@dpdk.org > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 06/10] app/testpmd: cleanup internal Tx offloads flags field 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (4 preceding siblings ...) 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2018-01-09 6:30 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 07/10] app/testpmd: add command line option for Tx offloads Shahaf Shuler ` (3 subsequent siblings) 9 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev The tx_ol_flags field was used in order to control the different Tx offloads set. After the conversion to the new Ethdev Tx offloads API it is not needed anymore as the offloads configuration is stored in ethdev structs. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 49 ++++++++++++++++---------------------------- app/test-pmd/config.c | 4 ---- app/test-pmd/csumonly.c | 40 ++++++++++++++++++------------------ app/test-pmd/flowgen.c | 8 +++++--- app/test-pmd/macfwd.c | 8 +++++--- app/test-pmd/macswap.c | 8 +++++--- app/test-pmd/testpmd.h | 22 +------------------- app/test-pmd/txonly.c | 8 +++++--- 8 files changed, 59 insertions(+), 88 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 58125839a..858482174 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3653,45 +3653,45 @@ static void csum_show(int port_id) { struct rte_eth_dev_info dev_info; - uint16_t ol_flags; + uint64_t tx_offloads; - ol_flags = ports[port_id].tx_ol_flags; + tx_offloads = ports[port_id].dev_conf.txmode.offloads; printf("Parse tunnel is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) ? "on" : "off"); + (ports[port_id].parse_tunnel) ? "on" : "off"); printf("IP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ? "hw" : "sw"); printf("UDP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); printf("TCP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); printf("SCTP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); printf("Outer-Ip checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ? "hw" : "sw"); /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(port_id, &dev_info); - if ((ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) { printf("Warning: hardware IP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) { printf("Warning: hardware UDP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) { printf("Warning: hardware TCP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) == 0) { printf("Warning: hardware SCTP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) == 0) { printf("Warning: hardware outer IP checksum enabled but not " "supported by port %d\n", port_id); @@ -3705,7 +3705,6 @@ cmd_csum_parsed(void *parsed_result, { struct cmd_csum_result *res = parsed_result; int hw = 0; - uint16_t mask = 0; uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { @@ -3723,28 +3722,21 @@ cmd_csum_parsed(void *parsed_result, hw = 1; if (!strcmp(res->proto, "ip")) { - mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { - mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { - mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { - mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { - mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } if (hw) { - ports[res->port_id].tx_ol_flags |= mask; ports[res->port_id].dev_conf.txmode.offloads |= csum_offloads; } else { - ports[res->port_id].tx_ol_flags &= (~mask); ports[res->port_id].dev_conf.txmode.offloads &= (~csum_offloads); } @@ -3821,11 +3813,9 @@ cmd_csum_tunnel_parsed(void *parsed_result, return; if (!strcmp(res->onoff, "on")) - ports[res->port_id].tx_ol_flags |= - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL; + ports[res->port_id].parse_tunnel = 1; else - ports[res->port_id].tx_ol_flags &= - (~TESTPMD_TX_OFFLOAD_PARSE_TUNNEL); + ports[res->port_id].parse_tunnel = 0; csum_show(res->port_id); } @@ -4025,12 +4015,11 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, */ check_tunnel_tso_nic_support(res->port_id); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL)) + if (!ports[res->port_id].parse_tunnel) printf("Warning: csum parse_tunnel must be set " "so that tunneled packets are recognized\n"); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)) + if (!(ports[res->port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)) printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } @@ -13082,7 +13071,6 @@ cmd_set_macsec_offload_on_parsed( return; } - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); @@ -13172,7 +13160,6 @@ cmd_set_macsec_offload_off_parsed( return; } - ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d0056fa69..29115e255 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2808,7 +2808,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) } tx_vlan_reset(port_id); - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; } @@ -2832,7 +2831,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) } tx_vlan_reset(port_id); - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; @@ -2843,8 +2841,6 @@ tx_vlan_reset(portid_t port_id) { if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | - TESTPMD_TX_OFFLOAD_INSERT_QINQ); ports[port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT); diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index aa29f5fc1..dbd2f9842 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -316,7 +316,7 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) * depending on the testpmd command line configuration */ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags) + uint64_t tx_offloads) { struct ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; @@ -347,7 +347,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->l4_proto == IPPROTO_TCP && tso_segsz) { ol_flags |= PKT_TX_IP_CKSUM; } else { - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ol_flags |= PKT_TX_IP_CKSUM; else ipv4_hdr->hdr_checksum = @@ -363,7 +363,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ol_flags |= PKT_TX_UDP_CKSUM; else { udp_hdr->dgram_cksum = @@ -376,7 +376,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; - else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ol_flags |= PKT_TX_TCP_CKSUM; else { tcp_hdr->cksum = @@ -390,7 +390,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ - if ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && ((ipv4_hdr->total_length & 0x3) == 0)) { ol_flags |= PKT_TX_SCTP_CKSUM; } else { @@ -405,7 +405,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, /* Calculate the checksum of outer header */ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags, int tso_enabled) + uint64_t tx_offloads, int tso_enabled) { struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; @@ -416,7 +416,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_OUTER_IPV4; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ol_flags |= PKT_TX_OUTER_IP_CKSUM; else ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); @@ -646,7 +646,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) uint16_t nb_prep; uint16_t i; uint64_t rx_ol_flags, tx_ol_flags; - uint16_t testpmd_ol_flags; + uint64_t tx_offloads; uint32_t retry; uint32_t rx_bad_ip_csum; uint32_t rx_bad_l4_csum; @@ -678,7 +678,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) gro_enable = gro_ports[fs->rx_port].enable; txp = &ports[fs->tx_port]; - testpmd_ol_flags = txp->tx_ol_flags; + tx_offloads = txp->dev_conf.txmode.offloads; memset(&info, 0, sizeof(info)); info.tso_segsz = txp->tso_segsz; info.tunnel_tso_segsz = txp->tunnel_tso_segsz; @@ -714,7 +714,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) l3_hdr = (char *)eth_hdr + info.l2_len; /* check if it's a supported tunnel */ - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) { + if (txp->parse_tunnel) { if (info.l4_proto == IPPROTO_UDP) { struct udp_hdr *udp_hdr; @@ -754,14 +754,14 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* process checksums of inner headers first */ tx_ol_flags |= process_inner_cksums(l3_hdr, &info, - testpmd_ol_flags); + tx_offloads); /* Then process outer headers if any. Note that the software * checksum will be wrong if one of the inner checksums is * processed in hardware. */ if (info.is_tunnel == 1) { tx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info, - testpmd_ol_flags, + tx_offloads, !!(tx_ol_flags & PKT_TX_TCP_SEG)); } @@ -769,8 +769,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) if (info.is_tunnel == 1) { if (info.tunnel_tso_segsz || - (testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + (tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) { m->outer_l2_len = info.outer_l2_len; m->outer_l3_len = info.outer_l3_len; @@ -832,17 +832,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) rte_be_to_cpu_16(info.outer_ethertype), info.outer_l3_len); /* dump tx packet info */ - if ((testpmd_ol_flags & (TESTPMD_TX_OFFLOAD_IP_CKSUM | - TESTPMD_TX_OFFLOAD_UDP_CKSUM | - TESTPMD_TX_OFFLOAD_TCP_CKSUM | - TESTPMD_TX_OFFLOAD_SCTP_CKSUM)) || + if ((tx_offloads & (DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_SCTP_CKSUM)) || info.tso_segsz != 0) printf("tx: m->l2_len=%d m->l3_len=%d " "m->l4_len=%d\n", m->l2_len, m->l3_len, m->l4_len); if (info.is_tunnel == 1) { - if ((testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + if ((tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) printf("tx: m->outer_l2_len=%d " "m->outer_l3_len=%d\n", diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 46478fc3a..0531b5d27 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -129,6 +129,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) uint16_t nb_pkt; uint16_t i; uint32_t retry; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -152,11 +153,12 @@ pkt_burst_flow_gen(struct fwd_stream *fs) vlan_tci = ports[fs->tx_port].tx_vlan_id; vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = ports[fs->tx_port].dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f4a4bf29a..56ee3cc0b 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -84,6 +84,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) uint16_t nb_tx; uint16_t i; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ pkt_burst_mac_forward(struct fwd_stream *fs) #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 721865c96..e2cc4812c 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -84,6 +84,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs) uint16_t i; uint32_t retry; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ pkt_burst_mac_swap(struct fwd_stream *fs) #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index ab74d39ce..c6baa1066 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -138,26 +138,6 @@ struct fwd_stream { #endif }; -/** Offload IP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_IP_CKSUM 0x0001 -/** Offload UDP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_UDP_CKSUM 0x0002 -/** Offload TCP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_TCP_CKSUM 0x0004 -/** Offload SCTP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_SCTP_CKSUM 0x0008 -/** Offload outer IP checksum in csum forward engine for recognized tunnels */ -#define TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM 0x0010 -/** Parse tunnel in csum forward engine. If set, dissect tunnel headers - * of rx packets. If not set, treat inner headers as payload. */ -#define TESTPMD_TX_OFFLOAD_PARSE_TUNNEL 0x0020 -/** Insert VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_VLAN 0x0040 -/** Insert double VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_QINQ 0x0080 -/** Offload MACsec in forward engine */ -#define TESTPMD_TX_OFFLOAD_MACSEC 0x0100 - /** Descriptor for a single flow. */ struct port_flow { size_t size; /**< Allocated space including data[]. */ @@ -215,7 +195,7 @@ struct rte_port { struct fwd_stream *rx_stream; /**< Port RX stream, if unique */ struct fwd_stream *tx_stream; /**< Port TX stream, if unique */ unsigned int socket_id; /**< For NUMA support */ - uint16_t tx_ol_flags;/**< TX Offload Flags (TESTPMD_TX_OFFLOAD...). */ + uint16_t parse_tunnel:1; /**< Parse internal headers */ uint16_t tso_segsz; /**< Segmentation offload MSS for non-tunneled packets. */ uint16_t tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */ uint16_t tx_vlan_id;/**< The tag ID */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 4ce4d61cc..5b5e4dff8 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -194,6 +194,7 @@ pkt_burst_transmit(struct fwd_stream *fs) uint32_t retry; uint64_t ol_flags = 0; uint8_t i; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -207,13 +208,14 @@ pkt_burst_transmit(struct fwd_stream *fs) mbp = current_fwd_lcore()->mbp; txp = &ports[fs->tx_port]; + tx_offloads = txp->dev_conf.txmode.offloads; vlan_tci = txp->tx_vlan_id; vlan_tci_outer = txp->tx_vlan_id_outer; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp); -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 06/10] app/testpmd: cleanup internal Tx offloads flags field 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 06/10] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler @ 2018-01-09 6:30 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 6:30 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 26, 2017 5:44 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 06/10] app/testpmd: cleanup internal Tx > offloads flags field > > The tx_ol_flags field was used in order to control the different Tx offloads > set. After the conversion to the new Ethdev Tx offloads API it is not needed > anymore as the offloads configuration is stored in ethdev structs. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > --- > app/test-pmd/cmdline.c | 49 ++++++++++++++++---------------------------- > app/test-pmd/config.c | 4 ---- > app/test-pmd/csumonly.c | 40 ++++++++++++++++++------------------ > app/test-pmd/flowgen.c | 8 +++++--- > app/test-pmd/macfwd.c | 8 +++++--- > app/test-pmd/macswap.c | 8 +++++--- > app/test-pmd/testpmd.h | 22 +------------------- > app/test-pmd/txonly.c | 8 +++++--- > 8 files changed, 59 insertions(+), 88 deletions(-) > > +195,7 @@ struct rte_port { > struct fwd_stream *rx_stream; /**< Port RX stream, if unique */ > struct fwd_stream *tx_stream; /**< Port TX stream, if unique */ > unsigned int socket_id; /**< For NUMA support */ > - uint16_t tx_ol_flags;/**< TX Offload Flags > (TESTPMD_TX_OFFLOAD...). */ > + uint16_t parse_tunnel:1; /**< Parse internal headers This flag looks a little incongruous here, but anyway we have to have it. Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 07/10] app/testpmd: add command line option for Tx offloads 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (5 preceding siblings ...) 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 06/10] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags Shahaf Shuler ` (2 subsequent siblings) 9 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev This patch adds command line option to set hex value for the ports Tx offloads flags. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/parameters.c | 17 +++++++++++++++-- app/test-pmd/testpmd.c | 4 ++++ app/test-pmd/testpmd.h | 2 ++ doc/guides/testpmd_app_ug/run_app.rst | 5 +++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 263651cba..58889420f 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -99,7 +99,7 @@ usage(char* progname) "--rss-ip | --rss-udp | " "--rxpt= | --rxht= | --rxwt= | --rxfreet= | " "--txpt= | --txht= | --txwt= | --txfreet= | " - "--txrst= | --txqflags= ]\n", + "--txrst= | --txqflags= | --tx-offloads ]\n", progname); #ifdef RTE_LIBRTE_CMDLINE printf(" --interactive: run in interactive mode.\n"); @@ -216,6 +216,7 @@ usage(char* progname) "disable print of designated event or all of them.\n"); printf(" --flow-isolate-all: " "requests flow API isolated mode on all ports at initialization time.\n"); + printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n"); } #ifdef RTE_LIBRTE_CMDLINE @@ -566,8 +567,9 @@ launch_args_parse(int argc, char** argv) char **argvopt; int opt_idx; enum { TX, RX }; - /* Default Rx offloads for all ports. */ + /* Default offloads for all ports. */ uint64_t rx_offloads = rx_mode.offloads; + uint64_t tx_offloads = tx_mode.offloads; static struct option lgopts[] = { { "help", 0, 0, 0 }, @@ -645,6 +647,7 @@ launch_args_parse(int argc, char** argv) { "no-rmv-interrupt", 0, 0, 0 }, { "print-event", 1, 0, 0 }, { "mask-event", 1, 0, 0 }, + { "tx-offloads", 1, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1116,6 +1119,15 @@ launch_args_parse(int argc, char** argv) rmv_interrupt = 0; if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all")) flow_isolate_all = 1; + if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) { + char *end = NULL; + n = strtoull(optarg, &end, 16); + if (n >= 0) + tx_offloads = (uint64_t)n; + else + rte_exit(EXIT_FAILURE, + "tx-offloads must be >= 0\n"); + } if (!strcmp(lgopts[opt_idx].name, "print-event")) if (parse_event_printing_config(optarg, 1)) { rte_exit(EXIT_FAILURE, @@ -1142,4 +1154,5 @@ launch_args_parse(int argc, char** argv) /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; + tx_mode.offloads = tx_offloads; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 0087438bc..806548196 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -344,6 +344,8 @@ struct rte_eth_rxmode rx_mode = { .ignore_offload_bitfield = 1, }; +struct rte_eth_txmode tx_mode; + struct rte_fdir_conf fdir_conf = { .mode = RTE_FDIR_MODE_NONE, .pballoc = RTE_FDIR_PBALLOC_64K, @@ -604,6 +606,8 @@ init_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; + /* Apply default Tx configuration for all ports */ + port->dev_conf.txmode = tx_mode; rte_eth_dev_info_get(pid, &port->dev_info); if (numa_support) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index c6baa1066..3e63edfa1 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -395,6 +395,8 @@ extern portid_t fwd_ports_ids[RTE_MAX_ETHPORTS]; extern struct rte_port *ports; extern struct rte_eth_rxmode rx_mode; +extern struct rte_eth_txmode tx_mode; + extern uint64_t rss_hf; extern queueid_t nb_rxq; diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 4c0d2cede..fface6f58 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -509,3 +509,8 @@ The commandline options are: configured flow rules only (see flow command). Ports that do not support this mode are automatically discarded. + +* ``--tx-offloads=0xXXXXXXXX`` + + Set the hexadecimal bitmask of TX queue offloads. + The default value is 0. -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (6 preceding siblings ...) 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 07/10] app/testpmd: add command line option for Tx offloads Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2018-01-09 7:17 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 09/10] app/testpmd: enforce offloads caps Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN configuration Shahaf Shuler 9 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev Since testpmd is now using the new Ethdev offloads API and there is a way configure each of the tx offloads from CLI or command line, there is no need for the txqflags configuration anymore. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> --- app/test-pmd/cmdline.c | 69 ------------------------ app/test-pmd/config.c | 7 +-- app/test-pmd/parameters.c | 14 +---- app/test-pmd/testpmd.c | 8 --- app/test-pmd/testpmd.h | 1 - doc/guides/testpmd_app_ug/run_app.rst | 12 ----- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ---- 7 files changed, 3 insertions(+), 119 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 858482174..b4ef1d0eb 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3092,74 +3092,6 @@ cmdline_parse_inst_t cmd_set_txsplit = { }, }; -/* *** CONFIG TX QUEUE FLAGS *** */ - -struct cmd_config_txqflags_result { - cmdline_fixed_string_t port; - cmdline_fixed_string_t config; - cmdline_fixed_string_t all; - cmdline_fixed_string_t what; - int32_t hexvalue; -}; - -static void cmd_config_txqflags_parsed(void *parsed_result, - __attribute__((unused)) struct cmdline *cl, - __attribute__((unused)) void *data) -{ - struct cmd_config_txqflags_result *res = parsed_result; - - if (!all_ports_stopped()) { - printf("Please stop all ports first\n"); - return; - } - - if (strcmp(res->what, "txqflags")) { - printf("Unknown parameter\n"); - return; - } - - if (res->hexvalue >= 0) { - txq_flags = res->hexvalue; - } else { - printf("txqflags must be >= 0\n"); - return; - } - - init_port_config(); - - cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); -} - -cmdline_parse_token_string_t cmd_config_txqflags_port = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, port, - "port"); -cmdline_parse_token_string_t cmd_config_txqflags_config = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, config, - "config"); -cmdline_parse_token_string_t cmd_config_txqflags_all = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, all, - "all"); -cmdline_parse_token_string_t cmd_config_txqflags_what = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, what, - "txqflags"); -cmdline_parse_token_num_t cmd_config_txqflags_value = - TOKEN_NUM_INITIALIZER(struct cmd_config_txqflags_result, - hexvalue, INT32); - -cmdline_parse_inst_t cmd_config_txqflags = { - .f = cmd_config_txqflags_parsed, - .data = NULL, - .help_str = "port config all txqflags <value>", - .tokens = { - (void *)&cmd_config_txqflags_port, - (void *)&cmd_config_txqflags_config, - (void *)&cmd_config_txqflags_all, - (void *)&cmd_config_txqflags_what, - (void *)&cmd_config_txqflags_value, - NULL, - }, -}; - /* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */ struct cmd_rx_vlan_filter_all_result { cmdline_fixed_string_t rx_vlan; @@ -15709,7 +15641,6 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_config_rx_mode_flag, (cmdline_parse_inst_t *)&cmd_config_rss, (cmdline_parse_inst_t *)&cmd_config_rxtx_queue, - (cmdline_parse_inst_t *)&cmd_config_txqflags, (cmdline_parse_inst_t *)&cmd_config_rss_reta, (cmdline_parse_inst_t *)&cmd_showport_reta, (cmdline_parse_inst_t *)&cmd_config_burst, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 29115e255..faccb84ca 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -417,7 +417,6 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id) printf("\nTX writeback threshold: %hhu", qinfo.conf.tx_thresh.wthresh); printf("\nTX RS threshold: %hu", qinfo.conf.tx_rs_thresh); printf("\nTX free threshold: %hu", qinfo.conf.tx_free_thresh); - printf("\nTX flags: %#x", qinfo.conf.txq_flags); printf("\nTX deferred start: %s", (qinfo.conf.tx_deferred_start != 0) ? "on" : "off"); printf("\nNumber of TXDs: %hu", qinfo.nb_desc); @@ -1714,10 +1713,8 @@ rxtx_config_display(void) tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"" - " - TXQ offloads=0x%"PRIx64"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags, - tx_conf->offloads); + printf(" TX RS bit threshold=%d - TXQ offloads=0x%"PRIx64"\n", + tx_conf->tx_rs_thresh, tx_conf->offloads); } } diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 58889420f..fa547df66 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -99,7 +99,7 @@ usage(char* progname) "--rss-ip | --rss-udp | " "--rxpt= | --rxht= | --rxwt= | --rxfreet= | " "--txpt= | --txht= | --txwt= | --txfreet= | " - "--txrst= | --txqflags= | --tx-offloads ]\n", + "--txrst= | --tx-offloads ]\n", progname); #ifdef RTE_LIBRTE_CMDLINE printf(" --interactive: run in interactive mode.\n"); @@ -192,8 +192,6 @@ usage(char* progname) "(0 <= N <= value of txd).\n"); printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N " "(0 <= N <= value of txd).\n"); - printf(" --txqflags=0xXXXXXXXX: hexadecimal bitmask of TX queue flags " - "(0 <= N <= 0x7FFFFFFF).\n"); printf(" --tx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: " "tx queues statistics counters mapping " "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); @@ -632,7 +630,6 @@ launch_args_parse(int argc, char** argv) { "txwt", 1, 0, 0 }, { "txfreet", 1, 0, 0 }, { "txrst", 1, 0, 0 }, - { "txqflags", 1, 0, 0 }, { "rxpt", 1, 0, 0 }, { "rxht", 1, 0, 0 }, { "rxwt", 1, 0, 0 }, @@ -1006,15 +1003,6 @@ launch_args_parse(int argc, char** argv) else rte_exit(EXIT_FAILURE, "txrst must be >= 0\n"); } - if (!strcmp(lgopts[opt_idx].name, "txqflags")) { - char *end = NULL; - n = strtoul(optarg, &end, 16); - if (n >= 0) - txq_flags = (int32_t)n; - else - rte_exit(EXIT_FAILURE, - "txqflags must be >= 0\n"); - } if (!strcmp(lgopts[opt_idx].name, "rxd")) { n = atoi(optarg); if (n > 0) { diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 806548196..91dcb31c0 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -259,11 +259,6 @@ int16_t tx_free_thresh = RTE_PMD_PARAM_UNSET; int16_t tx_rs_thresh = RTE_PMD_PARAM_UNSET; /* - * Configurable value of TX queue flags. - */ -int32_t txq_flags = RTE_PMD_PARAM_UNSET; - -/* * Receive Side Scaling (RSS) configuration. */ uint64_t rss_hf = ETH_RSS_IP; /* RSS IP by default. */ @@ -2084,9 +2079,6 @@ rxtx_port_config(struct rte_port *port) if (tx_free_thresh != RTE_PMD_PARAM_UNSET) port->tx_conf.tx_free_thresh = tx_free_thresh; - - if (txq_flags != RTE_PMD_PARAM_UNSET) - port->tx_conf.txq_flags = txq_flags; } void diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 3e63edfa1..c9af41cfa 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -409,7 +409,6 @@ extern int16_t rx_free_thresh; extern int8_t rx_drop_en; extern int16_t tx_free_thresh; extern int16_t tx_rs_thresh; -extern int32_t txq_flags; extern uint8_t dcb_config; extern uint8_t dcb_test; diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index fface6f58..be9a2cdd1 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -447,18 +447,6 @@ The commandline options are: Set the transmit RS bit threshold of TX rings to N, where 0 <= N <= value of ``--txd``. The default value is 0. -* ``--txqflags=0xXXXXXXXX`` - - Set the hexadecimal bitmask of TX queue flags, where 0 <= N <= 0x7FFFFFFF. - The default value is 0. - - .. note:: - - When using hardware offload functions such as vlan or checksum - add ``txqflags=0`` to force the full-featured TX code path. - In some PMDs this may already be the default. - - * ``--rx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping)]`` Set the RX queues statistics counters mapping 0 <= mapping <= 15. diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 2b00be81c..7d3a7ae93 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -354,8 +354,6 @@ The available information categories are: also modify the default hierarchy or specify the new hierarchy through CLI for implementing QoS scheduler. Requires ``CONFIG_RTE_LIBRTE_PMD_SOFTNIC=y`` ``CONFIG_RTE_LIBRTE_SCHED=y``. -Note: TX timestamping is only available in the "Full Featured" TX path. To force ``testpmd`` into this mode set ``--txqflags=0``. - Example:: testpmd> set fwd rxonly @@ -1681,15 +1679,6 @@ RX scatter mode is off by default. The ``on`` option is equivalent to the ``--enable-scatter`` command-line option. -port config - TX queue flags -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Set a hexadecimal bitmap of TX queue flags for all ports:: - - testpmd> port config all txqflags value - -This command is equivalent to the ``--txqflags`` command-line option. - port config - RX Checksum ~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags Shahaf Shuler @ 2018-01-09 7:17 ` Lu, Wenzhuo 2018-01-09 10:07 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 7:17 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi Shahaf, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 26, 2017 5:44 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags > > Since testpmd is now using the new Ethdev offloads API and there is a way > configure each of the tx offloads from CLI or command line, there is no need > for the txqflags configuration anymore. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > 806548196..91dcb31c0 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -259,11 +259,6 @@ int16_t tx_free_thresh = RTE_PMD_PARAM_UNSET; > int16_t tx_rs_thresh = RTE_PMD_PARAM_UNSET; > > /* > - * Configurable value of TX queue flags. > - */ > -int32_t txq_flags = RTE_PMD_PARAM_UNSET; > - > -/* > * Receive Side Scaling (RSS) configuration. > */ > uint64_t rss_hf = ETH_RSS_IP; /* RSS IP by default. */ @@ -2084,9 +2079,6 > @@ rxtx_port_config(struct rte_port *port) > > if (tx_free_thresh != RTE_PMD_PARAM_UNSET) > port->tx_conf.tx_free_thresh = tx_free_thresh; > - > - if (txq_flags != RTE_PMD_PARAM_UNSET) > - port->tx_conf.txq_flags = txq_flags; I think we have some problem if just remove this code. Because port->tx_conf.txq_flags is used by many NICs. If txqflags is removed, all these NICs have to use the default value and have no chance to change it. I think it's a good idea to use tx-offloads to replace txqflags, but we may need to clear the drivers' code first. ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags 2018-01-09 7:17 ` Lu, Wenzhuo @ 2018-01-09 10:07 ` Shahaf Shuler 2018-01-09 11:51 ` Lu, Wenzhuo 0 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2018-01-09 10:07 UTC (permalink / raw) To: Lu, Wenzhuo, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Tuesday, January 9, 2018 9:17 AM, Lu, Wenzhuo: --Shahaf > -----Original Message----- > From: Lu, Wenzhuo [mailto:wenzhuo.lu@intel.com] > Sent: Tuesday, January 9, 2018 9:17 AM > To: Shahaf Shuler <shahafs@mellanox.com>; Wu, Jingjing > <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags > > Hi Shahaf, > > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > > Sent: Tuesday, December 26, 2017 5:44 PM > > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > > <ferruh.yigit@intel.com> > > Cc: dev@dpdk.org > > Subject: [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags > > > > Since testpmd is now using the new Ethdev offloads API and there is a > > way configure each of the tx offloads from CLI or command line, there > > is no need for the txqflags configuration anymore. > > > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > > Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> > > > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > > 806548196..91dcb31c0 100644 > > --- a/app/test-pmd/testpmd.c > > +++ b/app/test-pmd/testpmd.c > > @@ -259,11 +259,6 @@ int16_t tx_free_thresh = > RTE_PMD_PARAM_UNSET; > > int16_t tx_rs_thresh = RTE_PMD_PARAM_UNSET; > > > > /* > > - * Configurable value of TX queue flags. > > - */ > > -int32_t txq_flags = RTE_PMD_PARAM_UNSET; > > - > > -/* > > * Receive Side Scaling (RSS) configuration. > > */ > > uint64_t rss_hf = ETH_RSS_IP; /* RSS IP by default. */ @@ -2084,9 > > +2079,6 @@ rxtx_port_config(struct rte_port *port) > > > > if (tx_free_thresh != RTE_PMD_PARAM_UNSET) > > port->tx_conf.tx_free_thresh = tx_free_thresh; > > - > > - if (txq_flags != RTE_PMD_PARAM_UNSET) > > - port->tx_conf.txq_flags = txq_flags; > I think we have some problem if just remove this code. Because port- > >tx_conf.txq_flags is used by many NICs. If txqflags is removed, all these > NICs have to use the default value and have no chance to change it. I think > it's a good idea to use tx-offloads to replace txqflags, but we may need to > clear the drivers' code first. There is an internal function in ethdev which do translation from the Tx offloads to the txqflags. Checkout ``rte_eth_convert_txq_offloads``. This is specifically to support PMDs which still use the old offloads API. So in fact application needs only to specify the Tx offloads on the tx_conf and those will be converted to txqflags. The PMD see no difference. ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags 2018-01-09 10:07 ` Shahaf Shuler @ 2018-01-09 11:51 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 11:51 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi Shahaf, > -----Original Message----- > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > Sent: Tuesday, January 9, 2018 6:08 PM > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing > <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags > > Tuesday, January 9, 2018 9:17 AM, Lu, Wenzhuo: > > --Shahaf > > > > -----Original Message----- > > From: Lu, Wenzhuo [mailto:wenzhuo.lu@intel.com] > > Sent: Tuesday, January 9, 2018 9:17 AM > > To: Shahaf Shuler <shahafs@mellanox.com>; Wu, Jingjing > > <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > > Cc: dev@dpdk.org > > Subject: RE: [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags > > > > Hi Shahaf, > > > > > -----Original Message----- > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > > > Sent: Tuesday, December 26, 2017 5:44 PM > > > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > > > <ferruh.yigit@intel.com> > > > Cc: dev@dpdk.org > > > Subject: [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags > > > > > > Since testpmd is now using the new Ethdev offloads API and there is > > > a way configure each of the tx offloads from CLI or command line, > > > there is no need for the txqflags configuration anymore. > > > > > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> > > > Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> > > > > > > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > > > 806548196..91dcb31c0 100644 > > > --- a/app/test-pmd/testpmd.c > > > +++ b/app/test-pmd/testpmd.c > > > @@ -259,11 +259,6 @@ int16_t tx_free_thresh = > > RTE_PMD_PARAM_UNSET; > > > int16_t tx_rs_thresh = RTE_PMD_PARAM_UNSET; > > > > > > /* > > > - * Configurable value of TX queue flags. > > > - */ > > > -int32_t txq_flags = RTE_PMD_PARAM_UNSET; > > > - > > > -/* > > > * Receive Side Scaling (RSS) configuration. > > > */ > > > uint64_t rss_hf = ETH_RSS_IP; /* RSS IP by default. */ @@ -2084,9 > > > +2079,6 @@ rxtx_port_config(struct rte_port *port) > > > > > > if (tx_free_thresh != RTE_PMD_PARAM_UNSET) > > > port->tx_conf.tx_free_thresh = tx_free_thresh; > > > - > > > - if (txq_flags != RTE_PMD_PARAM_UNSET) > > > - port->tx_conf.txq_flags = txq_flags; > > I think we have some problem if just remove this code. Because port- > > >tx_conf.txq_flags is used by many NICs. If txqflags is removed, all > > >these > > NICs have to use the default value and have no chance to change it. I > > think it's a good idea to use tx-offloads to replace txqflags, but we > > may need to clear the drivers' code first. > > There is an internal function in ethdev which do translation from the Tx > offloads to the txqflags. Checkout ``rte_eth_convert_txq_offloads``. > This is specifically to support PMDs which still use the old offloads API. > > So in fact application needs only to specify the Tx offloads on the tx_conf > and those will be converted to txqflags. The PMD see no difference. Yes, you're right, the convert code is already merged. Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 09/10] app/testpmd: enforce offloads caps 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (7 preceding siblings ...) 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2018-01-09 7:48 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN configuration Shahaf Shuler 9 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev In the current design it was possible for offload to be set even though the device is not supporting it. A warning message was printed instead. This is a wrong behaviour, as application should set only the offloads reported by the capabilities of the device. This patch adds verification for the offloads being set and make sure the offload configuration passed to the device always match its capabilities. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 103 +++++++++++++++++++++++++++++++++----------- app/test-pmd/config.c | 14 ++++++ 2 files changed, 92 insertions(+), 25 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b4ef1d0eb..d1b8dab6e 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3638,6 +3638,7 @@ cmd_csum_parsed(void *parsed_result, struct cmd_csum_result *res = parsed_result; int hw = 0; uint64_t csum_offloads = 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); @@ -3648,21 +3649,53 @@ cmd_csum_parsed(void *parsed_result, return; } + rte_eth_dev_info_get(res->port_id, &dev_info); if (!strcmp(res->mode, "set")) { if (!strcmp(res->hwsw, "hw")) hw = 1; if (!strcmp(res->proto, "ip")) { - csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_IPV4_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + } else { + printf("IP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "udp")) { - csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_UDP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + } else { + printf("UDP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "tcp")) { - csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_TCP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + } else { + printf("TCP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "sctp")) { - csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_SCTP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + } else { + printf("SCTP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "outer-ip")) { - csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { + csum_offloads |= + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + } else { + printf("Outer IP checksum offload is not " + "supported by port %u\n", res->port_id); + } } if (hw) { @@ -3805,6 +3838,14 @@ cmd_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; + rte_eth_dev_info_get(res->port_id, &dev_info); + if ((ports[res->port_id].tso_segsz != 0) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0) { + printf("Error: TSO is not supported by port %d\n", + res->port_id); + return; + } + if (ports[res->port_id].tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_TCP_TSO; @@ -3881,24 +3922,25 @@ struct cmd_tunnel_tso_set_result { portid_t port_id; }; -static void +static struct rte_eth_dev_info check_tunnel_tso_nic_support(portid_t port_id) { struct rte_eth_dev_info dev_info; rte_eth_dev_info_get(port_id, &dev_info); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO)) - printf("Warning: TSO enabled but VXLAN TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: VXLAN TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO)) - printf("Warning: TSO enabled but GRE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GRE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO)) - printf("Warning: TSO enabled but IPIP TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: IPIP TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO)) - printf("Warning: TSO enabled but GENEVE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GENEVE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); + return dev_info; } static void @@ -3907,6 +3949,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_tunnel_tso_set_result *res = parsed_result; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -3918,6 +3961,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; + dev_info = check_tunnel_tso_nic_support(res->port_id); if (ports[res->port_id].tunnel_tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | @@ -3926,11 +3970,13 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); } else { + uint64_t tso_offloads = (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + ports[res->port_id].dev_conf.txmode.offloads |= - (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | - DEV_TX_OFFLOAD_GRE_TNL_TSO | - DEV_TX_OFFLOAD_IPIP_TNL_TSO | - DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + (tso_offloads & dev_info.tx_offload_capa); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3945,7 +3991,6 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, * is not necessary for IPv6 tunneled pkts because there's no * checksum in IP header anymore. */ - check_tunnel_tso_nic_support(res->port_id); if (!ports[res->port_id].parse_tunnel) printf("Warning: csum parse_tunnel must be set " @@ -12995,6 +13040,7 @@ cmd_set_macsec_offload_on_parsed( portid_t port_id = res->port_id; int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0; int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -13003,15 +13049,19 @@ cmd_set_macsec_offload_on_parsed( return; } - ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); + ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif + } RTE_SET_USED(en); RTE_SET_USED(rp); switch (ret) { case 0: + ports[port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: @@ -13083,6 +13133,7 @@ cmd_set_macsec_offload_off_parsed( { struct cmd_macsec_offload_off_result *res = parsed_result; int ret = -ENOTSUP; + struct rte_eth_dev_info dev_info; portid_t port_id = res->port_id; if (port_id_is_invalid(port_id, ENABLED_WARN)) @@ -13092,14 +13143,16 @@ cmd_set_macsec_offload_off_parsed( return; } - ports[port_id].dev_conf.txmode.offloads &= - ~DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_disable(port_id); + ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif - + } switch (ret) { case 0: + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index faccb84ca..d32a4672b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2792,6 +2792,7 @@ void tx_vlan_set(portid_t port_id, uint16_t vlan_id) { int vlan_offload; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -2803,6 +2804,12 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) printf("Error, as QinQ has been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) { + printf("Error: vlan insert is not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; @@ -2813,6 +2820,7 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) { int vlan_offload; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -2826,6 +2834,12 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) printf("Error, as QinQ hasn't been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) { + printf("Error: qinq insert not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 09/10] app/testpmd: enforce offloads caps 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 09/10] app/testpmd: enforce offloads caps Shahaf Shuler @ 2018-01-09 7:48 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 7:48 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 26, 2017 5:44 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 09/10] app/testpmd: enforce offloads caps > > In the current design it was possible for offload to be set even though the > device is not supporting it. A warning message was printed instead. > > This is a wrong behaviour, as application should set only the offloads > reported by the capabilities of the device. > > This patch adds verification for the offloads being set and make sure the > offload configuration passed to the device always match its capabilities. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN configuration 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler ` (8 preceding siblings ...) 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 09/10] app/testpmd: enforce offloads caps Shahaf Shuler @ 2017-12-26 9:44 ` Shahaf Shuler 2018-01-09 8:05 ` Lu, Wenzhuo 9 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2017-12-26 9:44 UTC (permalink / raw) To: jingjing.wu, ferruh.yigit; +Cc: dev On ethdev there is an API to configure VLAN offloads after the port was started and without reconfiguration of the port or queues. In the current design of the application, when the Rx offloads are changed (through "port config all" CLI command) the port configuration is overwritten, therefore the configuration made for the VLAN is lost. This patch is to address the issue by a configuration of each port Rx offloads separately instead of using the global Rx config. Fixes: 6dbb2b336586 ("app/testpmd: convert to new Ethdev Rx offloads API") Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 217 +++++++++++++++++++++++--------------------- app/test-pmd/config.c | 27 ++++-- app/test-pmd/testpmd.c | 2 +- 3 files changed, 135 insertions(+), 111 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d1b8dab6e..00a229a41 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,34 +1577,38 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_max_pkt_len_result *res = parsed_result; - uint64_t rx_offloads = rx_mode.offloads; + portid_t pid; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); return; } - if (!strcmp(res->name, "max-pkt-len")) { - if (res->value < ETHER_MIN_LEN) { - printf("max-pkt-len can not be less than %d\n", - ETHER_MIN_LEN); + RTE_ETH_FOREACH_DEV(pid) { + struct rte_port *port = &ports[pid]; + uint64_t rx_offloads = port->dev_conf.rxmode.offloads; + + if (!strcmp(res->name, "max-pkt-len")) { + if (res->value < ETHER_MIN_LEN) { + printf("max-pkt-len can not be less than %d\n", + ETHER_MIN_LEN); + return; + } + if (res->value == port->dev_conf.rxmode.max_rx_pkt_len) + return; + + port->dev_conf.rxmode.max_rx_pkt_len = res->value; + if (res->value > ETHER_MAX_LEN) + rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; + else + rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; + port->dev_conf.rxmode.offloads = rx_offloads; + } else { + printf("Unknown parameter\n"); return; } - if (res->value == rx_mode.max_rx_pkt_len) - return; - - rx_mode.max_rx_pkt_len = res->value; - if (res->value > ETHER_MAX_LEN) - rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; - else - rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; - } else { - printf("Unknown parameter\n"); - return; } - rx_mode.offloads = rx_offloads; - init_port_config(); cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1706,103 +1710,108 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_rx_mode_flag *res = parsed_result; - uint64_t rx_offloads = rx_mode.offloads; + portid_t pid; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); return; } - if (!strcmp(res->name, "crc-strip")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "scatter")) { - if (!strcmp(res->value, "on")) { - rx_offloads |= DEV_RX_OFFLOAD_SCATTER; - } else if (!strcmp(res->value, "off")) { - rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + RTE_ETH_FOREACH_DEV(pid) { + struct rte_port *port; + uint64_t rx_offloads; + + port = &ports[pid]; + rx_offloads = port->dev_conf.rxmode.offloads; + if (!strcmp(res->name, "crc-strip")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "scatter")) { + if (!strcmp(res->value, "on")) { + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + } else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "rx-cksum")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "rx-timestamp")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan")) { + if (!strcmp(res->value, "on")) { + rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); + } else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-filter")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-strip")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-extend")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "drop-en")) { + if (!strcmp(res->value, "on")) + rx_drop_en = 1; + else if (!strcmp(res->value, "off")) + rx_drop_en = 0; + else { + printf("Unknown parameter\n"); + return; + } } else { printf("Unknown parameter\n"); return; } - } else if (!strcmp(res->name, "rx-cksum")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "rx-timestamp")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan")) { - if (!strcmp(res->value, "on")) { - rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | - DEV_RX_OFFLOAD_VLAN_STRIP); - } - else if (!strcmp(res->value, "off")) { - rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | - DEV_RX_OFFLOAD_VLAN_STRIP); - } - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-filter")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-strip")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-extend")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "drop-en")) { - if (!strcmp(res->value, "on")) - rx_drop_en = 1; - else if (!strcmp(res->value, "off")) - rx_drop_en = 0; - else { - printf("Unknown parameter\n"); - return; - } - } else { - printf("Unknown parameter\n"); - return; + port->dev_conf.rxmode.offloads = rx_offloads; } - rx_mode.offloads = rx_offloads; init_port_config(); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d32a4672b..da968cb64 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2665,21 +2665,26 @@ vlan_extend_set(portid_t port_id, int on) { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_EXTEND_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; + } else { vlan_offload &= ~ETH_VLAN_EXTEND_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } void @@ -2687,21 +2692,26 @@ rx_vlan_strip_set(portid_t port_id, int on) { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_STRIP_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } else { vlan_offload &= ~ETH_VLAN_STRIP_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } void @@ -2723,21 +2733,26 @@ rx_vlan_filter_set(portid_t port_id, int on) { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_FILTER_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; + } else { vlan_offload &= ~ETH_VLAN_FILTER_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } int diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 91dcb31c0..c1fb387fb 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -603,6 +603,7 @@ init_config(void) port = &ports[pid]; /* Apply default Tx configuration for all ports */ port->dev_conf.txmode = tx_mode; + port->dev_conf.rxmode = rx_mode; rte_eth_dev_info_get(pid, &port->dev_info); if (numa_support) { @@ -2089,7 +2090,6 @@ init_port_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; - port->dev_conf.rxmode = rx_mode; port->dev_conf.fdir_conf = fdir_conf; if (nb_rxq > 1) { port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL; -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN configuration 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN configuration Shahaf Shuler @ 2018-01-09 8:05 ` Lu, Wenzhuo 2018-01-09 10:03 ` Shahaf Shuler 0 siblings, 1 reply; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 8:05 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi Shahaf, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Tuesday, December 26, 2017 5:44 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Yigit, Ferruh > <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN > configuration > > On ethdev there is an API to configure VLAN offloads after the port was > started and without reconfiguration of the port or queues. > > In the current design of the application, when the Rx offloads are changed > (through "port config all" CLI command) the port configuration is overwritten, > therefore the configuration made for the VLAN is lost. > > This patch is to address the issue by a configuration of each port Rx offloads > separately instead of using the global Rx config. > > Fixes: 6dbb2b336586 ("app/testpmd: convert to new Ethdev Rx offloads API") This patch is not applied yet. The number 6dbb2b336586 could be meaningless. If the previous patch need to be fixed, may I suggest just merge this one to that? Or this patch fixes some older issues actually? ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN configuration 2018-01-09 8:05 ` Lu, Wenzhuo @ 2018-01-09 10:03 ` Shahaf Shuler 2018-01-09 11:44 ` Lu, Wenzhuo 0 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2018-01-09 10:03 UTC (permalink / raw) To: Lu, Wenzhuo, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Tuesday, January 9, 2018 10:06 AM, Lu, Wenzhuo: > > Subject: [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight > > VLAN configuration > > > > On ethdev there is an API to configure VLAN offloads after the port > > was started and without reconfiguration of the port or queues. > > > > In the current design of the application, when the Rx offloads are > > changed (through "port config all" CLI command) the port configuration > > is overwritten, therefore the configuration made for the VLAN is lost. > > > > This patch is to address the issue by a configuration of each port Rx > > offloads separately instead of using the global Rx config. > > > > Fixes: 6dbb2b336586 ("app/testpmd: convert to new Ethdev Rx offloads > > API") > This patch is not applied yet. The number 6dbb2b336586 could be > meaningless. If the previous patch need to be fixed, may I suggest just > merge this one to that? Or this patch fixes some older issues actually? Well, this was done per Ferruh's request to better split the patches. I can merge it with the Rx one, agreed? ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN configuration 2018-01-09 10:03 ` Shahaf Shuler @ 2018-01-09 11:44 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-09 11:44 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, Yigit, Ferruh; +Cc: dev Hi Shahaf, > -----Original Message----- > From: Shahaf Shuler [mailto:shahafs@mellanox.com] > Sent: Tuesday, January 9, 2018 6:04 PM > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing > <jingjing.wu@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight > VLAN configuration > > Tuesday, January 9, 2018 10:06 AM, Lu, Wenzhuo: > > > Subject: [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight > > > VLAN configuration > > > > > > On ethdev there is an API to configure VLAN offloads after the port > > > was started and without reconfiguration of the port or queues. > > > > > > In the current design of the application, when the Rx offloads are > > > changed (through "port config all" CLI command) the port > > > configuration is overwritten, therefore the configuration made for the > VLAN is lost. > > > > > > This patch is to address the issue by a configuration of each port > > > Rx offloads separately instead of using the global Rx config. > > > > > > Fixes: 6dbb2b336586 ("app/testpmd: convert to new Ethdev Rx offloads > > > API") > > This patch is not applied yet. The number 6dbb2b336586 could be > > meaningless. If the previous patch need to be fixed, may I suggest > > just merge this one to that? Or this patch fixes some older issues actually? > > Well, this was done per Ferruh's request to better split the patches. > > I can merge it with the Rx one, agreed? I think this patch fixes the bug in the old code. This bug is not introduced by "app/testpmd: convert to new Ethdev Rx offloads API". You set this fixes tag only because the code is changed so much by "app/testpmd: convert to new Ethdev Rx offloads API". It's helpful to create an individual patch. To my opinion, just remove the fixes tag is enough. ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API 2017-11-23 12:07 [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API Shahaf Shuler ` (5 preceding siblings ...) 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 01/11] app/testpmd: fix port configuration print Shahaf Shuler ` (11 more replies) 6 siblings, 12 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev This series is to convert testpmd application to the new offloads API [1]. on v4: - Enable FAST_FREE Tx offload by default if device supports. - Fix commit log for the VLAN configuration patch. on v3: - Remove warn prints on bad offloads configuration from application. on v2: - Splited the patchset to multiple patches to help with the review. - Removed wrong comments. - Removed redundent parenthesis. - Fixed port print parameters. - Introduced a new method to check if single port is stopped. - Cleanup for internal Tx offloads flags. [1] http://dpdk.org/ml/archives/dev/2017-October/077329.html Shahaf Shuler (11): app/testpmd: fix port configuration print app/testpmd: convert to new Ethdev Rx offloads API app/testpmd: support check of single port stop app/testpmd: convert to new Ethdev Tx offloads API app/testpmd: fix flowgen forwarding ol flags app/testpmd: cleanup internal Tx offloads flags field app/testpmd: add command line option for Tx offloads app/testpmd: remove txqflags app/testpmd: enforce offloads caps app/testpmd: adjust on the flight VLAN configuration app/testpmd: enable fast free Tx offload by default app/test-pmd/cmdline.c | 501 +++++++++++++---------- app/test-pmd/config.c | 177 +++++--- app/test-pmd/csumonly.c | 40 +- app/test-pmd/flowgen.c | 12 +- app/test-pmd/macfwd.c | 8 +- app/test-pmd/macswap.c | 8 +- app/test-pmd/parameters.c | 59 +-- app/test-pmd/testpmd.c | 58 +-- app/test-pmd/testpmd.h | 26 +- app/test-pmd/txonly.c | 8 +- doc/guides/testpmd_app_ug/run_app.rst | 17 +- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 - 12 files changed, 522 insertions(+), 403 deletions(-) -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 01/11] app/testpmd: fix port configuration print 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 02/11] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler ` (10 subsequent siblings) 11 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev, pablo.de.lara.guarch, stable The print of the port configuration was only according to configuration of the first port. Fixes: f2c5125a686a ("app/testpmd: use default Rx/Tx port configuration") Cc: pablo.de.lara.guarch@intel.com Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/config.c | 48 +++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 86ca3aaef..387fefbaa 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1656,33 +1656,45 @@ fwd_lcores_config_display(void) void rxtx_config_display(void) { - printf(" %s packet forwarding%s - CRC stripping %s - " - "packets/burst=%d\n", cur_fwd_eng->fwd_mode_name, + portid_t pid; + + printf(" %s packet forwarding%s packets/burst=%d\n", + cur_fwd_eng->fwd_mode_name, retry_enabled == 0 ? "" : " with retry", - rx_mode.hw_strip_crc ? "enabled" : "disabled", nb_pkt_per_burst); if (cur_fwd_eng == &tx_only_engine || cur_fwd_eng == &flow_gen_engine) printf(" packet len=%u - nb packet segments=%d\n", (unsigned)tx_pkt_length, (int) tx_pkt_nb_segs); - struct rte_eth_rxconf *rx_conf = &ports[0].rx_conf; - struct rte_eth_txconf *tx_conf = &ports[0].tx_conf; - printf(" nb forwarding cores=%d - nb forwarding ports=%d\n", nb_fwd_lcores, nb_fwd_ports); - printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", - nb_rxq, nb_rxd, rx_conf->rx_free_thresh); - printf(" RX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n", - rx_conf->rx_thresh.pthresh, rx_conf->rx_thresh.hthresh, - rx_conf->rx_thresh.wthresh); - printf(" TX queues=%d - TX desc=%d - TX free threshold=%d\n", - nb_txq, nb_txd, tx_conf->tx_free_thresh); - printf(" TX threshold registers: pthresh=%d hthresh=%d wthresh=%d\n", - tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, - tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + + RTE_ETH_FOREACH_DEV(pid) { + struct rte_eth_rxconf *rx_conf = &ports[pid].rx_conf; + struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf; + + printf(" port %d:\n", (unsigned int)pid); + printf(" CRC stripping %s\n", + ports[pid].dev_conf.rxmode.hw_strip_crc ? + "enabled" : "disabled"); + printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", + nb_rxq, nb_rxd, rx_conf->rx_free_thresh); + printf(" RX threshold registers: pthresh=%d hthresh=%d " + " wthresh=%d\n", + rx_conf->rx_thresh.pthresh, + rx_conf->rx_thresh.hthresh, + rx_conf->rx_thresh.wthresh); + printf(" TX queues=%d - TX desc=%d - TX free threshold=%d\n", + nb_txq, nb_txd, tx_conf->tx_free_thresh); + printf(" TX threshold registers: pthresh=%d hthresh=%d " + " wthresh=%d\n", + tx_conf->tx_thresh.pthresh, + tx_conf->tx_thresh.hthresh, + tx_conf->tx_thresh.wthresh); + printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", + tx_conf->tx_rs_thresh, tx_conf->txq_flags); + } } void -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 02/11] app/testpmd: convert to new Ethdev Rx offloads API 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 01/11] app/testpmd: fix port configuration print Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 03/11] app/testpmd: support check of single port stop Shahaf Shuler ` (9 subsequent siblings) 11 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") Convert the application to use the new API. The is no functionality changes rather simple conversion of the flags. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 51 +++++++++++++++++++++++------------------- app/test-pmd/config.c | 36 +++++++++++++++++++---------- app/test-pmd/parameters.c | 32 +++++++++++++------------- app/test-pmd/testpmd.c | 19 +++++++--------- 4 files changed, 77 insertions(+), 61 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f71d96301..d8c73a9b1 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,6 +1577,7 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_max_pkt_len_result *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1594,14 +1595,16 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, rx_mode.max_rx_pkt_len = res->value; if (res->value > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; else - rx_mode.jumbo_frame = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; } else { printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; + init_port_config(); cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1703,6 +1706,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_rx_mode_flag *res = parsed_result; + uint64_t rx_offloads = rx_mode.offloads; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); @@ -1711,48 +1715,48 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, if (!strcmp(res->name, "crc-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_strip_crc = 1; + rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "scatter")) { - if (!strcmp(res->value, "on")) - rx_mode.enable_scatter = 1; - else if (!strcmp(res->value, "off")) - rx_mode.enable_scatter = 0; - else { + if (!strcmp(res->value, "on")) { + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + } else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-cksum")) { if (!strcmp(res->value, "on")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; else if (!strcmp(res->value, "off")) - rx_mode.hw_ip_checksum = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "rx-timestamp")) { if (!strcmp(res->value, "on")) - rx_mode.hw_timestamp = 1; + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; else if (!strcmp(res->value, "off")) - rx_mode.hw_timestamp = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan")) { if (!strcmp(res->value, "on")) { - rx_mode.hw_vlan_filter = 1; - rx_mode.hw_vlan_strip = 1; + rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else if (!strcmp(res->value, "off")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); } else { printf("Unknown parameter\n"); @@ -1760,27 +1764,27 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, } } else if (!strcmp(res->name, "hw-vlan-filter")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_filter = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-strip")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_strip = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; else { printf("Unknown parameter\n"); return; } } else if (!strcmp(res->name, "hw-vlan-extend")) { if (!strcmp(res->value, "on")) - rx_mode.hw_vlan_extend = 1; + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; else if (!strcmp(res->value, "off")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; else { printf("Unknown parameter\n"); return; @@ -1798,6 +1802,7 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, printf("Unknown parameter\n"); return; } + rx_mode.offloads = rx_offloads; init_port_config(); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 387fefbaa..3bc99be76 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -540,14 +540,12 @@ port_infos_display(portid_t port_id) void port_offload_cap_display(portid_t port_id) { - struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; static const char *info_border = "************"; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - dev = &rte_eth_devices[port_id]; rte_eth_dev_info_get(port_id, &dev_info); printf("\n%s Port %d supported offload features: %s\n", @@ -555,7 +553,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) { printf("VLAN stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_strip) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_STRIP) printf("on\n"); else printf("off\n"); @@ -563,7 +562,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) { printf("Double VLANs stripped: "); - if (dev->data->dev_conf.rxmode.hw_vlan_extend) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_EXTEND) printf("on\n"); else printf("off\n"); @@ -571,7 +571,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) { printf("RX IPv4 checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -579,7 +580,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) { printf("RX UDP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n"); @@ -587,18 +589,26 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) { printf("RX TCP checksum: "); - if (dev->data->dev_conf.rxmode.hw_ip_checksum) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n"); } - if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) - printf("RX Outer IPv4 checksum: on"); + if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) { + printf("RX Outer IPv4 checksum: "); + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) + printf("on\n"); + else + printf("off\n"); + } if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) { printf("Large receive offload: "); - if (dev->data->dev_conf.rxmode.enable_lro) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TCP_LRO) printf("on\n"); else printf("off\n"); @@ -615,7 +625,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) { printf("HW timestamp: "); - if (dev->data->dev_conf.rxmode.hw_timestamp) + if (ports[port_id].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_TIMESTAMP) printf("on\n"); else printf("off\n"); @@ -1676,7 +1687,8 @@ rxtx_config_display(void) printf(" port %d:\n", (unsigned int)pid); printf(" CRC stripping %s\n", - ports[pid].dev_conf.rxmode.hw_strip_crc ? + (ports[pid].dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_CRC_STRIP) ? "enabled" : "disabled"); printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", nb_rxq, nb_rxd, rx_conf->rx_free_thresh); diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 84e7a63ef..263651cba 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -566,6 +566,8 @@ launch_args_parse(int argc, char** argv) char **argvopt; int opt_idx; enum { TX, RX }; + /* Default Rx offloads for all ports. */ + uint64_t rx_offloads = rx_mode.offloads; static struct option lgopts[] = { { "help", 0, 0, 0 }, @@ -804,7 +806,8 @@ launch_args_parse(int argc, char** argv) if (n >= ETHER_MIN_LEN) { rx_mode.max_rx_pkt_len = (uint32_t) n; if (n > ETHER_MAX_LEN) - rx_mode.jumbo_frame = 1; + rx_offloads |= + DEV_RX_OFFLOAD_JUMBO_FRAME; } else rte_exit(EXIT_FAILURE, "Invalid max-pkt-len=%d - should be > %d\n", @@ -897,34 +900,30 @@ launch_args_parse(int argc, char** argv) } #endif if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip")) - rx_mode.hw_strip_crc = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; if (!strcmp(lgopts[opt_idx].name, "enable-lro")) - rx_mode.enable_lro = 1; + rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO; if (!strcmp(lgopts[opt_idx].name, "enable-scatter")) - rx_mode.enable_scatter = 1; + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum")) - rx_mode.hw_ip_checksum = 1; + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; if (!strcmp(lgopts[opt_idx].name, "enable-rx-timestamp")) - rx_mode.hw_timestamp = 1; - - if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) { - rx_mode.hw_vlan_filter = 0; - rx_mode.hw_vlan_strip = 0; - rx_mode.hw_vlan_extend = 0; - } + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-filter")) - rx_mode.hw_vlan_filter = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-strip")) - rx_mode.hw_vlan_strip = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan-extend")) - rx_mode.hw_vlan_extend = 0; + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; if (!strcmp(lgopts[opt_idx].name, "enable-drop-en")) rx_drop_en = 1; @@ -1140,4 +1139,7 @@ launch_args_parse(int argc, char** argv) break; } } + + /* Set offload configuration from command line parameters. */ + rx_mode.offloads = rx_offloads; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index c3ab44849..6785b095f 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -338,15 +338,10 @@ lcoreid_t latencystats_lcore_id = -1; */ struct rte_eth_rxmode rx_mode = { .max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */ - .split_hdr_size = 0, - .header_split = 0, /**< Header Split disabled. */ - .hw_ip_checksum = 0, /**< IP checksum offload disabled. */ - .hw_vlan_filter = 1, /**< VLAN filtering enabled. */ - .hw_vlan_strip = 1, /**< VLAN strip enabled. */ - .hw_vlan_extend = 0, /**< Extended VLAN disabled. */ - .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */ - .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */ - .hw_timestamp = 0, /**< HW timestamp enabled. */ + .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP | + DEV_RX_OFFLOAD_CRC_STRIP), + .ignore_offload_bitfield = 1, }; struct rte_fdir_conf fdir_conf = { @@ -1521,6 +1516,8 @@ start_port(portid_t pid) port->need_reconfig_queues = 1; return -1; } + /* Apply Rx offloads configuration */ + port->rx_conf.offloads = port->dev_conf.rxmode.offloads; /* setup rx queues */ for (qi = 0; qi < nb_rxq; qi++) { if ((numa_support) && @@ -2252,7 +2249,7 @@ init_port_dcb_config(portid_t pid, retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en); if (retval < 0) return retval; - port_conf.rxmode.hw_vlan_filter = 1; + port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; /** * Write the configuration into the device. @@ -2301,7 +2298,7 @@ init_port_dcb_config(portid_t pid, rxtx_port_config(rte_port); /* VLAN filter */ - rte_port->dev_conf.rxmode.hw_vlan_filter = 1; + rte_port->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; for (i = 0; i < RTE_DIM(vlan_tags); i++) rx_vft_set(pid, vlan_tags[i], 1); -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 03/11] app/testpmd: support check of single port stop 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 01/11] app/testpmd: fix port configuration print Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 02/11] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 04/11] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler ` (8 subsequent siblings) 11 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev This patch adds supports for checking if a single port is stopped. currently there is a function to check only for all ports. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/testpmd.c | 16 ++++++++++++---- app/test-pmd/testpmd.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 6785b095f..77154ef3b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1394,15 +1394,23 @@ all_ports_started(void) } int +port_is_stopped(portid_t port_id) +{ + struct rte_port *port = &ports[port_id]; + + if ((port->port_status != RTE_PORT_STOPPED) && + (port->slave_flag == 0)) + return 0; + return 1; +} + +int all_ports_stopped(void) { portid_t pi; - struct rte_port *port; RTE_ETH_FOREACH_DEV(pi) { - port = &ports[pi]; - if ((port->port_status != RTE_PORT_STOPPED) && - (port->slave_flag == 0)) + if (!port_is_stopped(pi)) return 0; } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1639d27e7..ab74d39ce 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -682,6 +682,7 @@ void reset_port(portid_t pid); void attach_port(char *identifier); void detach_port(portid_t port_id); int all_ports_stopped(void); +int port_is_stopped(portid_t port_id); int port_is_started(portid_t port_id); void pmd_test_exit(void); void fdir_get_infos(portid_t port_id); -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 04/11] app/testpmd: convert to new Ethdev Tx offloads API 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler ` (2 preceding siblings ...) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 03/11] app/testpmd: support check of single port stop Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 05/11] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler ` (7 subsequent siblings) 11 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") Convert the application to use the new API. This patch mandates the port to be stopped when configure the Tx offloads. This is because the PMD must be aware to the offloads changes on the device and queue configuration. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 90 ++++++++++++++++++++++++++++++++++++++++++--- app/test-pmd/config.c | 55 ++++++++++++++++++--------- app/test-pmd/testpmd.c | 3 ++ 3 files changed, 124 insertions(+), 24 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d8c73a9b1..58125839a 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3439,7 +3439,14 @@ cmd_tx_vlan_set_parsed(void *parsed_result, { struct cmd_tx_vlan_set_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_vlan_set(res->port_id, res->vlan_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_tx_vlan = @@ -3486,7 +3493,14 @@ cmd_tx_vlan_set_qinq_parsed(void *parsed_result, { struct cmd_tx_vlan_set_qinq_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_qinq_set(res->port_id, res->vlan_id, res->vlan_id_outer); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_set_qinq_tx_vlan = @@ -3592,7 +3606,14 @@ cmd_tx_vlan_reset_parsed(void *parsed_result, { struct cmd_tx_vlan_reset_result *res = parsed_result; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } + tx_vlan_reset(res->port_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tx_vlan_reset_tx_vlan = @@ -3685,11 +3706,16 @@ cmd_csum_parsed(void *parsed_result, struct cmd_csum_result *res = parsed_result; int hw = 0; uint16_t mask = 0; + uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); return; } + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) { @@ -3698,22 +3724,34 @@ cmd_csum_parsed(void *parsed_result, if (!strcmp(res->proto, "ip")) { mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; + csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } - if (hw) + if (hw) { ports[res->port_id].tx_ol_flags |= mask; - else + ports[res->port_id].dev_conf.txmode.offloads |= + csum_offloads; + } else { ports[res->port_id].tx_ol_flags &= (~mask); + ports[res->port_id].dev_conf.txmode.offloads &= + (~csum_offloads); + } } csum_show(res->port_id); + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_csum_csum = @@ -3837,15 +3875,24 @@ cmd_tso_set_parsed(void *parsed_result, if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; - if (ports[res->port_id].tso_segsz == 0) + if (ports[res->port_id].tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_TCP_TSO; printf("TSO for non-tunneled packets is disabled\n"); - else + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_TCP_TSO; printf("TSO segment size for non-tunneled packets is %d\n", ports[res->port_id].tso_segsz); + } /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(res->port_id, &dev_info); @@ -3854,6 +3901,8 @@ cmd_tso_set_parsed(void *parsed_result, printf("Warning: TSO enabled but not " "supported by port %d\n", res->port_id); } + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tso_set_tso = @@ -3939,13 +3988,27 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (!port_is_stopped(res->port_id)) { + printf("Please stop port %d first\n", res->port_id); + return; + } if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; - if (ports[res->port_id].tunnel_tso_segsz == 0) + if (ports[res->port_id].tunnel_tso_segsz == 0) { + ports[res->port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); - else { + } else { + ports[res->port_id].dev_conf.txmode.offloads |= + (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3971,6 +4034,8 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } + + cmd_reconfig_device_queue(res->port_id, 1, 1); } cmdline_parse_token_string_t cmd_tunnel_tso_set_tso = @@ -13012,8 +13077,13 @@ cmd_set_macsec_offload_on_parsed( if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!port_is_stopped(port_id)) { + printf("Please stop port %d first\n", port_id); + return; + } ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif @@ -13022,6 +13092,7 @@ cmd_set_macsec_offload_on_parsed( switch (ret) { case 0: + cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); @@ -13096,14 +13167,21 @@ cmd_set_macsec_offload_off_parsed( if (port_id_is_invalid(port_id, ENABLED_WARN)) return; + if (!port_is_stopped(port_id)) { + printf("Please stop port %d first\n", port_id); + return; + } ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif switch (ret) { case 0: + cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: printf("invalid port_id %d\n", port_id); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 3bc99be76..d0056fa69 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -616,8 +616,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) { printf("VLAN insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VLAN_INSERT) printf("on\n"); else printf("off\n"); @@ -634,8 +634,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) { printf("Double VLANs insert: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_QINQ_INSERT) printf("on\n"); else printf("off\n"); @@ -643,7 +643,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) { printf("TX IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -651,7 +652,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) { printf("TX UDP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_CKSUM) printf("on\n"); else printf("off\n"); @@ -659,7 +661,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) { printf("TX TCP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_CKSUM) printf("on\n"); else printf("off\n"); @@ -667,7 +670,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) { printf("TX SCTP checksum: "); - if (ports[port_id].tx_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_SCTP_CKSUM) printf("on\n"); else printf("off\n"); @@ -675,8 +679,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { printf("TX Outer IPv4 checksum: "); - if (ports[port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) printf("on\n"); else printf("off\n"); @@ -684,7 +688,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) { printf("TX TCP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_TCP_TSO) printf("on\n"); else printf("off\n"); @@ -692,7 +697,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_TSO) { printf("TX UDP segmentation: "); - if (ports[port_id].tso_segsz != 0) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_UDP_TSO) printf("on\n"); else printf("off\n"); @@ -700,7 +706,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO) { printf("TSO for VXLAN tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_VXLAN_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -708,7 +715,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO) { printf("TSO for GRE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GRE_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -716,7 +724,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO) { printf("TSO for IPIP tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_IPIP_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -724,7 +733,8 @@ port_offload_cap_display(portid_t port_id) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO) { printf("TSO for GENEVE tunnel packet: "); - if (ports[port_id].tunnel_tso_segsz) + if (ports[port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_GENEVE_TNL_TSO) printf("on\n"); else printf("off\n"); @@ -1704,8 +1714,10 @@ rxtx_config_display(void) tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags); + printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"" + " - TXQ offloads=0x%"PRIx64"\n", + tx_conf->tx_rs_thresh, tx_conf->txq_flags, + tx_conf->offloads); } } @@ -2783,6 +2795,7 @@ void tx_vlan_set(portid_t port_id, uint16_t vlan_id) { int vlan_offload; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2796,6 +2809,7 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; } @@ -2803,6 +2817,7 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) { int vlan_offload; + if (port_id_is_invalid(port_id, ENABLED_WARN)) return; if (vlan_id_is_invalid(vlan_id)) @@ -2818,6 +2833,7 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) tx_vlan_reset(port_id); ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; + ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; } @@ -2829,6 +2845,9 @@ tx_vlan_reset(portid_t port_id) return; ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | TESTPMD_TX_OFFLOAD_INSERT_QINQ); + ports[port_id].dev_conf.txmode.offloads &= + ~(DEV_TX_OFFLOAD_VLAN_INSERT | + DEV_TX_OFFLOAD_QINQ_INSERT); ports[port_id].tx_vlan_id = 0; ports[port_id].tx_vlan_id_outer = 0; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 77154ef3b..0087438bc 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1498,6 +1498,9 @@ start_port(portid_t pid) } if (port->need_reconfig_queues > 0) { port->need_reconfig_queues = 0; + port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; + /* Apply Tx offloads configuration */ + port->tx_conf.offloads = port->dev_conf.txmode.offloads; /* setup tx queues */ for (qi = 0; qi < nb_txq; qi++) { if ((numa_support) && -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 05/11] app/testpmd: fix flowgen forwarding ol flags 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler ` (3 preceding siblings ...) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 04/11] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 06/11] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler ` (6 subsequent siblings) 11 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev, cchemparathy, stable The mbuf ol_flags were taken directly from testpmd internal enumeration leading to incorrect values. addressing only insertion offload flags as the checksum flags by the application design are only with csum forwarding. Fixes: e9e23a617eb8 ("app/testpmd: add flowgen forwarding engine") Cc: cchemparathy@tilera.com Cc: stable@dpdk.org Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/flowgen.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index acf9af941..46478fc3a 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -123,7 +123,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; - uint16_t ol_flags; + uint64_t ol_flags; uint16_t nb_rx; uint16_t nb_tx; uint16_t nb_pkt; @@ -151,7 +151,13 @@ pkt_burst_flow_gen(struct fwd_stream *fs) mbp = current_fwd_lcore()->mbp; vlan_tci = ports[fs->tx_port].tx_vlan_id; vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer; - ol_flags = ports[fs->tx_port].tx_ol_flags; + + if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + ol_flags = PKT_TX_VLAN_PKT; + if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + ol_flags |= PKT_TX_QINQ_PKT; + if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp); -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 06/11] app/testpmd: cleanup internal Tx offloads flags field 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler ` (4 preceding siblings ...) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 05/11] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 07/11] app/testpmd: add command line option for Tx offloads Shahaf Shuler ` (5 subsequent siblings) 11 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev The tx_ol_flags field was used in order to control the different Tx offloads set. After the conversion to the new Ethdev Tx offloads API it is not needed anymore as the offloads configuration is stored in ethdev structs. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 49 ++++++++++++++++---------------------------- app/test-pmd/config.c | 4 ---- app/test-pmd/csumonly.c | 40 ++++++++++++++++++------------------ app/test-pmd/flowgen.c | 8 +++++--- app/test-pmd/macfwd.c | 8 +++++--- app/test-pmd/macswap.c | 8 +++++--- app/test-pmd/testpmd.h | 22 +------------------- app/test-pmd/txonly.c | 8 +++++--- 8 files changed, 59 insertions(+), 88 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 58125839a..858482174 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3653,45 +3653,45 @@ static void csum_show(int port_id) { struct rte_eth_dev_info dev_info; - uint16_t ol_flags; + uint64_t tx_offloads; - ol_flags = ports[port_id].tx_ol_flags; + tx_offloads = ports[port_id].dev_conf.txmode.offloads; printf("Parse tunnel is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) ? "on" : "off"); + (ports[port_id].parse_tunnel) ? "on" : "off"); printf("IP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ? "hw" : "sw"); printf("UDP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ? "hw" : "sw"); printf("TCP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ? "hw" : "sw"); printf("SCTP checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) ? "hw" : "sw"); printf("Outer-Ip checksum offload is %s\n", - (ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ? "hw" : "sw"); + (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ? "hw" : "sw"); /* display warnings if configuration is not supported by the NIC */ rte_eth_dev_info_get(port_id, &dev_info); - if ((ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) { printf("Warning: hardware IP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) == 0) { printf("Warning: hardware UDP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) { printf("Warning: hardware TCP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_SCTP_CKSUM) == 0) { printf("Warning: hardware SCTP checksum enabled but not " "supported by port %d\n", port_id); } - if ((ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) && (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) == 0) { printf("Warning: hardware outer IP checksum enabled but not " "supported by port %d\n", port_id); @@ -3705,7 +3705,6 @@ cmd_csum_parsed(void *parsed_result, { struct cmd_csum_result *res = parsed_result; int hw = 0; - uint16_t mask = 0; uint64_t csum_offloads = 0; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { @@ -3723,28 +3722,21 @@ cmd_csum_parsed(void *parsed_result, hw = 1; if (!strcmp(res->proto, "ip")) { - mask = TESTPMD_TX_OFFLOAD_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; } else if (!strcmp(res->proto, "udp")) { - mask = TESTPMD_TX_OFFLOAD_UDP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; } else if (!strcmp(res->proto, "tcp")) { - mask = TESTPMD_TX_OFFLOAD_TCP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; } else if (!strcmp(res->proto, "sctp")) { - mask = TESTPMD_TX_OFFLOAD_SCTP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; } else if (!strcmp(res->proto, "outer-ip")) { - mask = TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM; csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; } if (hw) { - ports[res->port_id].tx_ol_flags |= mask; ports[res->port_id].dev_conf.txmode.offloads |= csum_offloads; } else { - ports[res->port_id].tx_ol_flags &= (~mask); ports[res->port_id].dev_conf.txmode.offloads &= (~csum_offloads); } @@ -3821,11 +3813,9 @@ cmd_csum_tunnel_parsed(void *parsed_result, return; if (!strcmp(res->onoff, "on")) - ports[res->port_id].tx_ol_flags |= - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL; + ports[res->port_id].parse_tunnel = 1; else - ports[res->port_id].tx_ol_flags &= - (~TESTPMD_TX_OFFLOAD_PARSE_TUNNEL); + ports[res->port_id].parse_tunnel = 0; csum_show(res->port_id); } @@ -4025,12 +4015,11 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, */ check_tunnel_tso_nic_support(res->port_id); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_PARSE_TUNNEL)) + if (!ports[res->port_id].parse_tunnel) printf("Warning: csum parse_tunnel must be set " "so that tunneled packets are recognized\n"); - if (!(ports[res->port_id].tx_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM)) + if (!(ports[res->port_id].dev_conf.txmode.offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM)) printf("Warning: csum set outer-ip must be set to hw " "if outer L3 is IPv4; not necessary for IPv6\n"); } @@ -13082,7 +13071,6 @@ cmd_set_macsec_offload_on_parsed( return; } - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); @@ -13172,7 +13160,6 @@ cmd_set_macsec_offload_off_parsed( return; } - ports[port_id].tx_ol_flags &= ~TESTPMD_TX_OFFLOAD_MACSEC; ports[port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_MACSEC_INSERT; #ifdef RTE_LIBRTE_IXGBE_PMD diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d0056fa69..29115e255 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2808,7 +2808,6 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) } tx_vlan_reset(port_id); - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_VLAN; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; ports[port_id].tx_vlan_id = vlan_id; } @@ -2832,7 +2831,6 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) } tx_vlan_reset(port_id); - ports[port_id].tx_ol_flags |= TESTPMD_TX_OFFLOAD_INSERT_QINQ; ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; ports[port_id].tx_vlan_id = vlan_id; ports[port_id].tx_vlan_id_outer = vlan_id_outer; @@ -2843,8 +2841,6 @@ tx_vlan_reset(portid_t port_id) { if (port_id_is_invalid(port_id, ENABLED_WARN)) return; - ports[port_id].tx_ol_flags &= ~(TESTPMD_TX_OFFLOAD_INSERT_VLAN | - TESTPMD_TX_OFFLOAD_INSERT_QINQ); ports[port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT); diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index aa29f5fc1..dbd2f9842 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -316,7 +316,7 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) * depending on the testpmd command line configuration */ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags) + uint64_t tx_offloads) { struct ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; @@ -347,7 +347,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->l4_proto == IPPROTO_TCP && tso_segsz) { ol_flags |= PKT_TX_IP_CKSUM; } else { - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) ol_flags |= PKT_TX_IP_CKSUM; else ipv4_hdr->hdr_checksum = @@ -363,7 +363,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_UDP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) ol_flags |= PKT_TX_UDP_CKSUM; else { udp_hdr->dgram_cksum = @@ -376,7 +376,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; - else if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_TCP_CKSUM) + else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) ol_flags |= PKT_TX_TCP_CKSUM; else { tcp_hdr->cksum = @@ -390,7 +390,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ - if ((testpmd_ol_flags & TESTPMD_TX_OFFLOAD_SCTP_CKSUM) && + if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && ((ipv4_hdr->total_length & 0x3) == 0)) { ol_flags |= PKT_TX_SCTP_CKSUM; } else { @@ -405,7 +405,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, /* Calculate the checksum of outer header */ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, - uint16_t testpmd_ol_flags, int tso_enabled) + uint64_t tx_offloads, int tso_enabled) { struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; @@ -416,7 +416,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_OUTER_IPV4; - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) ol_flags |= PKT_TX_OUTER_IP_CKSUM; else ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); @@ -646,7 +646,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) uint16_t nb_prep; uint16_t i; uint64_t rx_ol_flags, tx_ol_flags; - uint16_t testpmd_ol_flags; + uint64_t tx_offloads; uint32_t retry; uint32_t rx_bad_ip_csum; uint32_t rx_bad_l4_csum; @@ -678,7 +678,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) gro_enable = gro_ports[fs->rx_port].enable; txp = &ports[fs->tx_port]; - testpmd_ol_flags = txp->tx_ol_flags; + tx_offloads = txp->dev_conf.txmode.offloads; memset(&info, 0, sizeof(info)); info.tso_segsz = txp->tso_segsz; info.tunnel_tso_segsz = txp->tunnel_tso_segsz; @@ -714,7 +714,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) l3_hdr = (char *)eth_hdr + info.l2_len; /* check if it's a supported tunnel */ - if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_PARSE_TUNNEL) { + if (txp->parse_tunnel) { if (info.l4_proto == IPPROTO_UDP) { struct udp_hdr *udp_hdr; @@ -754,14 +754,14 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* process checksums of inner headers first */ tx_ol_flags |= process_inner_cksums(l3_hdr, &info, - testpmd_ol_flags); + tx_offloads); /* Then process outer headers if any. Note that the software * checksum will be wrong if one of the inner checksums is * processed in hardware. */ if (info.is_tunnel == 1) { tx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info, - testpmd_ol_flags, + tx_offloads, !!(tx_ol_flags & PKT_TX_TCP_SEG)); } @@ -769,8 +769,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) if (info.is_tunnel == 1) { if (info.tunnel_tso_segsz || - (testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + (tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) { m->outer_l2_len = info.outer_l2_len; m->outer_l3_len = info.outer_l3_len; @@ -832,17 +832,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) rte_be_to_cpu_16(info.outer_ethertype), info.outer_l3_len); /* dump tx packet info */ - if ((testpmd_ol_flags & (TESTPMD_TX_OFFLOAD_IP_CKSUM | - TESTPMD_TX_OFFLOAD_UDP_CKSUM | - TESTPMD_TX_OFFLOAD_TCP_CKSUM | - TESTPMD_TX_OFFLOAD_SCTP_CKSUM)) || + if ((tx_offloads & (DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM | + DEV_TX_OFFLOAD_SCTP_CKSUM)) || info.tso_segsz != 0) printf("tx: m->l2_len=%d m->l3_len=%d " "m->l4_len=%d\n", m->l2_len, m->l3_len, m->l4_len); if (info.is_tunnel == 1) { - if ((testpmd_ol_flags & - TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) || + if ((tx_offloads & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) || (tx_ol_flags & PKT_TX_OUTER_IPV6)) printf("tx: m->outer_l2_len=%d " "m->outer_l3_len=%d\n", diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 46478fc3a..0531b5d27 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -129,6 +129,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) uint16_t nb_pkt; uint16_t i; uint32_t retry; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -152,11 +153,12 @@ pkt_burst_flow_gen(struct fwd_stream *fs) vlan_tci = ports[fs->tx_port].tx_vlan_id; vlan_tci_outer = ports[fs->tx_port].tx_vlan_id_outer; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = ports[fs->tx_port].dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (ports[fs->tx_port].tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f4a4bf29a..56ee3cc0b 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -84,6 +84,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) uint16_t nb_tx; uint16_t i; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ pkt_burst_mac_forward(struct fwd_stream *fs) #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 721865c96..e2cc4812c 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -84,6 +84,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs) uint16_t i; uint32_t retry; uint64_t ol_flags = 0; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -107,11 +108,12 @@ pkt_burst_mac_swap(struct fwd_stream *fs) #endif fs->rx_packets += nb_rx; txp = &ports[fs->tx_port]; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + tx_offloads = txp->dev_conf.txmode.offloads; + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index ab74d39ce..c6baa1066 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -138,26 +138,6 @@ struct fwd_stream { #endif }; -/** Offload IP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_IP_CKSUM 0x0001 -/** Offload UDP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_UDP_CKSUM 0x0002 -/** Offload TCP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_TCP_CKSUM 0x0004 -/** Offload SCTP checksum in csum forward engine */ -#define TESTPMD_TX_OFFLOAD_SCTP_CKSUM 0x0008 -/** Offload outer IP checksum in csum forward engine for recognized tunnels */ -#define TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM 0x0010 -/** Parse tunnel in csum forward engine. If set, dissect tunnel headers - * of rx packets. If not set, treat inner headers as payload. */ -#define TESTPMD_TX_OFFLOAD_PARSE_TUNNEL 0x0020 -/** Insert VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_VLAN 0x0040 -/** Insert double VLAN header in forward engine */ -#define TESTPMD_TX_OFFLOAD_INSERT_QINQ 0x0080 -/** Offload MACsec in forward engine */ -#define TESTPMD_TX_OFFLOAD_MACSEC 0x0100 - /** Descriptor for a single flow. */ struct port_flow { size_t size; /**< Allocated space including data[]. */ @@ -215,7 +195,7 @@ struct rte_port { struct fwd_stream *rx_stream; /**< Port RX stream, if unique */ struct fwd_stream *tx_stream; /**< Port TX stream, if unique */ unsigned int socket_id; /**< For NUMA support */ - uint16_t tx_ol_flags;/**< TX Offload Flags (TESTPMD_TX_OFFLOAD...). */ + uint16_t parse_tunnel:1; /**< Parse internal headers */ uint16_t tso_segsz; /**< Segmentation offload MSS for non-tunneled packets. */ uint16_t tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */ uint16_t tx_vlan_id;/**< The tag ID */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 309c73893..418901c0c 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -193,6 +193,7 @@ pkt_burst_transmit(struct fwd_stream *fs) uint32_t retry; uint64_t ol_flags = 0; uint8_t i; + uint64_t tx_offloads; #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES uint64_t start_tsc; uint64_t end_tsc; @@ -206,13 +207,14 @@ pkt_burst_transmit(struct fwd_stream *fs) mbp = current_fwd_lcore()->mbp; txp = &ports[fs->tx_port]; + tx_offloads = txp->dev_conf.txmode.offloads; vlan_tci = txp->tx_vlan_id; vlan_tci_outer = txp->tx_vlan_id_outer; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_VLAN) + if (tx_offloads & DEV_TX_OFFLOAD_VLAN_INSERT) ol_flags = PKT_TX_VLAN_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_INSERT_QINQ) + if (tx_offloads & DEV_TX_OFFLOAD_QINQ_INSERT) ol_flags |= PKT_TX_QINQ_PKT; - if (txp->tx_ol_flags & TESTPMD_TX_OFFLOAD_MACSEC) + if (tx_offloads & DEV_TX_OFFLOAD_MACSEC_INSERT) ol_flags |= PKT_TX_MACSEC; for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { pkt = rte_mbuf_raw_alloc(mbp); -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 07/11] app/testpmd: add command line option for Tx offloads 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler ` (5 preceding siblings ...) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 06/11] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-15 3:06 ` Lu, Wenzhuo 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 08/11] app/testpmd: remove txqflags Shahaf Shuler ` (4 subsequent siblings) 11 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev This patch adds command line option to set hex value for the ports Tx offloads flags. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/parameters.c | 17 +++++++++++++++-- app/test-pmd/testpmd.c | 4 ++++ app/test-pmd/testpmd.h | 2 ++ doc/guides/testpmd_app_ug/run_app.rst | 5 +++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 263651cba..58889420f 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -99,7 +99,7 @@ usage(char* progname) "--rss-ip | --rss-udp | " "--rxpt= | --rxht= | --rxwt= | --rxfreet= | " "--txpt= | --txht= | --txwt= | --txfreet= | " - "--txrst= | --txqflags= ]\n", + "--txrst= | --txqflags= | --tx-offloads ]\n", progname); #ifdef RTE_LIBRTE_CMDLINE printf(" --interactive: run in interactive mode.\n"); @@ -216,6 +216,7 @@ usage(char* progname) "disable print of designated event or all of them.\n"); printf(" --flow-isolate-all: " "requests flow API isolated mode on all ports at initialization time.\n"); + printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n"); } #ifdef RTE_LIBRTE_CMDLINE @@ -566,8 +567,9 @@ launch_args_parse(int argc, char** argv) char **argvopt; int opt_idx; enum { TX, RX }; - /* Default Rx offloads for all ports. */ + /* Default offloads for all ports. */ uint64_t rx_offloads = rx_mode.offloads; + uint64_t tx_offloads = tx_mode.offloads; static struct option lgopts[] = { { "help", 0, 0, 0 }, @@ -645,6 +647,7 @@ launch_args_parse(int argc, char** argv) { "no-rmv-interrupt", 0, 0, 0 }, { "print-event", 1, 0, 0 }, { "mask-event", 1, 0, 0 }, + { "tx-offloads", 1, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1116,6 +1119,15 @@ launch_args_parse(int argc, char** argv) rmv_interrupt = 0; if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all")) flow_isolate_all = 1; + if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) { + char *end = NULL; + n = strtoull(optarg, &end, 16); + if (n >= 0) + tx_offloads = (uint64_t)n; + else + rte_exit(EXIT_FAILURE, + "tx-offloads must be >= 0\n"); + } if (!strcmp(lgopts[opt_idx].name, "print-event")) if (parse_event_printing_config(optarg, 1)) { rte_exit(EXIT_FAILURE, @@ -1142,4 +1154,5 @@ launch_args_parse(int argc, char** argv) /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; + tx_mode.offloads = tx_offloads; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 0087438bc..806548196 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -344,6 +344,8 @@ struct rte_eth_rxmode rx_mode = { .ignore_offload_bitfield = 1, }; +struct rte_eth_txmode tx_mode; + struct rte_fdir_conf fdir_conf = { .mode = RTE_FDIR_MODE_NONE, .pballoc = RTE_FDIR_PBALLOC_64K, @@ -604,6 +606,8 @@ init_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; + /* Apply default Tx configuration for all ports */ + port->dev_conf.txmode = tx_mode; rte_eth_dev_info_get(pid, &port->dev_info); if (numa_support) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index c6baa1066..3e63edfa1 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -395,6 +395,8 @@ extern portid_t fwd_ports_ids[RTE_MAX_ETHPORTS]; extern struct rte_port *ports; extern struct rte_eth_rxmode rx_mode; +extern struct rte_eth_txmode tx_mode; + extern uint64_t rss_hf; extern queueid_t nb_rxq; diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 4c0d2cede..fface6f58 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -509,3 +509,8 @@ The commandline options are: configured flow rules only (see flow command). Ports that do not support this mode are automatically discarded. + +* ``--tx-offloads=0xXXXXXXXX`` + + Set the hexadecimal bitmask of TX queue offloads. + The default value is 0. -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v4 07/11] app/testpmd: add command line option for Tx offloads 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 07/11] app/testpmd: add command line option for Tx offloads Shahaf Shuler @ 2018-01-15 3:06 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-15 3:06 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, thomas, Yigit, Ferruh; +Cc: dev Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Wednesday, January 10, 2018 5:09 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; thomas@monjalon.net; Yigit, > Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v4 07/11] app/testpmd: add command line > option for Tx offloads > > This patch adds command line option to set hex value for the ports Tx > offloads flags. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 08/11] app/testpmd: remove txqflags 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler ` (6 preceding siblings ...) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 07/11] app/testpmd: add command line option for Tx offloads Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 09/11] app/testpmd: enforce offloads caps Shahaf Shuler ` (3 subsequent siblings) 11 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev Since testpmd is now using the new Ethdev offloads API and there is a way configure each of the tx offloads from CLI or command line, there is no need for the txqflags configuration anymore. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 69 ------------------------ app/test-pmd/config.c | 7 +-- app/test-pmd/parameters.c | 14 +---- app/test-pmd/testpmd.c | 8 --- app/test-pmd/testpmd.h | 1 - doc/guides/testpmd_app_ug/run_app.rst | 12 ----- doc/guides/testpmd_app_ug/testpmd_funcs.rst | 11 ---- 7 files changed, 3 insertions(+), 119 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 858482174..b4ef1d0eb 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3092,74 +3092,6 @@ cmdline_parse_inst_t cmd_set_txsplit = { }, }; -/* *** CONFIG TX QUEUE FLAGS *** */ - -struct cmd_config_txqflags_result { - cmdline_fixed_string_t port; - cmdline_fixed_string_t config; - cmdline_fixed_string_t all; - cmdline_fixed_string_t what; - int32_t hexvalue; -}; - -static void cmd_config_txqflags_parsed(void *parsed_result, - __attribute__((unused)) struct cmdline *cl, - __attribute__((unused)) void *data) -{ - struct cmd_config_txqflags_result *res = parsed_result; - - if (!all_ports_stopped()) { - printf("Please stop all ports first\n"); - return; - } - - if (strcmp(res->what, "txqflags")) { - printf("Unknown parameter\n"); - return; - } - - if (res->hexvalue >= 0) { - txq_flags = res->hexvalue; - } else { - printf("txqflags must be >= 0\n"); - return; - } - - init_port_config(); - - cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); -} - -cmdline_parse_token_string_t cmd_config_txqflags_port = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, port, - "port"); -cmdline_parse_token_string_t cmd_config_txqflags_config = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, config, - "config"); -cmdline_parse_token_string_t cmd_config_txqflags_all = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, all, - "all"); -cmdline_parse_token_string_t cmd_config_txqflags_what = - TOKEN_STRING_INITIALIZER(struct cmd_config_txqflags_result, what, - "txqflags"); -cmdline_parse_token_num_t cmd_config_txqflags_value = - TOKEN_NUM_INITIALIZER(struct cmd_config_txqflags_result, - hexvalue, INT32); - -cmdline_parse_inst_t cmd_config_txqflags = { - .f = cmd_config_txqflags_parsed, - .data = NULL, - .help_str = "port config all txqflags <value>", - .tokens = { - (void *)&cmd_config_txqflags_port, - (void *)&cmd_config_txqflags_config, - (void *)&cmd_config_txqflags_all, - (void *)&cmd_config_txqflags_what, - (void *)&cmd_config_txqflags_value, - NULL, - }, -}; - /* *** ADD/REMOVE ALL VLAN IDENTIFIERS TO/FROM A PORT VLAN RX FILTER *** */ struct cmd_rx_vlan_filter_all_result { cmdline_fixed_string_t rx_vlan; @@ -15709,7 +15641,6 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_config_rx_mode_flag, (cmdline_parse_inst_t *)&cmd_config_rss, (cmdline_parse_inst_t *)&cmd_config_rxtx_queue, - (cmdline_parse_inst_t *)&cmd_config_txqflags, (cmdline_parse_inst_t *)&cmd_config_rss_reta, (cmdline_parse_inst_t *)&cmd_showport_reta, (cmdline_parse_inst_t *)&cmd_config_burst, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 29115e255..faccb84ca 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -417,7 +417,6 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id) printf("\nTX writeback threshold: %hhu", qinfo.conf.tx_thresh.wthresh); printf("\nTX RS threshold: %hu", qinfo.conf.tx_rs_thresh); printf("\nTX free threshold: %hu", qinfo.conf.tx_free_thresh); - printf("\nTX flags: %#x", qinfo.conf.txq_flags); printf("\nTX deferred start: %s", (qinfo.conf.tx_deferred_start != 0) ? "on" : "off"); printf("\nNumber of TXDs: %hu", qinfo.nb_desc); @@ -1714,10 +1713,8 @@ rxtx_config_display(void) tx_conf->tx_thresh.pthresh, tx_conf->tx_thresh.hthresh, tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d - TXQ flags=0x%"PRIx32"" - " - TXQ offloads=0x%"PRIx64"\n", - tx_conf->tx_rs_thresh, tx_conf->txq_flags, - tx_conf->offloads); + printf(" TX RS bit threshold=%d - TXQ offloads=0x%"PRIx64"\n", + tx_conf->tx_rs_thresh, tx_conf->offloads); } } diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 58889420f..fa547df66 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -99,7 +99,7 @@ usage(char* progname) "--rss-ip | --rss-udp | " "--rxpt= | --rxht= | --rxwt= | --rxfreet= | " "--txpt= | --txht= | --txwt= | --txfreet= | " - "--txrst= | --txqflags= | --tx-offloads ]\n", + "--txrst= | --tx-offloads ]\n", progname); #ifdef RTE_LIBRTE_CMDLINE printf(" --interactive: run in interactive mode.\n"); @@ -192,8 +192,6 @@ usage(char* progname) "(0 <= N <= value of txd).\n"); printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N " "(0 <= N <= value of txd).\n"); - printf(" --txqflags=0xXXXXXXXX: hexadecimal bitmask of TX queue flags " - "(0 <= N <= 0x7FFFFFFF).\n"); printf(" --tx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: " "tx queues statistics counters mapping " "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); @@ -632,7 +630,6 @@ launch_args_parse(int argc, char** argv) { "txwt", 1, 0, 0 }, { "txfreet", 1, 0, 0 }, { "txrst", 1, 0, 0 }, - { "txqflags", 1, 0, 0 }, { "rxpt", 1, 0, 0 }, { "rxht", 1, 0, 0 }, { "rxwt", 1, 0, 0 }, @@ -1006,15 +1003,6 @@ launch_args_parse(int argc, char** argv) else rte_exit(EXIT_FAILURE, "txrst must be >= 0\n"); } - if (!strcmp(lgopts[opt_idx].name, "txqflags")) { - char *end = NULL; - n = strtoul(optarg, &end, 16); - if (n >= 0) - txq_flags = (int32_t)n; - else - rte_exit(EXIT_FAILURE, - "txqflags must be >= 0\n"); - } if (!strcmp(lgopts[opt_idx].name, "rxd")) { n = atoi(optarg); if (n > 0) { diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 806548196..91dcb31c0 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -259,11 +259,6 @@ int16_t tx_free_thresh = RTE_PMD_PARAM_UNSET; int16_t tx_rs_thresh = RTE_PMD_PARAM_UNSET; /* - * Configurable value of TX queue flags. - */ -int32_t txq_flags = RTE_PMD_PARAM_UNSET; - -/* * Receive Side Scaling (RSS) configuration. */ uint64_t rss_hf = ETH_RSS_IP; /* RSS IP by default. */ @@ -2084,9 +2079,6 @@ rxtx_port_config(struct rte_port *port) if (tx_free_thresh != RTE_PMD_PARAM_UNSET) port->tx_conf.tx_free_thresh = tx_free_thresh; - - if (txq_flags != RTE_PMD_PARAM_UNSET) - port->tx_conf.txq_flags = txq_flags; } void diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 3e63edfa1..c9af41cfa 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -409,7 +409,6 @@ extern int16_t rx_free_thresh; extern int8_t rx_drop_en; extern int16_t tx_free_thresh; extern int16_t tx_rs_thresh; -extern int32_t txq_flags; extern uint8_t dcb_config; extern uint8_t dcb_test; diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index fface6f58..be9a2cdd1 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -447,18 +447,6 @@ The commandline options are: Set the transmit RS bit threshold of TX rings to N, where 0 <= N <= value of ``--txd``. The default value is 0. -* ``--txqflags=0xXXXXXXXX`` - - Set the hexadecimal bitmask of TX queue flags, where 0 <= N <= 0x7FFFFFFF. - The default value is 0. - - .. note:: - - When using hardware offload functions such as vlan or checksum - add ``txqflags=0`` to force the full-featured TX code path. - In some PMDs this may already be the default. - - * ``--rx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping)]`` Set the RX queues statistics counters mapping 0 <= mapping <= 15. diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 2b00be81c..7d3a7ae93 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -354,8 +354,6 @@ The available information categories are: also modify the default hierarchy or specify the new hierarchy through CLI for implementing QoS scheduler. Requires ``CONFIG_RTE_LIBRTE_PMD_SOFTNIC=y`` ``CONFIG_RTE_LIBRTE_SCHED=y``. -Note: TX timestamping is only available in the "Full Featured" TX path. To force ``testpmd`` into this mode set ``--txqflags=0``. - Example:: testpmd> set fwd rxonly @@ -1681,15 +1679,6 @@ RX scatter mode is off by default. The ``on`` option is equivalent to the ``--enable-scatter`` command-line option. -port config - TX queue flags -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Set a hexadecimal bitmap of TX queue flags for all ports:: - - testpmd> port config all txqflags value - -This command is equivalent to the ``--txqflags`` command-line option. - port config - RX Checksum ~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 09/11] app/testpmd: enforce offloads caps 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler ` (7 preceding siblings ...) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 08/11] app/testpmd: remove txqflags Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 10/11] app/testpmd: adjust on the flight VLAN configuration Shahaf Shuler ` (2 subsequent siblings) 11 siblings, 0 replies; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev In the current design it was possible for offload to be set even though the device is not supporting it. A warning message was printed instead. This is a wrong behaviour, as application should set only the offloads reported by the capabilities of the device. This patch adds verification for the offloads being set and make sure the offload configuration passed to the device always match its capabilities. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- app/test-pmd/cmdline.c | 103 +++++++++++++++++++++++++++++++++----------- app/test-pmd/config.c | 14 ++++++ 2 files changed, 92 insertions(+), 25 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b4ef1d0eb..d1b8dab6e 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3638,6 +3638,7 @@ cmd_csum_parsed(void *parsed_result, struct cmd_csum_result *res = parsed_result; int hw = 0; uint64_t csum_offloads = 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) { printf("invalid port %d\n", res->port_id); @@ -3648,21 +3649,53 @@ cmd_csum_parsed(void *parsed_result, return; } + rte_eth_dev_info_get(res->port_id, &dev_info); if (!strcmp(res->mode, "set")) { if (!strcmp(res->hwsw, "hw")) hw = 1; if (!strcmp(res->proto, "ip")) { - csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_IPV4_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + } else { + printf("IP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "udp")) { - csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_UDP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + } else { + printf("UDP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "tcp")) { - csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_TCP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_TCP_CKSUM; + } else { + printf("TCP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "sctp")) { - csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_SCTP_CKSUM) { + csum_offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM; + } else { + printf("SCTP checksum offload is not supported " + "by port %u\n", res->port_id); + } } else if (!strcmp(res->proto, "outer-ip")) { - csum_offloads |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + if (dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM) { + csum_offloads |= + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + } else { + printf("Outer IP checksum offload is not " + "supported by port %u\n", res->port_id); + } } if (hw) { @@ -3805,6 +3838,14 @@ cmd_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tso_segsz = res->tso_segsz; + rte_eth_dev_info_get(res->port_id, &dev_info); + if ((ports[res->port_id].tso_segsz != 0) && + (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0) { + printf("Error: TSO is not supported by port %d\n", + res->port_id); + return; + } + if (ports[res->port_id].tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_TCP_TSO; @@ -3881,24 +3922,25 @@ struct cmd_tunnel_tso_set_result { portid_t port_id; }; -static void +static struct rte_eth_dev_info check_tunnel_tso_nic_support(portid_t port_id) { struct rte_eth_dev_info dev_info; rte_eth_dev_info_get(port_id, &dev_info); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VXLAN_TNL_TSO)) - printf("Warning: TSO enabled but VXLAN TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: VXLAN TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GRE_TNL_TSO)) - printf("Warning: TSO enabled but GRE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GRE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_IPIP_TNL_TSO)) - printf("Warning: TSO enabled but IPIP TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: IPIP TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); if (!(dev_info.tx_offload_capa & DEV_TX_OFFLOAD_GENEVE_TNL_TSO)) - printf("Warning: TSO enabled but GENEVE TUNNEL TSO not " - "supported by port %d\n", port_id); + printf("Warning: GENEVE TUNNEL TSO not supported therefore " + "not enabled for port %d\n", port_id); + return dev_info; } static void @@ -3907,6 +3949,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_tunnel_tso_set_result *res = parsed_result; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; @@ -3918,6 +3961,7 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, if (!strcmp(res->mode, "set")) ports[res->port_id].tunnel_tso_segsz = res->tso_segsz; + dev_info = check_tunnel_tso_nic_support(res->port_id); if (ports[res->port_id].tunnel_tso_segsz == 0) { ports[res->port_id].dev_conf.txmode.offloads &= ~(DEV_TX_OFFLOAD_VXLAN_TNL_TSO | @@ -3926,11 +3970,13 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, DEV_TX_OFFLOAD_GENEVE_TNL_TSO); printf("TSO for tunneled packets is disabled\n"); } else { + uint64_t tso_offloads = (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | + DEV_TX_OFFLOAD_GRE_TNL_TSO | + DEV_TX_OFFLOAD_IPIP_TNL_TSO | + DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + ports[res->port_id].dev_conf.txmode.offloads |= - (DEV_TX_OFFLOAD_VXLAN_TNL_TSO | - DEV_TX_OFFLOAD_GRE_TNL_TSO | - DEV_TX_OFFLOAD_IPIP_TNL_TSO | - DEV_TX_OFFLOAD_GENEVE_TNL_TSO); + (tso_offloads & dev_info.tx_offload_capa); printf("TSO segment size for tunneled packets is %d\n", ports[res->port_id].tunnel_tso_segsz); @@ -3945,7 +3991,6 @@ cmd_tunnel_tso_set_parsed(void *parsed_result, * is not necessary for IPv6 tunneled pkts because there's no * checksum in IP header anymore. */ - check_tunnel_tso_nic_support(res->port_id); if (!ports[res->port_id].parse_tunnel) printf("Warning: csum parse_tunnel must be set " @@ -12995,6 +13040,7 @@ cmd_set_macsec_offload_on_parsed( portid_t port_id = res->port_id; int en = (strcmp(res->en_on_off, "on") == 0) ? 1 : 0; int rp = (strcmp(res->rp_on_off, "on") == 0) ? 1 : 0; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -13003,15 +13049,19 @@ cmd_set_macsec_offload_on_parsed( return; } - ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); + ret = rte_pmd_ixgbe_macsec_enable(port_id, en, rp); #endif + } RTE_SET_USED(en); RTE_SET_USED(rp); switch (ret) { case 0: + ports[port_id].dev_conf.txmode.offloads |= + DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: @@ -13083,6 +13133,7 @@ cmd_set_macsec_offload_off_parsed( { struct cmd_macsec_offload_off_result *res = parsed_result; int ret = -ENOTSUP; + struct rte_eth_dev_info dev_info; portid_t port_id = res->port_id; if (port_id_is_invalid(port_id, ENABLED_WARN)) @@ -13092,14 +13143,16 @@ cmd_set_macsec_offload_off_parsed( return; } - ports[port_id].dev_conf.txmode.offloads &= - ~DEV_TX_OFFLOAD_MACSEC_INSERT; + rte_eth_dev_info_get(port_id, &dev_info); + if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MACSEC_INSERT) { #ifdef RTE_LIBRTE_IXGBE_PMD - ret = rte_pmd_ixgbe_macsec_disable(port_id); + ret = rte_pmd_ixgbe_macsec_disable(port_id); #endif - + } switch (ret) { case 0: + ports[port_id].dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MACSEC_INSERT; cmd_reconfig_device_queue(port_id, 1, 1); break; case -ENODEV: diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index faccb84ca..d32a4672b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2792,6 +2792,7 @@ void tx_vlan_set(portid_t port_id, uint16_t vlan_id) { int vlan_offload; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -2803,6 +2804,12 @@ tx_vlan_set(portid_t port_id, uint16_t vlan_id) printf("Error, as QinQ has been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_VLAN_INSERT) == 0) { + printf("Error: vlan insert is not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_VLAN_INSERT; @@ -2813,6 +2820,7 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) { int vlan_offload; + struct rte_eth_dev_info dev_info; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; @@ -2826,6 +2834,12 @@ tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer) printf("Error, as QinQ hasn't been enabled.\n"); return; } + rte_eth_dev_info_get(port_id, &dev_info); + if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_QINQ_INSERT) == 0) { + printf("Error: qinq insert not supported by port %d\n", + port_id); + return; + } tx_vlan_reset(port_id); ports[port_id].dev_conf.txmode.offloads |= DEV_TX_OFFLOAD_QINQ_INSERT; -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 10/11] app/testpmd: adjust on the flight VLAN configuration 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler ` (8 preceding siblings ...) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 09/11] app/testpmd: enforce offloads caps Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-15 3:30 ` Lu, Wenzhuo 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 11/11] app/testpmd: enable fast free Tx offload by default Shahaf Shuler 2018-01-15 10:00 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Thomas Monjalon 11 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev On ethdev there is an API to configure VLAN offloads after the port was started and without reconfiguration of the port or queues. In the current design of the application, when the Rx offloads are changed (through "port config all" CLI command) the port configuration is overwritten, therefore the configuration made for the VLAN is lost. This patch is to address the issue by a configuration of each port Rx offloads separately instead of using the global Rx config. Such adjustment is required due to the conversion of the application to the new offloads API. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/cmdline.c | 217 +++++++++++++++++++++++--------------------- app/test-pmd/config.c | 27 ++++-- app/test-pmd/testpmd.c | 2 +- 3 files changed, 135 insertions(+), 111 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d1b8dab6e..00a229a41 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1577,34 +1577,38 @@ cmd_config_max_pkt_len_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_max_pkt_len_result *res = parsed_result; - uint64_t rx_offloads = rx_mode.offloads; + portid_t pid; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); return; } - if (!strcmp(res->name, "max-pkt-len")) { - if (res->value < ETHER_MIN_LEN) { - printf("max-pkt-len can not be less than %d\n", - ETHER_MIN_LEN); + RTE_ETH_FOREACH_DEV(pid) { + struct rte_port *port = &ports[pid]; + uint64_t rx_offloads = port->dev_conf.rxmode.offloads; + + if (!strcmp(res->name, "max-pkt-len")) { + if (res->value < ETHER_MIN_LEN) { + printf("max-pkt-len can not be less than %d\n", + ETHER_MIN_LEN); + return; + } + if (res->value == port->dev_conf.rxmode.max_rx_pkt_len) + return; + + port->dev_conf.rxmode.max_rx_pkt_len = res->value; + if (res->value > ETHER_MAX_LEN) + rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; + else + rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; + port->dev_conf.rxmode.offloads = rx_offloads; + } else { + printf("Unknown parameter\n"); return; } - if (res->value == rx_mode.max_rx_pkt_len) - return; - - rx_mode.max_rx_pkt_len = res->value; - if (res->value > ETHER_MAX_LEN) - rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; - else - rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME; - } else { - printf("Unknown parameter\n"); - return; } - rx_mode.offloads = rx_offloads; - init_port_config(); cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1706,103 +1710,108 @@ cmd_config_rx_mode_flag_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_rx_mode_flag *res = parsed_result; - uint64_t rx_offloads = rx_mode.offloads; + portid_t pid; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); return; } - if (!strcmp(res->name, "crc-strip")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "scatter")) { - if (!strcmp(res->value, "on")) { - rx_offloads |= DEV_RX_OFFLOAD_SCATTER; - } else if (!strcmp(res->value, "off")) { - rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + RTE_ETH_FOREACH_DEV(pid) { + struct rte_port *port; + uint64_t rx_offloads; + + port = &ports[pid]; + rx_offloads = port->dev_conf.rxmode.offloads; + if (!strcmp(res->name, "crc-strip")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "scatter")) { + if (!strcmp(res->value, "on")) { + rx_offloads |= DEV_RX_OFFLOAD_SCATTER; + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER; + } else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "rx-cksum")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "rx-timestamp")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan")) { + if (!strcmp(res->value, "on")) { + rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); + } else if (!strcmp(res->value, "off")) { + rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | + DEV_RX_OFFLOAD_VLAN_STRIP); + } else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-filter")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-strip")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "hw-vlan-extend")) { + if (!strcmp(res->value, "on")) + rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; + else if (!strcmp(res->value, "off")) + rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; + else { + printf("Unknown parameter\n"); + return; + } + } else if (!strcmp(res->name, "drop-en")) { + if (!strcmp(res->value, "on")) + rx_drop_en = 1; + else if (!strcmp(res->value, "off")) + rx_drop_en = 0; + else { + printf("Unknown parameter\n"); + return; + } } else { printf("Unknown parameter\n"); return; } - } else if (!strcmp(res->name, "rx-cksum")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "rx-timestamp")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan")) { - if (!strcmp(res->value, "on")) { - rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER | - DEV_RX_OFFLOAD_VLAN_STRIP); - } - else if (!strcmp(res->value, "off")) { - rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER | - DEV_RX_OFFLOAD_VLAN_STRIP); - } - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-filter")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-strip")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "hw-vlan-extend")) { - if (!strcmp(res->value, "on")) - rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; - else if (!strcmp(res->value, "off")) - rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; - else { - printf("Unknown parameter\n"); - return; - } - } else if (!strcmp(res->name, "drop-en")) { - if (!strcmp(res->value, "on")) - rx_drop_en = 1; - else if (!strcmp(res->value, "off")) - rx_drop_en = 0; - else { - printf("Unknown parameter\n"); - return; - } - } else { - printf("Unknown parameter\n"); - return; + port->dev_conf.rxmode.offloads = rx_offloads; } - rx_mode.offloads = rx_offloads; init_port_config(); diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d32a4672b..da968cb64 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2665,21 +2665,26 @@ vlan_extend_set(portid_t port_id, int on) { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_EXTEND_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND; + } else { vlan_offload &= ~ETH_VLAN_EXTEND_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } void @@ -2687,21 +2692,26 @@ rx_vlan_strip_set(portid_t port_id, int on) { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_STRIP_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP; + } else { vlan_offload &= ~ETH_VLAN_STRIP_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } void @@ -2723,21 +2733,26 @@ rx_vlan_filter_set(portid_t port_id, int on) { int diag; int vlan_offload; + uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads; if (port_id_is_invalid(port_id, ENABLED_WARN)) return; vlan_offload = rte_eth_dev_get_vlan_offload(port_id); - if (on) + if (on) { vlan_offload |= ETH_VLAN_FILTER_OFFLOAD; - else + port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER; + } else { vlan_offload &= ~ETH_VLAN_FILTER_OFFLOAD; + port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER; + } diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload); if (diag < 0) printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed " "diag=%d\n", port_id, on, diag); + ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads; } int diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 91dcb31c0..c1fb387fb 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -603,6 +603,7 @@ init_config(void) port = &ports[pid]; /* Apply default Tx configuration for all ports */ port->dev_conf.txmode = tx_mode; + port->dev_conf.rxmode = rx_mode; rte_eth_dev_info_get(pid, &port->dev_info); if (numa_support) { @@ -2089,7 +2090,6 @@ init_port_config(void) RTE_ETH_FOREACH_DEV(pid) { port = &ports[pid]; - port->dev_conf.rxmode = rx_mode; port->dev_conf.fdir_conf = fdir_conf; if (nb_rxq > 1) { port->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL; -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v4 10/11] app/testpmd: adjust on the flight VLAN configuration 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 10/11] app/testpmd: adjust on the flight VLAN configuration Shahaf Shuler @ 2018-01-15 3:30 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-15 3:30 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, thomas, Yigit, Ferruh; +Cc: dev Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Wednesday, January 10, 2018 5:09 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; thomas@monjalon.net; Yigit, > Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v4 10/11] app/testpmd: adjust on the flight VLAN > configuration > > On ethdev there is an API to configure VLAN offloads after the port was > started and without reconfiguration of the port or queues. > > In the current design of the application, when the Rx offloads are changed > (through "port config all" CLI command) the port configuration is overwritten, > therefore the configuration made for the VLAN is lost. > > This patch is to address the issue by a configuration of each port Rx offloads > separately instead of using the global Rx config. Such adjustment is required > due to the conversion of the application to the new offloads API. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* [dpdk-dev] [PATCH v4 11/11] app/testpmd: enable fast free Tx offload by default 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler ` (9 preceding siblings ...) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 10/11] app/testpmd: adjust on the flight VLAN configuration Shahaf Shuler @ 2018-01-10 9:09 ` Shahaf Shuler 2018-01-15 3:33 ` Lu, Wenzhuo 2018-01-15 10:00 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Thomas Monjalon 11 siblings, 1 reply; 78+ messages in thread From: Shahaf Shuler @ 2018-01-10 9:09 UTC (permalink / raw) To: jingjing.wu, thomas, ferruh.yigit; +Cc: dev Enable the DEV_TX_OFFLOAD_MBUF_FAST_FREE in case the underlying device supports. This is to preserve the previous offloads configuration made according to the PMD defaults. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> --- app/test-pmd/testpmd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index c1fb387fb..d6f69f5fa 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -339,7 +339,9 @@ struct rte_eth_rxmode rx_mode = { .ignore_offload_bitfield = 1, }; -struct rte_eth_txmode tx_mode; +struct rte_eth_txmode tx_mode = { + .offloads = DEV_TX_OFFLOAD_MBUF_FAST_FREE, +}; struct rte_fdir_conf fdir_conf = { .mode = RTE_FDIR_MODE_NONE, @@ -605,6 +607,10 @@ init_config(void) port->dev_conf.txmode = tx_mode; port->dev_conf.rxmode = rx_mode; rte_eth_dev_info_get(pid, &port->dev_info); + if (!(port->dev_info.tx_offload_capa & + DEV_TX_OFFLOAD_MBUF_FAST_FREE)) + port->dev_conf.txmode.offloads &= + ~DEV_TX_OFFLOAD_MBUF_FAST_FREE; if (numa_support) { if (port_numa[pid] != NUMA_NO_CONFIG) -- 2.12.0 ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v4 11/11] app/testpmd: enable fast free Tx offload by default 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 11/11] app/testpmd: enable fast free Tx offload by default Shahaf Shuler @ 2018-01-15 3:33 ` Lu, Wenzhuo 0 siblings, 0 replies; 78+ messages in thread From: Lu, Wenzhuo @ 2018-01-15 3:33 UTC (permalink / raw) To: Shahaf Shuler, Wu, Jingjing, thomas, Yigit, Ferruh; +Cc: dev Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shahaf Shuler > Sent: Wednesday, January 10, 2018 5:09 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; thomas@monjalon.net; Yigit, > Ferruh <ferruh.yigit@intel.com> > Cc: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v4 11/11] app/testpmd: enable fast free Tx > offload by default > > Enable the DEV_TX_OFFLOAD_MBUF_FAST_FREE in case the underlying > device supports. > > This is to preserve the previous offloads configuration made according to the > PMD defaults. > > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler ` (10 preceding siblings ...) 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 11/11] app/testpmd: enable fast free Tx offload by default Shahaf Shuler @ 2018-01-15 10:00 ` Thomas Monjalon 11 siblings, 0 replies; 78+ messages in thread From: Thomas Monjalon @ 2018-01-15 10:00 UTC (permalink / raw) To: Shahaf Shuler; +Cc: dev, jingjing.wu, ferruh.yigit > Shahaf Shuler (11): > app/testpmd: fix port configuration print > app/testpmd: convert to new Ethdev Rx offloads API > app/testpmd: support check of single port stop > app/testpmd: convert to new Ethdev Tx offloads API > app/testpmd: fix flowgen forwarding ol flags > app/testpmd: cleanup internal Tx offloads flags field > app/testpmd: add command line option for Tx offloads > app/testpmd: remove txqflags > app/testpmd: enforce offloads caps > app/testpmd: adjust on the flight VLAN configuration > app/testpmd: enable fast free Tx offload by default Applied, thanks ^ permalink raw reply [flat|nested] 78+ messages in thread
end of thread, other threads:[~2018-01-20 19:29 UTC | newest] Thread overview: 78+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-11-23 12:07 [dpdk-dev] [PATCH 0/5] convert testpmd to new ethdev offloads API Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 1/5] app/testpmd: convert to new Ethdev " Shahaf Shuler 2017-12-04 22:31 ` Ferruh Yigit 2017-12-05 6:39 ` Shahaf Shuler 2017-12-06 22:57 ` Ferruh Yigit 2017-12-07 7:55 ` Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 2/5] app/testpmd: remove txqflags Shahaf Shuler 2017-12-04 22:31 ` Ferruh Yigit 2017-12-05 6:48 ` Shahaf Shuler 2017-12-06 23:04 ` Ferruh Yigit 2017-12-07 7:56 ` Shahaf Shuler 2017-12-12 12:45 ` Maciej Czekaj 2017-12-13 7:25 ` Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 3/5] app/testpmd: add command line option for multiseg Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 4/5] app/testpmd: add command line option for mbuf fast free Shahaf Shuler 2017-11-23 12:08 ` [dpdk-dev] [PATCH 5/5] app/testpmd: enforce offloads caps Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 01/10] app/testpmd: fix port configuration print Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 03/10] app/testpmd: support check of single port stop Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler 2018-01-05 18:11 ` Maciej Czekaj 2018-01-07 15:24 ` Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler 2018-01-09 5:32 ` Lu, Wenzhuo 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 06/10] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 07/10] app/testpmd: add command line option for Tx offloads Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 08/10] app/testpmd: remove txqflags Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 09/10] app/testpmd: enforce offloads caps Shahaf Shuler 2017-12-12 12:52 ` [dpdk-dev] [PATCH v2 10/10] app/testpmd: fix on the flight VLAN configuration Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 00/10] convert testpmd to new ethdev offloads API Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 01/10] app/testpmd: fix port configuration print Shahaf Shuler 2018-01-05 3:33 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 02/10] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler 2018-01-09 3:05 ` Lu, Wenzhuo 2018-01-19 19:30 ` Patil, Harish 2018-01-20 19:29 ` Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 03/10] app/testpmd: support check of single port stop Shahaf Shuler 2018-01-09 3:20 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 04/10] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler 2018-01-09 5:27 ` Lu, Wenzhuo 2018-01-09 6:47 ` Shahaf Shuler 2018-01-09 7:13 ` Lu, Wenzhuo 2018-01-09 10:02 ` Shahaf Shuler 2018-01-09 11:37 ` Lu, Wenzhuo 2018-01-09 12:14 ` Ananyev, Konstantin 2018-01-10 0:37 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 05/10] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler 2018-01-09 5:35 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 06/10] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler 2018-01-09 6:30 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 07/10] app/testpmd: add command line option for Tx offloads Shahaf Shuler 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 08/10] app/testpmd: remove txqflags Shahaf Shuler 2018-01-09 7:17 ` Lu, Wenzhuo 2018-01-09 10:07 ` Shahaf Shuler 2018-01-09 11:51 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 09/10] app/testpmd: enforce offloads caps Shahaf Shuler 2018-01-09 7:48 ` Lu, Wenzhuo 2017-12-26 9:44 ` [dpdk-dev] [PATCH v3 10/10] app/testpmd: fix on the flight VLAN configuration Shahaf Shuler 2018-01-09 8:05 ` Lu, Wenzhuo 2018-01-09 10:03 ` Shahaf Shuler 2018-01-09 11:44 ` Lu, Wenzhuo 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 01/11] app/testpmd: fix port configuration print Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 02/11] app/testpmd: convert to new Ethdev Rx offloads API Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 03/11] app/testpmd: support check of single port stop Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 04/11] app/testpmd: convert to new Ethdev Tx offloads API Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 05/11] app/testpmd: fix flowgen forwarding ol flags Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 06/11] app/testpmd: cleanup internal Tx offloads flags field Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 07/11] app/testpmd: add command line option for Tx offloads Shahaf Shuler 2018-01-15 3:06 ` Lu, Wenzhuo 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 08/11] app/testpmd: remove txqflags Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 09/11] app/testpmd: enforce offloads caps Shahaf Shuler 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 10/11] app/testpmd: adjust on the flight VLAN configuration Shahaf Shuler 2018-01-15 3:30 ` Lu, Wenzhuo 2018-01-10 9:09 ` [dpdk-dev] [PATCH v4 11/11] app/testpmd: enable fast free Tx offload by default Shahaf Shuler 2018-01-15 3:33 ` Lu, Wenzhuo 2018-01-15 10:00 ` [dpdk-dev] [PATCH v4 00/11] convert testpmd to new ethdev offloads API Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).