已开启
Sync DPDK upstream patch about bugfix #666
AtomGit-Bot创建于 2024年11月15日
Sync DPDK upstream patch about bugfix #666
已开启
从refs/pull/666/head合入到openEuler-22.03-LTS-SP4
共 2 个文件变更+217-1
| @@ -0,0 +1,212 @@ | |||
| 1 | +From 127b8563fabbdb41a4b70704703b2cca693bedd9 Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: Jie Hai <haijie1@huawei.com> | ||
| 3 | +Date: Thu, 4 Jul 2024 10:15:38 +0800 | ||
| 4 | +Subject: [PATCH] net/hns3: support more VLAN fields matching | ||
| 5 | + | ||
| 6 | +[ upstream commit 051d4bc943ff37bd9310bb76d8b0b9dad77fa14b ] | ||
| 7 | + | ||
| 8 | +The commit 09315fc83861 ("ethdev: add VLAN attributes to ethernet | ||
| 9 | +and VLAN items") introduces ``has_vlan`` and ``has_more_vlan`` | ||
| 10 | +fields in items ETH and VLAN. This patch adds support for these | ||
| 11 | +fields. The usage is documented in hns3.rst. | ||
| 12 | + | ||
| 13 | +Signed-off-by: Jie Hai <haijie1@huawei.com> | ||
| 14 | +--- | ||
| 15 | + doc/guides/nics/hns3.rst | 68 ++++++++++++++++++++++++++++++++++++ | ||
| 16 | + drivers/net/hns3/hns3_fdir.h | 4 +++ | ||
| 17 | + drivers/net/hns3/hns3_flow.c | 47 ++++++++++++++++++++++--- | ||
| 18 | + 3 files changed, 115 insertions(+), 4 deletions(-) | ||
| 19 | + | ||
| 20 | +diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst | ||
| 21 | +index 3e84d1f..97b4686 100644 | ||
| 22 | +--- a/doc/guides/nics/hns3.rst | ||
| 23 | ++++ b/doc/guides/nics/hns3.rst | ||
| 24 | +@@ -234,6 +234,74 @@ src_port=32, dst_port=32`` to queue 1: | ||
| 25 | + dst is 2.2.2.5 / udp src is 32 dst is 32 / end \ | ||
| 26 | + actions mark id 1 / queue index 1 / end | ||
| 27 | + | ||
| 28 | ++The flow rules:: | ||
| 29 | ++ | ||
| 30 | ++ rule-0: flow create 0 ingress pattern eth / end \ | ||
| 31 | ++ queue index 1 / end | ||
| 32 | ++ rule-1: flow create 0 ingress pattern eth / vlan vid is 10 / end \ | ||
| 33 | ++ queue index 1 / end | ||
| 34 | ++ rule-2: flow create 0 ingress pattern eth / vlan / vlan vid is 10 / end \ | ||
| 35 | ++ queue index 1 / end | ||
| 36 | ++ rule-3: flow create 0 ingress pattern eth / vlan vid is 10 / vlan vid is 11 / end \ | ||
| 37 | ++ queue index 1 / end | ||
| 38 | ++ | ||
| 39 | ++will match the following packet types with specific VLAN ID at the specified VLAN layer | ||
| 40 | ++and any VLAN ID at the rest VLAN layer. | ||
| 41 | ++ | ||
| 42 | ++ +--------+------------------+-------------------------------------------+ | ||
| 43 | ++ | rules | ``strict`` | ``nostrict`` | | ||
| 44 | ++ +========+==================+===========================================+ | ||
| 45 | ++ | rule-0 | untagged | untagged || single-tagged || multi-tagged | | ||
| 46 | ++ +--------+------------------+-------------------------------------------+ | ||
| 47 | ++ | rule-1 | single-tagged | single-tagged || multi-tagged | | ||
| 48 | ++ +--------+------------------+-------------------------------------------+ | ||
| 49 | ++ | rule-2 | double-tagged | multi-tagged | | ||
| 50 | ++ +--------+------------------+-------------------------------------------+ | ||
| 51 | ++ | rule-3 | double-tagged | multi-tagged | | ||
| 52 | ++ +--------+------------------+-------------------------------------------+ | ||
| 53 | ++ | ||
| 54 | ++The attributes ``has_vlan`` and ``has_more_vlan`` are supported. | ||
| 55 | ++The usage is as follows:: | ||
| 56 | ++ | ||
| 57 | ++ rule-4: flow create 0 ingress pattern eth has_vlan is 1 / end \ | ||
| 58 | ++ queue index 1 / end | ||
| 59 | ++ rule-5: flow create 0 ingress pattern eth has_vlan is 0 / end \ | ||
| 60 | ++ queue index 1 / end | ||
| 61 | ++ rule-6: flow create 0 ingress pattern eth / vlan has_more_vlan is 1 / \ | ||
| 62 | ++ end queue index 1 / end | ||
| 63 | ++ rule-7: flow create 0 ingress pattern eth / vlan has_more_vlan is 0 / \ | ||
| 64 | ++ end queue index 1 / end | ||
| 65 | ++ | ||
| 66 | ++They will match the following packet types with any VLAN ID. | ||
| 67 | ++ | ||
| 68 | ++ +--------+------------------+-------------------------------------------+ | ||
| 69 | ++ | rules | ``strict`` | ``nostrict`` | | ||
| 70 | ++ +========+==================+===========================================+ | ||
| 71 | ++ | rule-4 | single-tagged | untagged || single-tagged || multi-tagged | | ||
| 72 | ++ +--------+------------------+-------------------------------------------+ | ||
| 73 | ++ | rule-5 | untagged | untagged || single-tagged || multi-tagged | | ||
| 74 | ++ +--------+------------------+-------------------------------------------+ | ||
| 75 | ++ | rule-6 | double-tagged | untagged || single-tagged || multi-tagged | | ||
| 76 | ++ +--------+------------------+-------------------------------------------+ | ||
| 77 | ++ | rule-7 | single-tagged | untagged || single-tagged || multi-tagged | | ||
| 78 | ++ +--------+------------------+-------------------------------------------+ | ||
| 79 | ++ | ||
| 80 | ++These two fields may be used followed by VLAN item, | ||
| 81 | ++and may partially overlap or conflict with the VLAN item. | ||
| 82 | ++For examples, the rule-8 will be rejected by the driver | ||
| 83 | ++and rule-9, rule-10 are repeated with rule-4. | ||
| 84 | ++Similar usage for ``has_more_vlan``. | ||
| 85 | ++ | ||
| 86 | ++:: | ||
| 87 | ++ | ||
| 88 | ++ rule-8: flow create 0 ingress pattern eth has_vlan is 0 / vlan / end \ | ||
| 89 | ++ queue index 1 / end | ||
| 90 | ++ rule-9: flow create 0 ingress pattern eth has_vlan is 1 / vlan / end \ | ||
| 91 | ++ queue index 1 / end | ||
| 92 | ++ rule-10: flow create 0 ingress pattern eth / vlan / end \ | ||
| 93 | ++ queue index 1 / end | ||
| 94 | ++ | ||
| 95 | ++ | ||
| 96 | + Generic flow API | ||
| 97 | + ~~~~~~~~~~~~~~~~ | ||
| 98 | + | ||
| 99 | +diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h | ||
| 100 | +index 308cfbe..6ccd90a 100644 | ||
| 101 | +--- a/drivers/net/hns3/hns3_fdir.h | ||
| 102 | ++++ b/drivers/net/hns3/hns3_fdir.h | ||
| 103 | +@@ -160,6 +160,10 @@ struct hns3_fdir_rule { | ||
| 104 | + uint16_t nb_queues; | ||
| 105 | + uint16_t location; | ||
| 106 | + struct rte_flow_action_count act_cnt; | ||
| 107 | ++ bool has_vlan_m; | ||
| 108 | ++ bool has_vlan_v; | ||
| 109 | ++ bool has_more_vlan_m; | ||
| 110 | ++ bool has_more_vlan_v; | ||
| 111 | + }; | ||
| 112 | + | ||
| 113 | + /* FDIR filter list structure */ | ||
| 114 | +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c | ||
| 115 | +index 7fbe653..37eb2b4 100644 | ||
| 116 | +--- a/drivers/net/hns3/hns3_flow.c | ||
| 117 | ++++ b/drivers/net/hns3/hns3_flow.c | ||
| 118 | +@@ -616,8 +616,8 @@ hns3_parse_eth(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, | ||
| 119 | + if (item->spec == NULL && item->mask == NULL) | ||
| 120 | + return 0; | ||
| 121 | + | ||
| 122 | +- if (item->mask) { | ||
| 123 | +- eth_mask = item->mask; | ||
| 124 | ++ eth_mask = item->mask; | ||
| 125 | ++ if (eth_mask) { | ||
| 126 | + if (eth_mask->type) { | ||
| 127 | + hns3_set_bit(rule->input_set, INNER_ETH_TYPE, 1); | ||
| 128 | + rule->key_conf.mask.ether_type = | ||
| 129 | +@@ -633,9 +633,16 @@ hns3_parse_eth(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, | ||
| 130 | + memcpy(rule->key_conf.mask.dst_mac, | ||
| 131 | + eth_mask->dst.addr_bytes, RTE_ETHER_ADDR_LEN); | ||
| 132 | + } | ||
| 133 | ++ if (eth_mask->has_vlan) | ||
| 134 | ++ rule->has_vlan_m = true; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + eth_spec = item->spec; | ||
| 138 | ++ if (eth_mask && eth_mask->has_vlan && eth_spec->has_vlan) { | ||
| 139 | ++ rule->key_conf.vlan_num++; | ||
| 140 | ++ rule->has_vlan_v = true; | ||
| 141 | ++ } | ||
| 142 | ++ | ||
| 143 | + rule->key_conf.spec.ether_type = rte_be_to_cpu_16(eth_spec->type); | ||
| 144 | + memcpy(rule->key_conf.spec.src_mac, eth_spec->src.addr_bytes, | ||
| 145 | + RTE_ETHER_ADDR_LEN); | ||
| 146 | +@@ -651,6 +658,26 @@ hns3_parse_vlan(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, | ||
| 147 | + const struct rte_flow_item_vlan *vlan_spec; | ||
| 148 | + const struct rte_flow_item_vlan *vlan_mask; | ||
| 149 | + | ||
| 150 | ++ if (rule->has_vlan_m && !rule->has_vlan_v) | ||
| 151 | ++ return rte_flow_error_set(error, EINVAL, | ||
| 152 | ++ RTE_FLOW_ERROR_TYPE_ITEM, item, | ||
| 153 | ++ "VLAN item is conflict with 'has_vlan is 0' in ETH item"); | ||
| 154 | ++ | ||
| 155 | ++ if (rule->has_more_vlan_m && !rule->has_more_vlan_v) | ||
| 156 | ++ return rte_flow_error_set(error, EINVAL, | ||
| 157 | ++ RTE_FLOW_ERROR_TYPE_ITEM, item, | ||
| 158 | ++ "VLAN item is conflict with 'has_more_vlan is 0' in the previous VLAN item"); | ||
| 159 | ++ | ||
| 160 | ++ if (rule->has_vlan_m && rule->has_vlan_v) { | ||
| 161 | ++ rule->has_vlan_m = false; | ||
| 162 | ++ rule->key_conf.vlan_num--; | ||
| 163 | ++ } | ||
| 164 | ++ | ||
| 165 | ++ if (rule->has_more_vlan_m && rule->has_more_vlan_v) { | ||
| 166 | ++ rule->has_more_vlan_m = false; | ||
| 167 | ++ rule->key_conf.vlan_num--; | ||
| 168 | ++ } | ||
| 169 | ++ | ||
| 170 | + rule->key_conf.vlan_num++; | ||
| 171 | + if (rule->key_conf.vlan_num > VLAN_TAG_NUM_MAX) | ||
| 172 | + return rte_flow_error_set(error, EINVAL, | ||
| 173 | +@@ -661,8 +688,8 @@ hns3_parse_vlan(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, | ||
| 174 | + if (item->spec == NULL && item->mask == NULL) | ||
| 175 | + return 0; | ||
| 176 | + | ||
| 177 | +- if (item->mask) { | ||
| 178 | +- vlan_mask = item->mask; | ||
| 179 | ++ vlan_mask = item->mask; | ||
| 180 | ++ if (vlan_mask) { | ||
| 181 | + if (vlan_mask->tci) { | ||
| 182 | + if (rule->key_conf.vlan_num == 1) { | ||
| 183 | + hns3_set_bit(rule->input_set, INNER_VLAN_TAG1, | ||
| 184 | +@@ -676,6 +703,8 @@ hns3_parse_vlan(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, | ||
| 185 | + rte_be_to_cpu_16(vlan_mask->tci); | ||
| 186 | + } | ||
| 187 | + } | ||
| 188 | ++ if (vlan_mask->has_more_vlan) | ||
| 189 | ++ rule->has_more_vlan_m = true; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + vlan_spec = item->spec; | ||
| 193 | +@@ -685,6 +714,16 @@ hns3_parse_vlan(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, | ||
| 194 | + else | ||
| 195 | + rule->key_conf.spec.vlan_tag2 = | ||
| 196 | + rte_be_to_cpu_16(vlan_spec->tci); | ||
| 197 | ++ | ||
| 198 | ++ if (vlan_mask && vlan_mask->has_more_vlan && vlan_spec->has_more_vlan) { | ||
| 199 | ++ rule->key_conf.vlan_num++; | ||
| 200 | ++ if (rule->key_conf.vlan_num > VLAN_TAG_NUM_MAX) | ||
| 201 | ++ return rte_flow_error_set(error, EINVAL, | ||
| 202 | ++ RTE_FLOW_ERROR_TYPE_ITEM, item, | ||
| 203 | ++ "Vlan_num is more than 2"); | ||
| 204 | ++ rule->has_more_vlan_v = true; | ||
| 205 | ++ } | ||
| 206 | ++ | ||
| 207 | + return 0; | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | +-- | ||
| 211 | +2.33.0 | ||
| 212 | + | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | Name: dpdk | 1 | Name: dpdk |
| 2 | Version: 21.11 | 2 | Version: 21.11 |
| 3 | -Release: 79 | 3 | +Release: 80 |
| 4 | Packager: packaging@6wind.com | 4 | Packager: packaging@6wind.com |
| 5 | URL: http://dpdk.org | 5 | URL: http://dpdk.org |
| 6 | %global source_version 21.11 | 6 | %global source_version 21.11 |
| @@ -519,6 +519,7 @@ Patch9482: 0482-af_xdp-del-XDP_USE_SG-and-XDP_PKT_CONTD-definition.patch | |||
| 519 | Patch9483: 0483-af_xdp-fix-mbuf-ol_flags-not-init.patch | 519 | Patch9483: 0483-af_xdp-fix-mbuf-ol_flags-not-init.patch |
| 520 | Patch9484: 0484-bus-pci-fix-UIO-resource-mapping-in-secondary-proces.patch | 520 | Patch9484: 0484-bus-pci-fix-UIO-resource-mapping-in-secondary-proces.patch |
| 521 | Patch9485: 0485-net-af_xdp-fix-getsockopt-ENOTSOCK-error.patch | 521 | Patch9485: 0485-net-af_xdp-fix-getsockopt-ENOTSOCK-error.patch |
| 522 | +Patch9486: 0486-net-hns3-support-more-VLAN-fields-matching.patch | ||
| 522 | 523 | ||
| 523 | Summary: Data Plane Development Kit core | 524 | Summary: Data Plane Development Kit core |
| 524 | Group: System Environment/Libraries | 525 | Group: System Environment/Libraries |
| @@ -686,6 +687,9 @@ fi | |||
| 686 | /usr/sbin/depmod | 687 | /usr/sbin/depmod |
| 687 | 688 | ||
| 688 | %changelog | 689 | %changelog |
| 690 | +* Fri Nov 15 2024 lichenyang <lichenyang48@h-partners.com> - 21.11-80 | ||
| 691 | +- net/hns3: support more VLAN fields matching | ||
| 692 | + | ||
| 689 | * Thu Oct 31 2024 yangchen <yangchen145@huawei.com> - 21.11-79 | 693 | * Thu Oct 31 2024 yangchen <yangchen145@huawei.com> - 21.11-79 |
| 690 | net/af_xdp: fix getsockopt ENOTSOCK error | 694 | net/af_xdp: fix getsockopt ENOTSOCK error |
| 691 | 695 | ||