DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] txgbe fixes
@ 2021-10-13  2:45 Jiawen Wu
  2021-10-13  2:45 ` [dpdk-dev] [PATCH 1/3] net/txgbe: fix to get interrupt status Jiawen Wu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jiawen Wu @ 2021-10-13  2:45 UTC (permalink / raw)
  To: dev; +Cc: Jiawen Wu

Fix legacy interrupt abnormal, VXLAN-GPE packet inner checksum error,
and support to set fixed link speed.

Jiawen Wu (3):
  net/txgbe: fix to get interrupt status
  net/txgbe: set fixed flag for exact link speed
  net/txgbe: fix VXLAN-GPE packet checksum

 drivers/net/txgbe/base/txgbe_regs.h |  1 +
 drivers/net/txgbe/txgbe_ethdev.c    | 28 ++++++++++-------------
 drivers/net/txgbe/txgbe_ptypes.c    | 24 ++++++++++----------
 drivers/net/txgbe/txgbe_rxtx.c      | 35 +++++++++++++++++++++++------
 4 files changed, 53 insertions(+), 35 deletions(-)

-- 
2.21.0.windows.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 1/3] net/txgbe: fix to get interrupt status
  2021-10-13  2:45 [dpdk-dev] [PATCH 0/3] txgbe fixes Jiawen Wu
@ 2021-10-13  2:45 ` Jiawen Wu
  2021-10-13  2:45 ` [dpdk-dev] [PATCH 2/3] net/txgbe: set fixed flag for exact link speed Jiawen Wu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jiawen Wu @ 2021-10-13  2:45 UTC (permalink / raw)
  To: dev; +Cc: Jiawen Wu, stable

It's necessary to set 1 on TXGBE_PX_INTA register to get interrupts
normally, when legacy interrupt mode is used.

Fixes: 2fc745e6b606 ("net/txgbe: add interrupt operation")
Cc: stable@dpdk.org

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/txgbe/base/txgbe_regs.h |  1 +
 drivers/net/txgbe/txgbe_ethdev.c    | 12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/txgbe/base/txgbe_regs.h b/drivers/net/txgbe/base/txgbe_regs.h
index 990589b013..48d9300a2e 100644
--- a/drivers/net/txgbe/base/txgbe_regs.h
+++ b/drivers/net/txgbe/base/txgbe_regs.h
@@ -1219,6 +1219,7 @@ enum txgbe_5tuple_protocol {
 #define TXGBE_IVARMISC                  0x0004FC
 #define   TXGBE_IVARMISC_VEC(v)         LS(v, 0, 0x7)
 #define   TXGBE_IVARMISC_VLD            MS(7, 0x1)
+#define TXGBE_PX_INTA			0x000110
 #define TXGBE_ICR(i)                    (0x000120 + (i) * 4) /* 0-1 */
 #define   TXGBE_ICR_MASK                MS(0, 0xFFFFFFFF)
 #define TXGBE_ICS(i)                    (0x000130 + (i) * 4) /* 0-1 */
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index b267da462b..ab972a3a35 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -109,7 +109,8 @@ static int txgbe_dev_lsc_interrupt_setup(struct rte_eth_dev *dev, uint8_t on);
 static int txgbe_dev_macsec_interrupt_setup(struct rte_eth_dev *dev);
 static int txgbe_dev_misc_interrupt_setup(struct rte_eth_dev *dev);
 static int txgbe_dev_rxq_interrupt_setup(struct rte_eth_dev *dev);
-static int txgbe_dev_interrupt_get_status(struct rte_eth_dev *dev);
+static int txgbe_dev_interrupt_get_status(struct rte_eth_dev *dev,
+				      struct rte_intr_handle *handle);
 static int txgbe_dev_interrupt_action(struct rte_eth_dev *dev,
 				      struct rte_intr_handle *handle);
 static void txgbe_dev_interrupt_handler(void *param);
@@ -2938,12 +2939,17 @@ txgbe_dev_macsec_interrupt_setup(struct rte_eth_dev *dev)
  *  - On failure, a negative value.
  */
 static int
-txgbe_dev_interrupt_get_status(struct rte_eth_dev *dev)
+txgbe_dev_interrupt_get_status(struct rte_eth_dev *dev,
+				struct rte_intr_handle *intr_handle)
 {
 	uint32_t eicr;
 	struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
 	struct txgbe_interrupt *intr = TXGBE_DEV_INTR(dev);
 
+	if (intr_handle->type != RTE_INTR_HANDLE_UIO &&
+			intr_handle->type != RTE_INTR_HANDLE_VFIO_MSIX)
+		wr32(hw, TXGBE_PX_INTA, 1);
+
 	/* clear all cause mask */
 	txgbe_disable_intr(hw);
 
@@ -3165,7 +3171,7 @@ txgbe_dev_interrupt_handler(void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
-	txgbe_dev_interrupt_get_status(dev);
+	txgbe_dev_interrupt_get_status(dev, dev->intr_handle);
 	txgbe_dev_interrupt_action(dev, dev->intr_handle);
 }
 
-- 
2.21.0.windows.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/3] net/txgbe: set fixed flag for exact link speed
  2021-10-13  2:45 [dpdk-dev] [PATCH 0/3] txgbe fixes Jiawen Wu
  2021-10-13  2:45 ` [dpdk-dev] [PATCH 1/3] net/txgbe: fix to get interrupt status Jiawen Wu
