patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [18.02 1/2] net/vmxnet3: gather offload data on first and last segment
@ 2018-04-30 16:28 Didier Pallard
  2018-04-30 16:28 ` [dpdk-stable] [18.02 2/2] net/vmxnet3: fix Rx offload information in multiseg packets Didier Pallard
  2018-04-30 16:32 ` [dpdk-stable] [18.02 1/2] net/vmxnet3: gather offload data on first and last segment Luca Boccassi
  0 siblings, 2 replies; 3+ messages in thread
From: Didier Pallard @ 2018-04-30 16:28 UTC (permalink / raw)
  To: stable

[ backported from upstream commit 5e5ac26f958f10ef3f1b443ed74c13898cc82e87 ]

Offloads are split between first and last segment of a packet.
Call a single vmxnet3_rx_offload function that will contain all
offload operations. This patch does not introduce any code modification.

Pass a vmxnet3_hw as parameter to the function, it is not presently
used in this patch, but will be later used for TSO offloads.

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Acked-by: Yong Wang <yongwang@vmware.com>

Conflicts:
	drivers/net/vmxnet3/vmxnet3_rxtx.c : do not change packet type
	behaviour on stable branch; continue to parse packet
	to return precise RTE_PTYPE_L3_IPV4, rather than returning
	RTE_PTYPE_L3_IPV4_UNKNOWN like in master branch.
---
 drivers/net/vmxnet3/vmxnet3_rxtx.c | 66 +++++++++++++++++++++-----------------
 1 file changed, 36 insertions(+), 30 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index 3a8c62fc16fc..23b69cce1029 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -648,34 +648,46 @@ vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, uint8_t ring_id)
 
 
 /* Receive side checksum and other offloads */
-static void
-vmxnet3_rx_offload(const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm)
+static inline void
+vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
+		struct rte_mbuf *rxm, const uint8_t sop)
 {
-	/* Check for RSS */
-	if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE) {
-		rxm->ol_flags |= PKT_RX_RSS_HASH;
-		rxm->hash.rss = rcd->rssHash;
-	}
+	(void)hw;
+
+	/* Offloads set in sop */
+	if (sop) {
+		/* Check for RSS */
+		if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE) {
+			rxm->ol_flags |= PKT_RX_RSS_HASH;
+			rxm->hash.rss = rcd->rssHash;
+		}
 
-	/* Check packet type, checksum errors, etc. Only support IPv4 for now. */
-	if (rcd->v4) {
-		struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct ether_hdr *);
-		struct ipv4_hdr *ip = (struct ipv4_hdr *)(eth + 1);
+		/* Check packet type, checksum errors. Only IPv4 for now. */
+		if (rcd->v4) {
+			struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct ether_hdr *);
+			struct ipv4_hdr *ip = (struct ipv4_hdr *)(eth + 1);
 
-		if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct ipv4_hdr))
-			rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT;
-		else
-			rxm->packet_type = RTE_PTYPE_L3_IPV4;
+			if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct ipv4_hdr))
+				rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT;
+			else
+				rxm->packet_type = RTE_PTYPE_L3_IPV4;
 
-		if (!rcd->cnc) {
-			if (!rcd->ipc)
-				rxm->ol_flags |= PKT_RX_IP_CKSUM_BAD;
+			if (!rcd->cnc) {
+				if (!rcd->ipc)
+					rxm->ol_flags |= PKT_RX_IP_CKSUM_BAD;
 
-			if ((rcd->tcp || rcd->udp) && !rcd->tuc)
-				rxm->ol_flags |= PKT_RX_L4_CKSUM_BAD;
+				if ((rcd->tcp || rcd->udp) && !rcd->tuc)
+					rxm->ol_flags |= PKT_RX_L4_CKSUM_BAD;
+			}
+		} else {
+			rxm->packet_type = RTE_PTYPE_UNKNOWN;
+		}
+	} else { /* Offloads set in eop */
+		/* Check for hardware stripped VLAN tag */
+		if (rcd->ts) {
+			rxm->ol_flags |= (PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
+			rxm->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
 		}
-	} else {
-		rxm->packet_type = RTE_PTYPE_UNKNOWN;
 	}
 }
 
@@ -807,7 +819,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			}
 
 			rxq->start_seg = rxm;
