From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) by dpdk.org (Postfix) with ESMTP id 5EF437F28 for ; Wed, 5 Nov 2014 02:40:33 +0100 (CET) Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id EAEA428943 for ; Tue, 4 Nov 2014 17:49:46 -0800 (PST) Received: from sc9-mailhost2.vmware.com (unknown [10.32.43.10]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id CD185191CE for ; Tue, 4 Nov 2014 17:49:46 -0800 (PST) From: Yong Wang To: dev@dpdk.org Date: Tue, 4 Nov 2014 17:49:41 -0800 Message-Id: <1415152183-119796-5-git-send-email-yongwang@vmware.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415152183-119796-1-git-send-email-yongwang@vmware.com> References: <1415152183-119796-1-git-send-email-yongwang@vmware.com> Subject: [dpdk-dev] [PATCH v2 4/6] vmxnet3: Add rx pkt check offloads X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2014 01:40:36 -0000 Only supports IPv4 so far. Signed-off-by: Yong Wang --- 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 #include #include +#include #include #include #include @@ -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