DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>, stable@dpdk.org
Subject: [PATCH 1/9] net/txgbe: fix IPv6 rule in flow director
Date: Fri,  2 Sep 2022 11:00:03 +0800	[thread overview]
Message-ID: <20220902030011.377523-2-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20220902030011.377523-1-jiawenwu@trustnetic.com>

Convert the correct packet type and flow type, to fix IPv6 rule in FDIR.

Fixes: b973ee26747a ("net/txgbe: parse flow director filter")
Cc: stable@dpdk.org

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/txgbe/txgbe_flow.c | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index d0093c0163..07d0337095 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -1583,9 +1583,7 @@ txgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev __rte_unused,
 	 * value. So, we need not do anything for the not provided fields later.
 	 */
 	memset(rule, 0, sizeof(struct txgbe_fdir_rule));
-	memset(&rule->mask, 0xFF, sizeof(struct txgbe_hw_fdir_mask));
-	rule->mask.vlan_tci_mask = 0;
-	rule->mask.flex_bytes_mask = 0;
+	memset(&rule->mask, 0, sizeof(struct txgbe_hw_fdir_mask));
 
 	/**
 	 * The first not void item should be
@@ -1867,7 +1865,10 @@ txgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev __rte_unused,
 		 * as we must have a flow type.
 		 */
 		rule->input.flow_type |= TXGBE_ATR_L4TYPE_TCP;
-		ptype = txgbe_ptype_table[TXGBE_PT_IPV4_TCP];
+		if (rule->input.flow_type & TXGBE_ATR_FLOW_TYPE_IPV6)
+			ptype = txgbe_ptype_table[TXGBE_PT_IPV6_TCP];
+		else
+			ptype = txgbe_ptype_table[TXGBE_PT_IPV4_TCP];
 		/*Not supported last point for range*/
 		if (item->last) {
 			rte_flow_error_set(error, EINVAL,
@@ -1931,7 +1932,10 @@ txgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev __rte_unused,
 		 * as we must have a flow type.
 		 */
 		rule->input.flow_type |= TXGBE_ATR_L4TYPE_UDP;
-		ptype = txgbe_ptype_table[TXGBE_PT_IPV4_UDP];
+		if (rule->input.flow_type & TXGBE_ATR_FLOW_TYPE_IPV6)
+			ptype = txgbe_ptype_table[TXGBE_PT_IPV6_UDP];
+		else
+			ptype = txgbe_ptype_table[TXGBE_PT_IPV4_UDP];
 		/*Not supported last point for range*/
 		if (item->last) {
 			rte_flow_error_set(error, EINVAL,
@@ -1990,7 +1994,10 @@ txgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev __rte_unused,
 		 * as we must have a flow type.
 		 */
 		rule->input.flow_type |= TXGBE_ATR_L4TYPE_SCTP;
-		ptype = txgbe_ptype_table[TXGBE_PT_IPV4_SCTP];
+		if (rule->input.flow_type & TXGBE_ATR_FLOW_TYPE_IPV6)
+			ptype = txgbe_ptype_table[TXGBE_PT_IPV6_SCTP];
+		else
+			ptype = txgbe_ptype_table[TXGBE_PT_IPV4_SCTP];
 		/*Not supported last point for range*/
 		if (item->last) {
 			rte_flow_error_set(error, EINVAL,
@@ -2141,6 +2148,16 @@ txgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev __rte_unused,
 
 	rule->input.pkt_type = cpu_to_be16(txgbe_encode_ptype(ptype));
 
+	if (rule->input.flow_type & TXGBE_ATR_FLOW_TYPE_IPV6) {
+		if (rule->input.flow_type & TXGBE_ATR_L4TYPE_MASK)
+			rule->input.pkt_type &= 0xFFFF;
+		else
+			rule->input.pkt_type &= 0xF8FF;
+
+		rule->input.flow_type &= TXGBE_ATR_L3TYPE_MASK |
+					TXGBE_ATR_L4TYPE_MASK;
+	}
+
 	return txgbe_parse_fdir_act_attr(attr, actions, rule, error);
 }
 
@@ -2827,8 +2844,10 @@ txgbe_flow_create(struct rte_eth_dev *dev,
 				ret = memcmp(&fdir_info->mask,
 					&fdir_rule.mask,
 					sizeof(struct txgbe_hw_fdir_mask));
-				if (ret)
+				if (ret) {
+					PMD_DRV_LOG(ERR, "only support one global mask");
 					goto out;
+				}
 
 				if (fdir_info->flex_bytes_offset !=
 						fdir_rule.flex_bytes_offset)
-- 
2.27.0


  reply	other threads:[~2022-09-02  3:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02  3:00 [PATCH 0/9] Wangxun fixes and supports Jiawen Wu
2022-09-02  3:00 ` Jiawen Wu [this message]
2022-09-02  3:00 ` [PATCH 2/9] net/txgbe: fix OEM customized LED Jiawen Wu
2022-09-02  3:00 ` [PATCH 3/9] net/txgbe: remove semaphore between SW/FW Jiawen Wu
2022-09-02  3:00 ` [PATCH 4/9] net/txgbe: rename some extended statistic Jiawen Wu
2022-09-02  3:00 ` [PATCH 5/9] net/ngbe: " Jiawen Wu
2022-09-02  3:00 ` [PATCH 6/9] net/ngbe: remove semaphore between SW/FW Jiawen Wu
2022-09-02  3:00 ` [PATCH 7/9] net/ngbe: fix max frame size Jiawen Wu
2022-09-02  3:00 ` [PATCH 8/9] net/ngbe: fix YT PHY mixed mode occasionally failing link Jiawen Wu
2022-09-02  3:00 ` [PATCH 9/9] net/ngbe: support to set link down/up Jiawen Wu
2022-09-21 11:46   ` Ferruh Yigit
2022-09-13  1:55 ` [PATCH 0/9] Wangxun fixes and supports Jiawen Wu
2022-09-21 11:48 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220902030011.377523-2-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).