diff --git a/0314-net-hns3-delete-duplicate-macro-definition.patch b/0314-net-hns3-delete-duplicate-macro-definition.patch new file mode 100644 index 0000000000000000000000000000000000000000..399af723403c2ca2a92fb3a07e4412a81177f8c2 --- /dev/null +++ b/0314-net-hns3-delete-duplicate-macro-definition.patch @@ -0,0 +1,39 @@ +From 23e949ca00f8ae9d84f650eb0b5bdca62c272199 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 29 Jun 2023 21:21:26 +0800 +Subject: net/hns3: delete duplicate macro definition + +[ upstream commit 80b3842eb548fe74812700435066f207b4658a97 ] + +This patch delete some duplicate macro definitions. + +Fixes: a4c7152d0581 ("net/hns3: extract common code to its own file") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev.h | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index c58094d87b..c85a6912ad 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -873,13 +873,6 @@ struct hns3_adapter { + struct hns3_ptype_table ptype_tbl __rte_cache_aligned; + }; + +-#define HNS3_DEVARG_RX_FUNC_HINT "rx_func_hint" +-#define HNS3_DEVARG_TX_FUNC_HINT "tx_func_hint" +- +-#define HNS3_DEVARG_DEV_CAPS_MASK "dev_caps_mask" +- +-#define HNS3_DEVARG_MBX_TIME_LIMIT_MS "mbx_time_limit_ms" +- + enum hns3_dev_cap { + HNS3_DEV_SUPPORT_DCB_B, + HNS3_DEV_SUPPORT_COPPER_B, +-- +2.23.0 + diff --git a/0315-net-hns3-add-FDIR-VLAN-match-mode-runtime-config.patch b/0315-net-hns3-add-FDIR-VLAN-match-mode-runtime-config.patch new file mode 100644 index 0000000000000000000000000000000000000000..f0e519f7db2e7ce9d4f1e7284de95a09988ad1f2 --- /dev/null +++ b/0315-net-hns3-add-FDIR-VLAN-match-mode-runtime-config.patch @@ -0,0 +1,162 @@ +From d55b9cc04aee7f3af06559680e63ec26dfc320ec Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 29 Jun 2023 21:21:27 +0800 +Subject: net/hns3: add FDIR VLAN match mode runtime config + +[ upstream commit f83b2b71357d5e8bebf0cee1ac88bb346abc0a42 ] + +The VLAN number in FDIR meta data is used to enable that hardware +bases on VLAN number to strictly match the input flow. And it is +enabled by default. + +For the following two rules: +rule0: + pattern: eth type is 0x0806 + actions: queue index 3 +rule1: + pattern: eth type is 0x0806 / vlan vid is 20 + actions: queue index 4 +If enable VLAN number, only the ARP packets with VLAN 20 are directed +to queue 4, and the ARP packets with other VLAN ID cannot be directed +to the specified queue. If app want to all ARP (VLAN or no VLAN) +packets to be directed to the specified queue, app has to set many +rules for VLAN packet. In this case, if driver doesn't enable VLAN +number, app just need to set one rule (rule0). + +So this patch adds a "fdir_vlan_match_mode" runtime config which only +can be 'strict' or 'nostrict'. And driver still uses 'strict' mode as +the default mode. Please select 'nostrict' mode if you request all same +ethertype packets with and without VLAN to a specified queue. + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_common.c | 35 ++++++++++++++++++++++++++++++++++ + drivers/net/hns3/hns3_common.h | 2 ++ + drivers/net/hns3/hns3_fdir.c | 10 +++++++--- + drivers/net/hns3/hns3_fdir.h | 8 ++++++++ + 4 files changed, 52 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c +index 6697ecefe6..a7b576aa60 100644 +--- a/drivers/net/hns3/hns3_common.c ++++ b/drivers/net/hns3/hns3_common.c +@@ -236,6 +236,34 @@ hns3_parse_mbx_time_limit(const char *key, const char *value, void *extra_args) + return 0; + } + ++static int ++hns3_parse_vlan_match_mode(const char *key, const char *value, void *args) ++{ ++ uint8_t mode; ++ ++ RTE_SET_USED(key); ++ ++ if (value == NULL) { ++ PMD_INIT_LOG(WARNING, "no value for key:\"%s\"", key); ++ return -1; ++ } ++ ++ if (strcmp(value, "strict") == 0) { ++ mode = HNS3_FDIR_VLAN_STRICT_MATCH; ++ } else if (strcmp(value, "nostrict") == 0) { ++ mode = HNS3_FDIR_VLAN_NOSTRICT_MATCH; ++ } else { ++ PMD_INIT_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", " ++ "value must be 'strict' or 'nostrict'", ++ value, key); ++ return -1; ++ } ++ ++ *(uint8_t *)args = mode; ++ ++ return 0; ++} ++ + void + hns3_parse_devargs(struct rte_eth_dev *dev) + { +@@ -252,6 +280,8 @@ hns3_parse_devargs(struct rte_eth_dev *dev) + hns->tx_func_hint = HNS3_IO_FUNC_HINT_NONE; + hns->dev_caps_mask = 0; + hns->mbx_time_limit_ms = HNS3_MBX_DEF_TIME_LIMIT_MS; ++ if (!hns->is_vf) ++ hns->pf.fdir.vlan_match_mode = HNS3_FDIR_VLAN_STRICT_MATCH; + + if (dev->device->devargs == NULL) + return; +@@ -268,6 +298,11 @@ hns3_parse_devargs(struct rte_eth_dev *dev) + &hns3_parse_dev_caps_mask, &dev_caps_mask); + (void)rte_kvargs_process(kvlist, HNS3_DEVARG_MBX_TIME_LIMIT_MS, + &hns3_parse_mbx_time_limit, &mbx_time_limit_ms); ++ if (!hns->is_vf) ++ (void)rte_kvargs_process(kvlist, ++ HNS3_DEVARG_FDIR_VALN_MATCH_MODE, ++ &hns3_parse_vlan_match_mode, ++ &hns->pf.fdir.vlan_match_mode); + + rte_kvargs_free(kvlist); + +diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h +index 8eaeda26e7..cf9593bd0c 100644 +--- a/drivers/net/hns3/hns3_common.h ++++ b/drivers/net/hns3/hns3_common.h +@@ -27,6 +27,8 @@ enum { + + #define HNS3_DEVARG_MBX_TIME_LIMIT_MS "mbx_time_limit_ms" + ++#define HNS3_DEVARG_FDIR_VALN_MATCH_MODE "fdir_vlan_match_mode" ++ + #define MSEC_PER_SEC 1000L + #define USEC_PER_MSEC 1000L + +diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c +index 48a91fb517..c80fa59e63 100644 +--- a/drivers/net/hns3/hns3_fdir.c ++++ b/drivers/net/hns3/hns3_fdir.c +@@ -355,9 +355,13 @@ int hns3_init_fd_config(struct hns3_adapter *hns) + /* roce_type is used to filter roce frames + * dst_vport is used to specify the rule + */ +- key_cfg->meta_data_active = BIT(DST_VPORT) | BIT(TUNNEL_PACKET) | +- BIT(VLAN_NUMBER); +- hns3_dbg(hw, "fdir meta data: dst_vport tunnel_packet vlan_number"); ++ key_cfg->meta_data_active = BIT(DST_VPORT) | BIT(TUNNEL_PACKET); ++ if (pf->fdir.vlan_match_mode) ++ key_cfg->meta_data_active |= BIT(VLAN_NUMBER); ++ ++ hns3_dbg(hw, "fdir meta data: dst_vport tunnel_packet %s", ++ (pf->fdir.vlan_match_mode == HNS3_FDIR_VLAN_STRICT_MATCH) ? ++ "vlan_number" : ""); + + ret = hns3_get_fd_allocation(hw, + &pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1], +diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h +index ce70a534dc..308cfbe56f 100644 +--- a/drivers/net/hns3/hns3_fdir.h ++++ b/drivers/net/hns3/hns3_fdir.h +@@ -170,6 +170,13 @@ struct hns3_fdir_rule_ele { + + TAILQ_HEAD(hns3_fdir_rule_list, hns3_fdir_rule_ele); + ++/* ++ * On 'strict' mode, hardware bases on VLAN number to exactly match the ++ * input flow. ++ */ ++#define HNS3_FDIR_VLAN_STRICT_MATCH 1 ++#define HNS3_FDIR_VLAN_NOSTRICT_MATCH 0 ++ + /* + * A structure used to define fields of a FDIR related info. + */ +@@ -178,6 +185,7 @@ struct hns3_fdir_info { + struct hns3_fdir_rule_ele **hash_map; + struct rte_hash *hash_handle; + struct hns3_fd_cfg fd_cfg; ++ uint8_t vlan_match_mode; + }; + + struct hns3_adapter; +-- +2.23.0 + diff --git a/dpdk.spec b/dpdk.spec index 152834785c7dfcfcd6c79a1af3e85e1e15c04ae3..0cf42b36e49efeba0fe75222af600990f7d450ec 100644 --- a/dpdk.spec +++ b/dpdk.spec @@ -338,6 +338,9 @@ Patch6313: 0313-net-hns3-fix-IMP-reset-trigger.patch Patch9020: 0020-pdump-fix-pcap_dump-coredump-caused-by-incorrect-pkt_len.patch Patch9021: 0021-gro-fix-gro-with-tcp-push-flag.patch +Patch6314: 0314-net-hns3-delete-duplicate-macro-definition.patch +Patch6315: 0315-net-hns3-add-FDIR-VLAN-match-mode-runtime-config.patch + Summary: Data Plane Development Kit core Group: System Environment/Libraries License: BSD and LGPLv2 and GPLv2 @@ -389,13 +392,15 @@ export CFLAGS="%{optflags}" meson build -Dplatform=generic -Dexamples=l3fwd-power,ethtool,l3fwd,kni,dma,ptpclient ninja -C build -v -#build gazelle-pdump +#build gazelle-pdump/gazell-proc-info cd build/app/dpdk-pdump.p export GAZELLE_FLAGS="-lm -lpthread -lrt -lnuma" export GAZELLE_LIBS="-lrte_pci -lrte_bus_pci -lrte_cmdline -lrte_hash -lrte_mempool -lrte_mempool_ring -lrte_timer -lrte_eal -lrte_gro -lrte_ring -lrte_mbuf -lrte_telemetry -lrte_kni -lrte_net_ixgbe -lrte_kvargs -lrte_net_hinic -lrte_net_i40e -lrte_net_virtio -lrte_bus_vdev -lrte_net -lrte_rcu -lrte_ethdev -lrte_pdump -lrte_bpf -lrte_security -lrte_cryptodev -lrte_net_pcap -lrte_metrics" export SECURE_OPTIONS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -Wall -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fPIE -pie -fPIC -g" gcc -o gazelle-pdump ${GAZELLE_FLAGS} ${SOCURE_OPTIONS} -L../../drivers -L../../lib ${GAZELLE_LIBS} pdump_main.c.o cd - +cd build/app/dpdk-proc-info.p +gcc -o gazelle-proc-info ${GAZELLE_FLAGS} ${SOCURE_OPTIONS} -L../../drivers -L../../lib ${GAZELLE_LIBS} proc-info_main.c.o %install DESTDIR=$RPM_BUILD_ROOT/ ninja install -C build @@ -407,6 +412,7 @@ chrpath -d ./build/examples/dpdk-kni chrpath -d ./build/examples/dpdk-dma chrpath -d ./build/examples/dpdk-ptpclient chrpath -d ./build/app/dpdk-pdump.p/gazelle-pdump +chrpath -d ./build/app/dpdk-proc-info.p/gazelle-proc-info cp ./build/examples/dpdk-l3fwd $RPM_BUILD_ROOT/usr/local/bin cp ./build/examples/dpdk-l3fwd-power $RPM_BUILD_ROOT/usr/local/bin @@ -415,6 +421,7 @@ cp ./build/examples/dpdk-kni $RPM_BUILD_ROOT/usr/local/bin cp ./build/examples/dpdk-dma $RPM_BUILD_ROOT/usr/local/bin cp ./build/examples/dpdk-ptpclient $RPM_BUILD_ROOT/usr/local/bin cp ./build/app/dpdk-pdump.p/gazelle-pdump $RPM_BUILD_ROOT/usr/local/bin +cp ./build/app/dpdk-proc-info.p/gazelle-proc-info $RPM_BUILD_ROOT/usr/local/bin mkdir -p $RPM_BUILD_ROOT/usr/lib64 mv $RPM_BUILD_ROOT/usr/local/lib64/* $RPM_BUILD_ROOT/usr/lib64/ @@ -466,6 +473,7 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko /usr/local/bin/dpdk-dma /usr/local/bin/dpdk-ptpclient /usr/local/bin/gazelle-pdump +/usr/local/bin/gazelle-proc-info %post /sbin/ldconfig @@ -476,8 +484,11 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko /usr/sbin/depmod %changelog -* Fri Jun 30 2023 jiangheng - 21.11-51 -- remove gazelle-proc-info, it function the same as gazellectl -x +* Wed Jul 05 2023 chenjiji - 21.11-51 + Sync some patchs from upstreaming about add FDIR VLAN match + mode runtime config for hns3 pmd. Patchs are as follow: + - net/hns3: delete duplicate macro definition + - net/hns3: add FDIR VLAN match mode runtime config * Mon Jun 19 2023 jiangheng - 21.11-50 - gro: fix gro with tcp push flag