From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by dpdk.org (Postfix) with ESMTP id 8C12029CB for ; Wed, 28 Mar 2018 17:44:30 +0200 (CEST) Received: by mail-wr0-f196.google.com with SMTP id u11so2675482wri.12 for ; Wed, 28 Mar 2018 08:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=qt0t7EM1Zr3VUqg/qYZEtJbRU4bweLlHshl/bzFRbhQ=; b=hlRObeKRUlbVtHF2FhVy5FnmhGhViJiWijVGQABYAefQLGQur7UvlXw/uzEwuJ3Nph gB8n2dwcZxj/Xgo7sp5xlvxtlC4aPNs2mhrt97yjA0tni5Y4GxPTTVRVnbDVuIcr0KMi +2210cF/QZB98a9dkzFzdoBB7dT7xGwSYPJsJxLRnCUbBs3EnX8c1KfKnrNYm33jnr42 Yh3il8yMriwPjKTUM9ESje85bG7Ra235jmfsuIovlfCyC6/sZhCWZVb3SxTjtXQTYjKg X6o9o4wpAvxv9pRtHLETttgpc0NMJm9rxdcJsuIYUpFadI9g6LVmSjaK+nGBX60LRk5y y79Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=qt0t7EM1Zr3VUqg/qYZEtJbRU4bweLlHshl/bzFRbhQ=; b=Y1BCXP+WDxCbMGnuV5i9rOELkp8qlw/z3rTphT364jQT2WAPu+OnnL4ohzbSC0mblD +PVDzn8eQ8M0lpTKf9rRhdXD8I7fqbtwf3nHLUxrEin6p2swD1nTjzUmUukYMZ5bvCAO Kidwkd0/KhIUSiyaC903xcmWZjm0q3glHDS71HmqGKkzIXQcCxdgGcqtNTF9r+zKVMya 8wG7rBuuNGu0dPnisswwVVDDl2ooRGhCTed4GBGp/Si2+rY/tpq7UwnaecxF/LxmPsjG 2yaLA/6qsFjxZXz9dbkF5U5UuW9j3zFlpkCGzTZoy4gkYiVFRI2sfDDCc4o5kRcj7NCA yQPA== X-Gm-Message-State: AElRT7HG1oGqyuKO+ML4jmoc+SJYKMkGhFf4Y7bwxAsyKaDa7r1pr/Yk nZ8mXRHyiIIGAmlmtdsTpYn4pIxF X-Google-Smtp-Source: AIpwx4/JywLOT9Le9X5KcJH8XbYXiyzyrDvs9S2Oc+7yRDaMGkFdiJyOlRRKLp6OxDUT45zQqXUZLQ== X-Received: by 10.223.142.23 with SMTP id n23mr3576538wrb.28.1522251869867; Wed, 28 Mar 2018 08:44:29 -0700 (PDT) Received: from pala.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id o23sm7957279wrf.93.2018.03.28.08.44.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Mar 2018 08:44:29 -0700 (PDT) From: Didier Pallard To: dev@dpdk.org Date: Wed, 28 Mar 2018 17:43:46 +0200 Message-Id: <20180328154349.24976-6-didier.pallard@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180328154349.24976-1-didier.pallard@6wind.com> References: <20180328154349.24976-1-didier.pallard@6wind.com> Subject: [dpdk-dev] [PATCH 5/8] net/vmxnet3: complete Rx offloads support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Mar 2018 15:44:31 -0000 Add support for IPv6, LRO and properly set packet type in all supported cases. Signed-off-by: Didier Pallard --- drivers/net/vmxnet3/base/vmxnet3_defs.h | 27 ++++++++++- drivers/net/vmxnet3/vmxnet3_rxtx.c | 82 +++++++++++++++++++++++++++------ 2 files changed, 93 insertions(+), 16 deletions(-) diff --git a/drivers/net/vmxnet3/base/vmxnet3_defs.h b/drivers/net/vmxnet3/base/vmxnet3_defs.h index a455e2706..7a6f87dc2 100644 --- a/drivers/net/vmxnet3/base/vmxnet3_defs.h +++ b/drivers/net/vmxnet3/base/vmxnet3_defs.h @@ -327,7 +327,32 @@ struct Vmxnet3_RxCompDescExt { uint8 segCnt; /* Number of aggregated packets */ uint8 dupAckCnt; /* Number of duplicate Acks */ __le16 tsDelta; /* TCP timestamp difference */ - __le32 dword2[2]; + __le32 dword2; +#ifdef __BIG_ENDIAN_BITFIELD + uint32 gen : 1; /* generation bit */ + uint32 type : 7; /* completion type */ + uint32 fcs : 1; /* Frame CRC correct */ + uint32 frg : 1; /* IP Fragment */ + uint32 v4 : 1; /* IPv4 */ + uint32 v6 : 1; /* IPv6 */ + uint32 ipc : 1; /* IP Checksum Correct */ + uint32 tcp : 1; /* TCP packet */ + uint32 udp : 1; /* UDP packet */ + uint32 tuc : 1; /* TCP/UDP Checksum Correct */ + uint32 mss : 16; +#else + uint32 mss : 16; + uint32 tuc : 1; /* TCP/UDP Checksum Correct */ + uint32 udp : 1; /* UDP packet */ + uint32 tcp : 1; /* TCP packet */ + uint32 ipc : 1; /* IP Checksum Correct */ + uint32 v6 : 1; /* IPv6 */ + uint32 v4 : 1; /* IPv4 */ + uint32 frg : 1; /* IP Fragment */ + uint32 fcs : 1; /* Frame CRC correct */ + uint32 type : 7; /* completion type */ + uint32 gen : 1; /* generation bit */ +#endif /* __BIG_ENDIAN_BITFIELD */ } #include "vmware_pack_end.h" Vmxnet3_RxCompDescExt; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 1acd6c19e..8ed7bd403 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -652,38 +652,89 @@ static inline void vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm, const uint8_t sop) { - (void)hw; + uint64_t ol_flags = rxm->ol_flags; + uint32_t packet_type = rxm->packet_type; /* Offloads set in sop */ if (sop) { + /* Set packet type */ + packet_type |= RTE_PTYPE_L2_ETHER; + + /* Check large packet receive */ + if (VMXNET3_VERSION_GE_2(hw) && + rcd->type == VMXNET3_CDTYPE_RXCOMP_LRO) { + const Vmxnet3_RxCompDescExt *rcde = + (const Vmxnet3_RxCompDescExt *)rcd; + + rxm->tso_segsz = rcde->mss; + ol_flags |= PKT_RX_LRO; + } } else { /* Offloads set in eop */ /* Check for RSS */ if (rcd->rssType != VMXNET3_RCD_RSS_TYPE_NONE) { - rxm->ol_flags |= PKT_RX_RSS_HASH; + 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); + 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) { - rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - - 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; - } + /* Check packet type, checksum errors, etc. */ + if (rcd->cnc) { + ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN; } else { - rxm->packet_type = RTE_PTYPE_UNKNOWN; + if (rcd->v4) { + packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; + + if (rcd->ipc) + ol_flags |= PKT_RX_IP_CKSUM_GOOD; + else + ol_flags |= PKT_RX_IP_CKSUM_BAD; + + if (rcd->tuc) { + ol_flags |= PKT_RX_L4_CKSUM_GOOD; + if (rcd->tcp) + packet_type |= RTE_PTYPE_L4_TCP; + else + packet_type |= RTE_PTYPE_L4_UDP; + } else { + if (rcd->tcp) { + packet_type |= RTE_PTYPE_L4_TCP; + ol_flags |= PKT_RX_L4_CKSUM_BAD; + } else if (rcd->udp) { + packet_type |= RTE_PTYPE_L4_UDP; + ol_flags |= PKT_RX_L4_CKSUM_BAD; + } + } + } else if (rcd->v6) { + packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; + + if (rcd->tuc) { + ol_flags |= PKT_RX_L4_CKSUM_GOOD; + if (rcd->tcp) + packet_type |= RTE_PTYPE_L4_TCP; + else + packet_type |= RTE_PTYPE_L4_UDP; + } else { + if (rcd->tcp) { + packet_type |= RTE_PTYPE_L4_TCP; + ol_flags |= PKT_RX_L4_CKSUM_BAD; + } else if (rcd->udp) { + packet_type |= RTE_PTYPE_L4_UDP; + ol_flags |= PKT_RX_L4_CKSUM_BAD; + } + } + } else { + packet_type |= RTE_PTYPE_UNKNOWN; + } } } + + rxm->ol_flags = ol_flags; + rxm->packet_type = packet_type; } /* @@ -783,6 +834,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxm->data_off = RTE_PKTMBUF_HEADROOM; rxm->ol_flags = 0; rxm->vlan_tci = 0; + rxm->packet_type = 0; /* * If this is the first buffer of the received packet, -- 2.11.0