@ 2021-10-13  2:45 ` Jiawen Wu
  2021-10-13  2:45 ` [dpdk-dev] [PATCH 3/3] net/txgbe: fix VXLAN-GPE packet checksum Jiawen Wu
  2021-10-14 14:56 ` [dpdk-dev] [PATCH 0/3] txgbe fixes Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Jiawen Wu @ 2021-10-13  2:45 UTC (permalink / raw)
  To: dev; +Cc: Jiawen Wu

Setting exact link speed makes sense if auto-negotiation is
disabled. Fixed flag is required to disable auto-negotiation.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/txgbe/txgbe_ethdev.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index ab972a3a35..dc822d69f7 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -1634,17 +1634,6 @@ txgbe_dev_start(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	/* TXGBE devices don't support:
-	 *    - half duplex (checked afterwards for valid speeds)
-	 *    - fixed speed: TODO implement
-	 */
-	if (dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) {
-		PMD_INIT_LOG(ERR,
-		"Invalid link_speeds for port %u, fix speed not supported",
-				dev->data->port_id);
-		return -EINVAL;
-	}
-
 	/* Stop the link setup handler before resetting the HW. */
 	rte_eal_alarm_cancel(txgbe_dev_setup_link_alarm_handler, dev);
 
@@ -1778,7 +1767,7 @@ txgbe_dev_start(struct rte_eth_dev *dev)
 			ETH_LINK_SPEED_10G;
 
 	link_speeds = &dev->data->dev_conf.link_speeds;
-	if (*link_speeds & ~allowed_speeds) {
+	if (((*link_speeds) >> 1) & ~(allowed_speeds >> 1)) {
 		PMD_INIT_LOG(ERR, "Invalid link setting");
 		goto error;
 	}
@@ -2709,7 +2698,8 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,
 	link.link_status = ETH_LINK_DOWN;
 	link.link_speed = ETH_SPEED_NUM_NONE;
 	link.link_duplex = ETH_LINK_HALF_DUPLEX;
-	link.link_autoneg = ETH_LINK_AUTONEG;
+	link.link_autoneg = !(dev->data->dev_conf.link_speeds &
+			ETH_LINK_SPEED_FIXED);
 
 	hw->mac.get_link_status = true;
 
-- 
2.21.0.windows.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 3/3] net/txgbe: fix VXLAN-GPE packet checksum
  2021-10-13  2:45 [dpdk-dev] [PATCH 0/3] txgbe fixes Jiawen Wu
  2021-10-13  2:45 ` [dpdk-dev] [PATCH 1/3] net/txgbe: fix to get interrupt status Jiawen Wu
  2021-10-13  2:45 ` [dpdk-dev] [PATCH 2/3] net/txgbe: set fixed flag for exact link speed Jiawen Wu
@ 2021-10-13  2:45 ` Jiawen Wu
  2021-10-14 14:56 ` [dpdk-dev] [PATCH 0/3] txgbe fixes Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Jiawen Wu @ 2021-10-13  2:45 UTC (permalink / raw)
  To: dev; +Cc: Jiawen Wu, stable

Parse inner L2 length to set correct packet type, and ensure that
hardware can compute the checksum successfully.

Fixes: b950203be7f1 ("net/txgbe: support VXLAN-GPE")
Cc: stable@dpdk.org

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/txgbe/txgbe_ptypes.c | 24 +++++++++++-----------
 drivers/net/txgbe/txgbe_rxtx.c   | 35 +++++++++++++++++++++++++-------
 2 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/drivers/net/txgbe/txgbe_ptypes.c b/drivers/net/txgbe/txgbe_ptypes.c
index c8a8a3839d..0ed757d820 100644
--- a/drivers/net/txgbe/txgbe_ptypes.c
+++ b/drivers/net/txgbe/txgbe_ptypes.c
@@ -102,17 +102,17 @@ static u32 txgbe_ptype_lookup[TXGBE_PTID_MAX] __rte_cache_aligned = {
 	TPTE(0x8C, ETHER, IPV4, NONE, IP, NONE, IPV6, TCP),
 	TPTE(0x8D, ETHER, IPV4, NONE, IP, NONE, IPV6, SCTP),
 	/* IPv4 -> GRE/Teredo/VXLAN -> NONE/IPv4/IPv6 */
-	TPTE(0x90, ETHER, IPV4, NONE, VXLAN_GPE, NONE, NONE, NONE),
-	TPTE(0x91, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, FRAG),
-	TPTE(0x92, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, NONFRAG),
-	TPTE(0x93, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, UDP),
-	TPTE(0x94, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, TCP),
-	TPTE(0x95, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, SCTP),
-	TPTE(0x99, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, FRAG),
-	TPTE(0x9A, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, NONFRAG),
-	TPTE(0x9B, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, UDP),
-	TPTE(0x9C, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, TCP),
-	TPTE(0x9D, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, SCTP),
+	TPTE(0x90, ETHER, IPV4, NONE, GRENAT, NONE, NONE, NONE),
+	TPTE(0x91, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, FRAG),
+	TPTE(0x92, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, NONFRAG),
+	TPTE(0x93, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, UDP),
+	TPTE(0x94, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, TCP),
+	TPTE(0x95, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, SCTP),
+	TPTE(0x99, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, FRAG),
+	TPTE(0x9A, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, NONFRAG),
+	TPTE(0x9B, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, UDP),
+	TPTE(0x9C, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, TCP),
+	TPTE(0x9D, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, SCTP),
 	/* IPv4 -> GRE/Teredo/VXLAN -> MAC -> NONE/IPv4/IPv6 */
 	TPTE(0xA0, ETHER, IPV4, NONE, GRENAT, ETHER, NONE,  NONE),
 	TPTE(0xA1, ETHER, IPV4, NONE, GRENAT, ETHER, IPV4, FRAG),
@@ -320,10 +320,10 @@ txgbe_encode_ptype_tunnel(u32 ptype)
 		ptid |= TXGBE_PTID_TUN_EI;
 		break;
 	case RTE_PTYPE_TUNNEL_GRE:
-	case RTE_PTYPE_TUNNEL_VXLAN_GPE:
 		ptid |= TXGBE_PTID_TUN_EIG;
 		break;
 	case RTE_PTYPE_TUNNEL_VXLAN:
+	case RTE_PTYPE_TUNNEL_VXLAN_GPE:
 	case RTE_PTYPE_TUNNEL_NVGRE:
 	case RTE_PTYPE_TUNNEL_GENEVE:
 	case RTE_PTYPE_TUNNEL_GRENAT:
diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c
index b6339fe50b..b8efe57248 100644
--- a/drivers/net/txgbe/txgbe_rxtx.c
+++ b/drivers/net/txgbe/txgbe_rxtx.c
@@ -562,10 +562,10 @@ tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype)
 	/* Tunnel */
 	switch (oflags & PKT_TX_TUNNEL_MASK) {
 	case PKT_TX_TUNNEL_VXLAN:
+	case PKT_TX_TUNNEL_VXLAN_GPE:
 		ptype |= RTE_PTYPE_L2_ETHER |
 			 RTE_PTYPE_L3_IPV4 |
-			 RTE_PTYPE_TUNNEL_VXLAN;
-		ptype |= RTE_PTYPE_INNER_L2_ETHER;
+			 RTE_PTYPE_TUNNEL_GRENAT;
 		break;
 	case PKT_TX_TUNNEL_GRE:
 		ptype |= RTE_PTYPE_L2_ETHER |
@@ -579,11 +579,6 @@ tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype)
 			 RTE_PTYPE_TUNNEL_GENEVE;
 		ptype |= RTE_PTYPE_INNER_L2_ETHER;
 		break;
-	case PKT_TX_TUNNEL_VXLAN_GPE:
-		ptype |= RTE_PTYPE_L2_ETHER |
-			 RTE_PTYPE_L3_IPV4 |
-			 RTE_PTYPE_TUNNEL_VXLAN_GPE;
-		break;
 	case PKT_TX_TUNNEL_IPIP:
 	case PKT_TX_TUNNEL_IP:
 		ptype |= RTE_PTYPE_L2_ETHER |
@@ -696,6 +691,30 @@ txgbe_get_tun_len(struct rte_mbuf *mbuf)
 	return tun_len;
 }
 
+static inline uint8_t
+txgbe_parse_tun_ptid(struct rte_mbuf *tx_pkt)
+{
+	uint64_t l2_none, l2_mac, l2_mac_vlan;
+	uint8_t ptid = 0;
+
+	if ((tx_pkt->ol_flags & (PKT_TX_TUNNEL_VXLAN |
+				PKT_TX_TUNNEL_VXLAN_GPE)) == 0)
+		return ptid;
+
+	l2_none = sizeof(struct txgbe_udphdr) + sizeof(struct txgbe_vxlanhdr);
+	l2_mac = l2_none + sizeof(struct rte_ether_hdr);
+	l2_mac_vlan = l2_mac + sizeof(struct rte_vlan_hdr);
+
+	if (tx_pkt->l2_len == l2_none)
+		ptid = TXGBE_PTID_TUN_EIG;
+	else if (tx_pkt->l2_len == l2_mac)
+		ptid = TXGBE_PTID_TUN_EIGM;
+	else if (tx_pkt->l2_len == l2_mac_vlan)
+		ptid = TXGBE_PTID_TUN_EIGMV;
+
+	return ptid;
+}
+
 uint16_t
 txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts)
@@ -759,6 +778,8 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		if (tx_ol_req) {
 			tx_offload.ptid = tx_desc_ol_flags_to_ptid(tx_ol_req,
 					tx_pkt->packet_type);
+			if (tx_offload.ptid & TXGBE_PTID_PKT_TUN)
+				tx_offload.ptid |= txgbe_parse_tun_ptid(tx_pkt);
 			tx_offload.l2_len = tx_pkt->l2_len;
 			tx_offload.l3_len = tx_pkt->l3_len;
 			tx_offload.l4_len = tx_pkt->l4_len;
-- 
2.21.0.windows.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] txgbe fixes
  2021-10-13  2:45 [dpdk-dev] [PATCH 0/3] txgbe fixes Jiawen Wu
                   ` (2 preceding siblings ...)
  2021-10-13  2:45 ` [dpdk-dev] [PATCH 3/3] net/txgbe: fix VXLAN-GPE packet checksum Jiawen Wu
@ 2021-10-14 14:56 ` Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2021-10-14 14:56 UTC (permalink / raw)
  To: Jiawen Wu, dev

On 10/13/2021 3:45 AM, Jiawen Wu wrote:
> Fix legacy interrupt abnormal, VXLAN-GPE packet inner checksum error,
> and support to set fixed link speed.
> 
> Jiawen Wu (3):
>    net/txgbe: fix to get interrupt status
>    net/txgbe: set fixed flag for exact link speed
>    net/txgbe: fix VXLAN-GPE packet checksum
> 

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-14 15:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13  2:45 [dpdk-dev] [PATCH 0/3] txgbe fixes Jiawen Wu
2021-10-13  2:45 ` [dpdk-dev] [PATCH 1/3] net/txgbe: fix to get interrupt status Jiawen Wu
2021-10-13  2:45 ` [dpdk-dev] [PATCH 2/3] net/txgbe: set fixed flag for exact link speed Jiawen Wu
2021-10-13  2:45 ` [dpdk-dev] [PATCH 3/3] net/txgbe: fix VXLAN-GPE packet checksum Jiawen Wu
2021-10-14 14:56 ` [dpdk-dev] [PATCH 0/3] txgbe fixes Ferruh Yigit

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).