From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 7170E4C73 for ; Wed, 28 Mar 2018 17:44:26 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id l16so6235653wmh.3 for ; Wed, 28 Mar 2018 08:44:26 -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=EgGbfWQ6eM2yDViwJ+GK1RmyQ1KYx7RciYuCytWtF1Y=; b=ChfHJX5YySSqhuun7hPfN6CKnSxyrpcWsHHHlB6AjLPdVZD4LVQ7gEcUyr/az2IO77 YSxTy6XXRwj/33M/8oE+mi8tIcpzeFfqpTeVTksOEFRgYvAct/bUCsfv9Si7xoICjIqY 1jhxIYZEEd3MsKaUwTFXJ+c6+ZqIKnERNUTg30BeTL/CUaF/TgDwYjvimoiDztcXwZo1 8lBoq+K6fPvNGeXO1kdg80oPQsDMfuGTVO++OtaFWE8l1gpJziC6LJBNG4OTd2mLlRB1 rZPSZt3S9fKBI0tb+lIGSum8XXLgIIPZTmE0yHoqRobKZCI+nOfw5KaeGk+LuMqnWFpH Olsw== 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=EgGbfWQ6eM2yDViwJ+GK1RmyQ1KYx7RciYuCytWtF1Y=; b=hS4sXUN/XP1f8KEenwEvTWT/x8tvNm7D3wK1JMxOe1a58ufBAPaUS+tuxFGwnbpWri FFWcVy0RCb1vBCCm6tfvxhXUwohVF7QgXemIJkAKmvvZBMw3v/Q6RACzwxGZwy3Nf+FS BnJtjPpN3c9BYn+cPeeOGA5O96Mdt5ePkTI98jOR91PKP5klzpcsmGBYPKJjNhM7up7f cK54hnwkxd7sNUEl4jCsuahTmuSCz7tM75gidc6bebTlsVUpZbxA11U2yawz+cv06LgN IZfAwx+YYj9F+45u2Cae7wncGFTfs606y/DC6XKROaSe79gKvf+5NPUkTZcdL5kG7jzV phag== X-Gm-Message-State: AElRT7G+ODxQwfem+EDfqoSiFEbXMaGIuXe3q8jSLTIYTw/XyDOwsqll gGZILHqrN79Eb3WNo8txf1aFZJGb X-Google-Smtp-Source: AIpwx4/hofmssitoDj2obN07nwlnVDH35khHdRKOqPfkFz4q2BxFaPqa7yni8SfB0BE6fddk58h1Xw== X-Received: by 10.28.10.195 with SMTP id 186mr3104654wmk.136.1522251864356; Wed, 28 Mar 2018 08:44:24 -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.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Mar 2018 08:44:23 -0700 (PDT) From: Didier Pallard To: dev@dpdk.org Date: Wed, 28 Mar 2018 17:43:44 +0200 Message-Id: <20180328154349.24976-4-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 3/8] net/vmxnet3: gather offload data on first and last segment 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:26 -0000 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 --- drivers/net/vmxnet3/vmxnet3_rxtx.c | 56 +++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 156dc8e52..27f17ef0a 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -648,28 +648,40 @@ 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) { - rxm->packet_type = RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; + /* 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->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; } } @@ -801,7 +813,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; @@ -817,13 +829,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