From patchwork Wed Jan 10 09:17:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "John Daley (johndale)" X-Patchwork-Id: 33399 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1077E1B23D; Wed, 10 Jan 2018 10:18:17 +0100 (CET) Received: from rcdn-iport-8.cisco.com (rcdn-iport-8.cisco.com [173.37.86.79]) by dpdk.org (Postfix) with ESMTP id D8A6A1B225 for ; Wed, 10 Jan 2018 10:18:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2658; q=dns/txt; s=iport; t=1515575892; x=1516785492; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=vLFidvQAJORo7qs21hxXKs2RVlPBDmAJY/Ox8BsMoDQ=; b=Bsz1vufiV7HXDcj3AGwcFf3D5nH5HZf3CqQQMlWadq+jRZrkq5QaVW1k DwXPNKqZwAIBiD3Yde6Q2oAKb/XX+HpuVI35PvcDUd2l5pD4Ikj4qBtEy mtJzGpx+h1uv5QOzUQDIawax76ysAt3VzROoxmknZo1rH0mP/siiaeBTe o=; X-IronPort-AV: E=Sophos;i="5.46,339,1511827200"; d="scan'208";a="339599040" Received: from alln-core-3.cisco.com ([173.36.13.136]) by rcdn-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jan 2018 09:18:11 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id w0A9IAqX021400; Wed, 10 Jan 2018 09:18:11 GMT Received: by cisco.com (Postfix, from userid 392789) id DBE2B20F2001; Wed, 10 Jan 2018 01:18:10 -0800 (PST) From: John Daley To: ferruh.yigit@intel.com Cc: dev@dpdk.org, John Daley Date: Wed, 10 Jan 2018 01:17:11 -0800 Message-Id: <20180110091712.32198-11-johndale@cisco.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180110091712.32198-1-johndale@cisco.com> References: <20180110091712.32198-1-johndale@cisco.com> Subject: [dpdk-dev] [PATCH] net/enic: use TSO flags 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Depend on the tx_offload flags in the mbuf to determeine the length of the headers instead of looking into the packet itself. Signed-off-by: John Daley Reviewed-by: Hyong Youb Kim --- drivers/net/enic/enic_rxtx.c | 56 ++------------------------------------------ 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index b9358d34f..08d600ffb 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/drivers/net/enic/enic_rxtx.c @@ -105,59 +105,6 @@ enic_cq_rx_desc_n_bytes(struct cq_desc *cqd) CQ_ENET_RQ_DESC_BYTES_WRITTEN_MASK; } -/* Find the offset to L5. This is needed by enic TSO implementation. - * Return 0 if not a TCP packet or can't figure out the length. - */ -static inline uint8_t tso_header_len(struct rte_mbuf *mbuf) -{ - struct ether_hdr *eh; - struct vlan_hdr *vh; - struct ipv4_hdr *ip4; - struct ipv6_hdr *ip6; - struct tcp_hdr *th; - uint8_t hdr_len; - uint16_t ether_type; - - /* offset past Ethernet header */ - eh = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); - ether_type = eh->ether_type; - hdr_len = sizeof(struct ether_hdr); - if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { - vh = rte_pktmbuf_mtod_offset(mbuf, struct vlan_hdr *, hdr_len); - ether_type = vh->eth_proto; - hdr_len += sizeof(struct vlan_hdr); - } - - /* offset past IP header */ - switch (rte_be_to_cpu_16(ether_type)) { - case ETHER_TYPE_IPv4: - ip4 = rte_pktmbuf_mtod_offset(mbuf, struct ipv4_hdr *, hdr_len); - if (ip4->next_proto_id != IPPROTO_TCP) - return 0; - hdr_len += (ip4->version_ihl & 0xf) * 4; - break; - case ETHER_TYPE_IPv6: - ip6 = rte_pktmbuf_mtod_offset(mbuf, struct ipv6_hdr *, hdr_len); - if (ip6->proto != IPPROTO_TCP) - return 0; - hdr_len += sizeof(struct ipv6_hdr); - break; - default: - return 0; - } - - if ((hdr_len + sizeof(struct tcp_hdr)) > mbuf->pkt_len) - return 0; - - /* offset past TCP header */ - th = rte_pktmbuf_mtod_offset(mbuf, struct tcp_hdr *, hdr_len); - hdr_len += (th->data_off >> 4) * 4; - - if (hdr_len > mbuf->pkt_len) - return 0; - - return hdr_len; -} static inline uint8_t enic_cq_rx_check_err(struct cq_desc *cqd) @@ -556,7 +503,8 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, header_len = 0; if (tso) { - header_len = tso_header_len(tx_pkt); + header_len = tx_pkt->l2_len + tx_pkt->l3_len + + tx_pkt->l4_len; /* Drop if non-TCP packet or TSO seg size is too big */ if (unlikely(header_len == 0 || ((tx_pkt->tso_segsz +