From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-5.cisco.com (rcdn-iport-5.cisco.com [173.37.86.76]) by dpdk.org (Postfix) with ESMTP id 4EA58678E for ; Fri, 3 Jun 2016 02:23:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3301; q=dns/txt; s=iport; t=1464913405; x=1466123005; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=U7taLxmyeshsquta1uHzUp2Y0ef2Do6r0fBo2U+2JXY=; b=AyNtrwHd2tbZVlfHlp8D04+CCXLrfeYIbpNOi0S73fA1IeaoqdMs/b9j gbl/xiGWqiVk6T9Z3dU/sKp7mg+T7M0jiZNPZsbx7hTNDp4poVKxrs0AU ubN5U+8426QGbD49B8ETXR2Nq5VX6PSri1brrldt0C0Z8qWJk3AgDHzyw E=; X-IronPort-AV: E=Sophos;i="5.26,409,1459814400"; d="scan'208";a="111182386" Received: from alln-core-7.cisco.com ([173.36.13.140]) by rcdn-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Jun 2016 00:23:24 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-7.cisco.com (8.14.5/8.14.5) with ESMTP id u530NOgQ014142; Fri, 3 Jun 2016 00:23:24 GMT Received: by cisco.com (Postfix, from userid 392789) id 3C8F43FAADEC; Thu, 2 Jun 2016 17:23:24 -0700 (PDT) From: John Daley To: dev@dpdk.org Cc: bruce.richarsdon@intel.com, John Daley Date: Thu, 2 Jun 2016 17:22:57 -0700 Message-Id: <1464913377-30879-14-git-send-email-johndale@cisco.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1464913377-30879-1-git-send-email-johndale@cisco.com> References: <1464071579-30072-1-git-send-email-johndale@cisco.com> <1464913377-30879-1-git-send-email-johndale@cisco.com> Subject: [dpdk-dev] [PATCH v3 13/13] enic: fix Tx IP and UDP/TCP checksum 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: Fri, 03 Jun 2016 00:23:25 -0000 Private/confilicting ol_flags where used to enable UDP/TCP Tx offloads. Use the common flags in PKT_TX_L4_MASK to support them. Also, do some minor code rearranging for slightly better performane. Fixes: fefed3d1e62c ("enic: new driver") Signed-off-by: John Daley --- drivers/net/enic/enic.h | 1 - drivers/net/enic/enic_rxtx.c | 28 ++++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 4b76e6d..1e6914e 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -62,7 +62,6 @@ #define ENICPMD_SETTING(enic, f) ((enic->config.flags & VENETF_##f) ? 1 : 0) #define ENICPMD_BDF_LENGTH 13 /* 0000:00:00.0'\0' */ -#define PKT_TX_TCP_UDP_CKSUM 0x6000 #define ENIC_CALC_IP_CKSUM 1 #define ENIC_CALC_TCP_UDP_CKSUM 2 #define ENIC_MAX_MTU 9000 diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index 350d04b..8fe334f 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/drivers/net/enic/enic_rxtx.c @@ -385,10 +385,10 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct enic *enic = vnic_dev_priv(wq->vdev); unsigned short vlan_id; uint64_t ol_flags; + uint64_t ol_flags_mask; unsigned int wq_desc_avail; int head_idx; struct vnic_wq_buf *buf; - unsigned int hw_ip_cksum_enabled; unsigned int desc_count; struct wq_enet_desc *descs, *desc_p, desc_tmp; uint16_t mss; @@ -400,10 +400,10 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, wq_desc_avail = vnic_wq_desc_avail(wq); head_idx = wq->head_idx; desc_count = wq->ring.desc_count; + ol_flags_mask = PKT_TX_VLAN_PKT | PKT_TX_IP_CKSUM | PKT_TX_L4_MASK; nb_pkts = RTE_MIN(nb_pkts, ENIC_TX_XMIT_MAX); - hw_ip_cksum_enabled = enic->hw_ip_checksum; for (index = 0; index < nb_pkts; index++) { tx_pkt = *tx_pkts++; nb_segs = tx_pkt->nb_segs; @@ -415,10 +415,9 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, pkt_len = tx_pkt->pkt_len; data_len = tx_pkt->data_len; - vlan_id = tx_pkt->vlan_tci; ol_flags = tx_pkt->ol_flags; - mss = 0; + vlan_id = 0; vlan_tag_insert = 0; bus_addr = (dma_addr_t) (tx_pkt->buf_physaddr + tx_pkt->data_off); @@ -428,14 +427,23 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, eop = (data_len == pkt_len); - if (ol_flags & PKT_TX_VLAN_PKT) - vlan_tag_insert = 1; + if (ol_flags & ol_flags_mask) { + if (ol_flags & PKT_TX_VLAN_PKT) { + vlan_tag_insert = 1; + vlan_id = tx_pkt->vlan_tci; + } - if (hw_ip_cksum_enabled && (ol_flags & PKT_TX_IP_CKSUM)) - mss |= ENIC_CALC_IP_CKSUM; + if (ol_flags & PKT_TX_IP_CKSUM) + mss |= ENIC_CALC_IP_CKSUM; - if (hw_ip_cksum_enabled && (ol_flags & PKT_TX_TCP_UDP_CKSUM)) - mss |= ENIC_CALC_TCP_UDP_CKSUM; + /* Nic uses just 1 bit for UDP and TCP */ + switch (ol_flags & PKT_TX_L4_MASK) { + case PKT_TX_TCP_CKSUM: + case PKT_TX_UDP_CKSUM: + mss |= ENIC_CALC_TCP_UDP_CKSUM; + break; + } + } wq_enet_desc_enc(&desc_tmp, bus_addr, data_len, mss, 0, 0, eop, eop, 0, vlan_tag_insert, vlan_id, 0); -- 2.7.0