-			vmxnet3_rx_offload(rcd, rxm);
+			vmxnet3_rx_offload(hw, rcd, rxm, 1);
 		} else {
 			struct rte_mbuf *start = rxq->start_seg;
 
@@ -823,13 +835,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		if (rcd->eop) {
 			struct rte_mbuf *start = rxq->start_seg;
 
-			/* Check for hardware stripped VLAN tag */
-			if (rcd->ts) {
-				start->ol_flags |= (PKT_RX_VLAN |
-						PKT_RX_VLAN_STRIPPED);
-				start->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
-			}
-
+			vmxnet3_rx_offload(hw, rcd, start, 0);
 			rx_pkts[nb_rx++] = start;
 			rxq->start_seg = NULL;
 		}
-- 
2.11.0

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

* [dpdk-stable] [18.02 2/2] net/vmxnet3: fix Rx offload information in multiseg packets
  2018-04-30 16:28 [dpdk-stable] [18.02 1/2] net/vmxnet3: gather offload data on first and last segment Didier Pallard
@ 2018-04-30 16:28 ` Didier Pallard
  2018-04-30 16:32 ` [dpdk-stable] [18.02 1/2] net/vmxnet3: gather offload data on first and last segment Luca Boccassi
  1 sibling, 0 replies; 3+ messages in thread
From: Didier Pallard @ 2018-04-30 16:28 UTC (permalink / raw)
  To: stable

[ backported from upstream commit d08e3c90d4e0a37618a5174c712dee1bf3cb73a3 ]

In case we are working on a multisegment buffer, most bit are set
in last segment of the buffer. Correctly look at those bits in eop part
of the rx_offload function.

Fixes: 2fdd835f992c ("vmxnet3: support jumbo frames")
Cc: stable@dpdk.org

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Acked-by: Yong Wang <yongwang@vmware.com>
---
 drivers/net/vmxnet3/vmxnet3_rxtx.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c
index 23b69cce1029..c08d957fb093 100644
--- a/drivers/net/vmxnet3/vmxnet3_rxtx.c
+++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c
@@ -656,12 +656,19 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
 
 	/* Offloads set in sop */
 	if (sop) {
+	} else { /* Offloads set in eop */
 		/* Check for RSS */
 		if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE) {
 			rxm->ol_flags |= PKT_RX_RSS_HASH;
 			rxm->hash.rss = rcd->rssHash;
 		}
 
+		/* Check for hardware stripped VLAN tag */
+		if (rcd->ts) {
+			rxm->ol_flags |= (PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
+			rxm->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
+		}
+
 		/* Check packet type, checksum errors. Only IPv4 for now. */
 		if (rcd->v4) {
 			struct ether_hdr *eth = rte_pktmbuf_mtod(rxm, struct ether_hdr *);
@@ -682,12 +689,6 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd,
 		} else {
 			rxm->packet_type = RTE_PTYPE_UNKNOWN;
 		}
-	} else { /* Offloads set in eop */
-		/* Check for hardware stripped VLAN tag */
-		if (rcd->ts) {
-			rxm->ol_flags |= (PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED);
-			rxm->vlan_tci = rte_le_to_cpu_16((uint16_t)rcd->tci);
-		}
 	}
 }
 
-- 
2.11.0

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

* Re: [dpdk-stable] [18.02 1/2] net/vmxnet3: gather offload data on first and last segment
  2018-04-30 16:28 [dpdk-stable] [18.02 1/2] net/vmxnet3: gather offload data on first and last segment Didier Pallard
  2018-04-30 16:28 ` [dpdk-stable] [18.02 2/2] net/vmxnet3: fix Rx offload information in multiseg packets Didier Pallard
@ 2018-04-30 16:32 ` Luca Boccassi
  1 sibling, 0 replies; 3+ messages in thread
From: Luca Boccassi @ 2018-04-30 16:32 UTC (permalink / raw)
  To: Didier Pallard, stable

On Mon, 2018-04-30 at 18:28 +0200, Didier Pallard wrote:
> [ backported from upstream commit
> 5e5ac26f958f10ef3f1b443ed74c13898cc82e87 ]
> 
> Offloads are split between first and last segment of a packet.
> Call a single vmxnet3_rx_offload function that will contain all
> offload operations. This patch does not introduce any code
> modification.
> 
> Pass a vmxnet3_hw as parameter to the function, it is not presently
> used in this patch, but will be later used for TSO offloads.
> 
> Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
> Acked-by: Yong Wang <yongwang@vmware.com>
> 
> Conflicts:
> 	drivers/net/vmxnet3/vmxnet3_rxtx.c : do not change packet type
> 	behaviour on stable branch; continue to parse packet
> 	to return precise RTE_PTYPE_L3_IPV4, rather than returning
> 	RTE_PTYPE_L3_IPV4_UNKNOWN like in master branch.
> ---
>  drivers/net/vmxnet3/vmxnet3_rxtx.c | 66 +++++++++++++++++++++-------
> ----------

Thanks, series applied

-- 
Kind regards,
Luca Boccassi

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

end of thread, other threads:[~2018-04-30 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30 16:28 [dpdk-stable] [18.02 1/2] net/vmxnet3: gather offload data on first and last segment Didier Pallard
2018-04-30 16:28 ` [dpdk-stable] [18.02 2/2] net/vmxnet3: fix Rx offload information in multiseg packets Didier Pallard
2018-04-30 16:32 ` [dpdk-stable] [18.02 1/2] net/vmxnet3: gather offload data on first and last segment Luca Boccassi

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