From patchwork Thu Jun 28 03:19:36 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: 41780 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 B467E1B000; Thu, 28 Jun 2018 05:23:34 +0200 (CEST) Received: from rcdn-iport-6.cisco.com (rcdn-iport-6.cisco.com [173.37.86.77]) by dpdk.org (Postfix) with ESMTP id CB5B41B000 for ; Thu, 28 Jun 2018 05:23:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3523; q=dns/txt; s=iport; t=1530156212; x=1531365812; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=XLcASu8I4ktZf+E87DXX+AU6zxcN7ZrzWRMNlU//GfE=; b=RYjXLDP4oD99VOungFP12ksKlhyE8Fuzy584Rnwjz3q6UmomD+OtsnoW agrDdOn0chzmK3Z03lp2LJRmBR7n4LAeDrr1e/lqFxa4gQEdVc5K3Bqbo tJdLUDCrYlltWmlji2hf3VaSXWWwtbYF88cjgZ4OsadoHYeu0fytPM7dM g=; X-IronPort-AV: E=Sophos;i="5.51,281,1526342400"; d="scan'208";a="416421504" Received: from rcdn-core-5.cisco.com ([173.37.93.156]) by rcdn-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2018 03:23:32 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-5.cisco.com (8.14.5/8.14.5) with ESMTP id w5S3NVjf015999; Thu, 28 Jun 2018 03:23:32 GMT Received: by cisco.com (Postfix, from userid 392789) id D474320F2001; Wed, 27 Jun 2018 20:23:31 -0700 (PDT) From: John Daley To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Hyong Youb Kim Date: Wed, 27 Jun 2018 20:19:36 -0700 Message-Id: <20180628031940.17397-10-johndale@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180628031940.17397-1-johndale@cisco.com> References: <20180628031940.17397-1-johndale@cisco.com> Subject: [dpdk-dev] [PATCH 10/14] net/enic: reduce Tx completion updates 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" From: Hyong Youb Kim Request one completion update per roughly 32 buffers. It saves DMA resources on the NIC, PCIe utilization, and cache miss rates. Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/base/vnic_wq.c | 1 + drivers/net/enic/base/vnic_wq.h | 1 + drivers/net/enic/enic_res.h | 3 +++ drivers/net/enic/enic_rxtx.c | 23 +++++++++++++++++------ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/net/enic/base/vnic_wq.c b/drivers/net/enic/base/vnic_wq.c index a4c08a769..c9bf3572c 100644 --- a/drivers/net/enic/base/vnic_wq.c +++ b/drivers/net/enic/base/vnic_wq.c @@ -113,6 +113,7 @@ void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index, vnic_wq_init_start(wq, cq_index, 0, 0, error_interrupt_enable, error_interrupt_offset); + wq->cq_pend = 0; wq->last_completed_index = 0; } diff --git a/drivers/net/enic/base/vnic_wq.h b/drivers/net/enic/base/vnic_wq.h index 6622a8a2d..236cf6962 100644 --- a/drivers/net/enic/base/vnic_wq.h +++ b/drivers/net/enic/base/vnic_wq.h @@ -44,6 +44,7 @@ struct vnic_wq { struct vnic_dev_ring ring; struct rte_mbuf **bufs; unsigned int head_idx; + unsigned int cq_pend; unsigned int tail_idx; unsigned int socket_id; const struct rte_memzone *cqmsg_rz; diff --git a/drivers/net/enic/enic_res.h b/drivers/net/enic/enic_res.h index 6a3a0c5cc..6b1f6acad 100644 --- a/drivers/net/enic/enic_res.h +++ b/drivers/net/enic/enic_res.h @@ -20,6 +20,9 @@ #define ENIC_ALIGN_DESCS 32 #define ENIC_ALIGN_DESCS_MASK ~(ENIC_ALIGN_DESCS - 1) +/* Request a completion index every 32 buffers (roughly packets) */ +#define ENIC_WQ_CQ_THRESH 32 + #define ENIC_MIN_MTU 68 /* Does not include (possible) inserted VLAN tag and FCS */ diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index 89a1e66fe..7cddb53d9 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/drivers/net/enic/enic_rxtx.c @@ -603,7 +603,7 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct wq_enet_desc *descs, *desc_p, desc_tmp; uint16_t mss; uint8_t vlan_tag_insert; - uint8_t eop; + uint8_t eop, cq; uint64_t bus_addr; uint8_t offload_mode; uint16_t header_len; @@ -686,10 +686,14 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, break; } } - - + wq->cq_pend++; + cq = 0; + if (eop && wq->cq_pend >= ENIC_WQ_CQ_THRESH) { + cq = 1; + wq->cq_pend = 0; + } wq_enet_desc_enc(&desc_tmp, bus_addr, data_len, mss, header_len, - offload_mode, eop, eop, 0, vlan_tag_insert, + offload_mode, eop, cq, 0, vlan_tag_insert, vlan_id, 0); *desc_p = desc_tmp; @@ -702,14 +706,21 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_pkt->next) { data_len = tx_pkt->data_len; - if (tx_pkt->next == NULL) + wq->cq_pend++; + cq = 0; + if (tx_pkt->next == NULL) { eop = 1; + if (wq->cq_pend >= ENIC_WQ_CQ_THRESH) { + cq = 1; + wq->cq_pend = 0; + } + } desc_p = descs + head_idx; bus_addr = (dma_addr_t)(tx_pkt->buf_iova + tx_pkt->data_off); wq_enet_desc_enc((struct wq_enet_desc *) &desc_tmp, bus_addr, data_len, - mss, 0, offload_mode, eop, eop, + mss, 0, offload_mode, eop, cq, 0, vlan_tag_insert, vlan_id, 0);