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 E98B83208 for ; Wed, 11 Feb 2015 02:28:16 +0100 (CET) Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 218D529870; Tue, 10 Feb 2015 17:28:16 -0800 (PST) Received: from EX13-CAS-009.vmware.com (EX13-CAS-009.vmware.com [10.113.191.61]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 1B24140819; Tue, 10 Feb 2015 17:28:16 -0800 (PST) Received: from EX13-MBX-026.vmware.com (10.113.191.46) by EX13-MBX-010.vmware.com (10.113.191.30) with Microsoft SMTP Server (TLS) id 15.0.913.22; Tue, 10 Feb 2015 17:28:15 -0800 Received: from EX13-MBX-026.vmware.com ([fe80::858b:7f42:fd7c:703d]) by EX13-MBX-026.vmware.com ([fe80::858b:7f42:fd7c:703d%17]) with mapi id 15.00.0913.011; Tue, 10 Feb 2015 17:28:03 -0800 From: Yong Wang To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 6/7] vmxnet3: support RSS and refactor offload Thread-Index: AQHQGbh7gbc0IIidVEuY3vCoeh9/5JzrAIGA Date: Wed, 11 Feb 2015 01:28:03 +0000 Message-ID: References: <1418793196-17953-1-git-send-email-stephen@networkplumber.org> <1418793196-17953-7-git-send-email-stephen@networkplumber.org> In-Reply-To: <1418793196-17953-7-git-send-email-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.113.160.246] Content-Type: text/plain; charset="us-ascii" Content-ID: <8576A0D6CA62CE4598BD057588F777F1@pa-exch1.vmware.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: Bill Hong , Stephen Hemminger Subject: Re: [dpdk-dev] [PATCH 6/7] vmxnet3: support RSS and refactor offload 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, 11 Feb 2015 01:28:17 -0000 On 12/16/14, 9:13 PM, "Stephen Hemminger" wrote: >From: Stephen Hemminger > >Refactor the logic to compute receive offload flags to a simpler >function. Andd add support for putting RSS flow hash into packet. > >Signed-off-by: Stephen Hemminger >Signed-off-by: Bill Hong >--- Acked-by: Yong Wang > lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 69 >++++++++++++++++++++--------------- > 1 file changed, 40 insertions(+), 29 deletions(-) > >diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c >b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c >index bd47c6c..53ddb2c 100644 >--- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c >+++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c >@@ -488,6 +488,43 @@ vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, >uint8_t ring_id) > return i; > } >=20 >+ >+/* Receive side checksum and other offloads */ >+static void >+vmxnet3_rx_offload(const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm) >+{ >+ /* Check for hardware stripped VLAN tag */ >+ if (rcd->ts) { >+ rxm->ol_flags |=3D PKT_RX_VLAN_PKT; >+ rxm->vlan_tci =3D rte_le_to_cpu_16((uint16_t)rcd->tci); >+ } >+ >+ /* Check for RSS */ >+ if (rcd->rssType !=3D VMXNET3_RCD_RSS_TYPE_NONE) { >+ rxm->ol_flags |=3D PKT_RX_RSS_HASH; >+ rxm->hash.rss =3D rcd->rssHash; >+ } >+ >+ /* Check packet type, checksum errors, etc. Only support IPv4 for now. >*/ >+ if (rcd->v4) { >+ struct ether_hdr *eth =3D rte_pktmbuf_mtod(rxm, struct ether_hdr *); >+ struct ipv4_hdr *ip =3D (struct ipv4_hdr *)(eth + 1); >+ >+ if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct ipv4_hdr)) >+ rxm->ol_flags |=3D PKT_RX_IPV4_HDR_EXT; >+ else >+ rxm->ol_flags |=3D PKT_RX_IPV4_HDR; >+ >+ if (!rcd->cnc) { >+ if (!rcd->ipc) >+ rxm->ol_flags |=3D PKT_RX_IP_CKSUM_BAD; >+ >+ if ((rcd->tcp || rcd->udp) && !rcd->tuc) >+ rxm->ol_flags |=3D PKT_RX_L4_CKSUM_BAD; >+ } >+ } >+} >+ > /* > * Process the Rx Completion Ring of given vmxnet3_rx_queue > * for nb_pkts burst and return the number of packets received >@@ -583,17 +620,6 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf >**rx_pkts, uint16_t nb_pkts) > goto rcd_done; > } >=20 >- /* Check for hardware stripped VLAN tag */ >- if (rcd->ts) { >- PMD_RX_LOG(DEBUG, "Received packet with vlan ID: %d.", >- rcd->tci); >- rxm->ol_flags =3D PKT_RX_VLAN_PKT; >- /* Copy vlan tag in packet buffer */ >- rxm->vlan_tci =3D rte_le_to_cpu_16((uint16_t)rcd->tci); >- } else { >- rxm->ol_flags =3D 0; >- rxm->vlan_tci =3D 0; >- } >=20 > /* Initialize newly received packet buffer */ > rxm->port =3D rxq->port_id; >@@ -602,25 +628,10 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf >**rx_pkts, uint16_t nb_pkts) > rxm->pkt_len =3D (uint16_t)rcd->len; > rxm->data_len =3D (uint16_t)rcd->len; > rxm->data_off =3D RTE_PKTMBUF_HEADROOM; >+ rxm->ol_flags =3D 0; >+ rxm->vlan_tci =3D 0; >=20 >- /* Check packet type, checksum errors, etc. Only support IPv4 for now. >*/ >- if (rcd->v4) { >- struct ether_hdr *eth =3D rte_pktmbuf_mtod(rxm, struct ether_hdr *); >- struct ipv4_hdr *ip =3D (struct ipv4_hdr *)(eth + 1); >- >- if (((ip->version_ihl & 0xf) << 2) > (int)sizeof(struct ipv4_hdr)) >- rxm->ol_flags |=3D PKT_RX_IPV4_HDR_EXT; >- else >- rxm->ol_flags |=3D PKT_RX_IPV4_HDR; >- >- if (!rcd->cnc) { >- if (!rcd->ipc) >- rxm->ol_flags |=3D PKT_RX_IP_CKSUM_BAD; >- >- if ((rcd->tcp || rcd->udp) && !rcd->tuc) >- rxm->ol_flags |=3D PKT_RX_L4_CKSUM_BAD; >- } >- } >+ vmxnet3_rx_offload(rcd, rxm); >=20 > rx_pkts[nb_rx++] =3D rxm; > rcd_done: >--=20 >2.1.3 >