DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yong Wang <yongwang@vmware.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 4/5] vmxnet3: Add rx pkt check offloads
Date: Sun, 12 Oct 2014 23:23:08 -0700	[thread overview]
Message-ID: <1413181389-14887-5-git-send-email-yongwang@vmware.com> (raw)
In-Reply-To: <1413181389-14887-1-git-send-email-yongwang@vmware.com>

Only supports IPv4 so far.

Signed-off-by: Yong Wang <yongwang@vmware.com>
---
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
index 2017d4b..e2fb8a8 100644
--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c
@@ -65,6 +65,7 @@
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_prefetch.h>
+#include <rte_ip.h>
 #include <rte_udp.h>
 #include <rte_tcp.h>
 #include <rte_sctp.h>
@@ -614,7 +615,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 			/* Check for hardware stripped VLAN tag */
 			if (rcd->ts) {
-				PMD_RX_LOG(ERR, "Received packet with vlan ID: %d.",
+				PMD_RX_LOG(DEBUG, "Received packet with vlan ID: %d.",
 					   rcd->tci);
 				rxm->ol_flags = PKT_RX_VLAN_PKT;
 #ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER
@@ -637,6 +638,25 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 			rxm->port = rxq->port_id;
 			rxm->data_off = RTE_PKTMBUF_HEADROOM;
 
+			/* Check packet types, rx checksum errors, etc. Only support IPv4 so far. */
+			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->ol_flags |= PKT_RX_IPV4_HDR_EXT;
+				else
+					rxm->ol_flags |= PKT_RX_IPV4_HDR;
+
+				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;
+				}
+			}
+
 			rx_pkts[nb_rx++] = rxm;
 rcd_done:
 			rxq->cmd_ring[ring_idx].next2comp = idx;
-- 
1.9.1

  parent reply	other threads:[~2014-10-13  6:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13  6:23 [dpdk-dev] [PATCH 0/5] vmxnet3 pmd fixes/improvement Yong Wang
2014-10-13  6:23 ` [dpdk-dev] [PATCH 1/5] vmxnet3: Fix VLAN Rx stripping Yong Wang
2014-10-13  9:31   ` Stephen Hemminger
2014-10-13 18:42     ` Yong Wang
2014-10-22 13:39       ` Stephen Hemminger
2014-10-28 21:57         ` Yong Wang
2014-10-29  9:04           ` Bruce Richardson
2014-10-29  9:41             ` Thomas Monjalon
2014-10-29 17:57               ` Yong Wang
2014-10-29 18:51                 ` Thomas Monjalon
2014-10-13  6:23 ` [dpdk-dev] [PATCH 2/5] vmxnet3: Add VLAN Tx offload Yong Wang
2014-10-13  6:23 ` [dpdk-dev] [PATCH 3/5] vmxnet3: Fix dev stop/restart bug Yong Wang
2014-10-13  6:23 ` Yong Wang [this message]
2014-10-13  6:23 ` [dpdk-dev] [PATCH 5/5] vmxnet3: Some perf improvement on the rx path Yong Wang
2014-11-05  0:13   ` Thomas Monjalon
2014-10-13 20:29 ` [dpdk-dev] [PATCH 0/5] vmxnet3 pmd fixes/improvement Thomas Monjalon
2014-10-13 21:00   ` Yong Wang
2014-10-21 22:10     ` Yong Wang
2014-10-22  7:07       ` Cao, Waterman
2014-10-28 14:40         ` Thomas Monjalon
2014-10-28 19:59           ` Yong Wang
2014-10-29  0:33             ` Cao, Waterman
2014-11-05  1:32     ` Cao, Waterman
2014-11-04  5:57 ` Zhang, XiaonanX
2014-11-04 22:50   ` Thomas Monjalon
2014-11-05  5:26     ` Cao, Waterman

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=1413181389-14887-5-git-send-email-yongwang@vmware.com \
    --to=yongwang@vmware.com \
    --cc=dev@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).