From patchwork Thu Oct 29 01:26:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "John Daley (johndale)" X-Patchwork-Id: 8146 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id F1D8B5A5D; Thu, 29 Oct 2015 02:26:36 +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 AA0B8374E for ; Thu, 29 Oct 2015 02:26:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=5475; q=dns/txt; s=iport; t=1446081995; x=1447291595; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=bK8f5lsSB084jyI895IAeRx7uzH+UGacD9I3zMkkr38=; b=iQ+IyXba6e8iy2EerGxR3Q6bS9nTPjpTmCwmDDap6/kPW55dQ8Vwb1Ca 3mw/EVQECZxa176WtEx2Qj8iERGFLcDSCFEe/0W96VTztG3IBXerE1/Xy 42NG1goUyyjsWjBaQUU6j7H2ISQ7oPsfv/rIa289FduimnVK+dDCxrtTl Y=; X-IronPort-AV: E=Sophos;i="5.20,212,1444694400"; d="scan'208";a="40148000" Received: from alln-core-4.cisco.com ([173.36.13.137]) by rcdn-iport-8.cisco.com with ESMTP; 29 Oct 2015 01:26:34 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id t9T1QYc5029052; Thu, 29 Oct 2015 01:26:34 GMT Received: by cisco.com (Postfix, from userid 392789) id 4E0CD3FAACF6; Wed, 28 Oct 2015 18:26:34 -0700 (PDT) From: John Daley To: dev@dpdk.org Date: Wed, 28 Oct 2015 18:26:09 -0700 Message-Id: <1446081969-15911-1-git-send-email-johndale@cisco.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1445640444-30340-1-git-send-email-johndale@cisco.com> References: <1445640444-30340-1-git-send-email-johndale@cisco.com> Cc: John Daley Subject: [dpdk-dev] [PATCH v2] enic: improve Tx packet rate 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For every packet sent, a completion was being requested and the posted_index register on the nic was being updated. Instead, request a completion and update the posted index once per burst after all packets have been sent by the burst function. Acked-by: Sujith Sankar Signed-off-by: John Daley --- drivers/net/enic/enic.h | 12 +++++++----- drivers/net/enic/enic_ethdev.c | 22 ++++++++++++++-------- drivers/net/enic/enic_main.c | 28 +++++++++++++++------------- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 91faeaf..9e78305 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -48,7 +48,7 @@ #define DRV_NAME "enic_pmd" #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Poll-mode Driver" -#define DRV_VERSION "1.0.0.5" +#define DRV_VERSION "1.0.0.6" #define DRV_COPYRIGHT "Copyright 2008-2015 Cisco Systems, Inc" #define ENIC_WQ_MAX 8 @@ -187,10 +187,12 @@ extern void enic_add_packet_filter(struct enic *enic); extern void enic_set_mac_address(struct enic *enic, uint8_t *mac_addr); extern void enic_del_mac_address(struct enic *enic); extern unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq); -extern int enic_send_pkt(struct enic *enic, struct vnic_wq *wq, - struct rte_mbuf *tx_pkt, unsigned short len, - uint8_t sop, uint8_t eop, - uint16_t ol_flags, uint16_t vlan_tag); +extern void enic_send_pkt(struct enic *enic, struct vnic_wq *wq, + struct rte_mbuf *tx_pkt, unsigned short len, + uint8_t sop, uint8_t eop, uint8_t cq_entry, + uint16_t ol_flags, uint16_t vlan_tag); + +extern void enic_post_wq_index(struct vnic_wq *wq); extern int enic_poll(struct vnic_rq *rq, struct rte_mbuf **rx_pkts, unsigned int budget, unsigned int *work_done); extern int enic_probe(struct enic *enic); diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index e385560..f8f7817 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -488,21 +488,26 @@ static uint16_t enicpmd_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, unsigned int seg_len; unsigned int inc_len; unsigned int nb_segs; - struct rte_mbuf *tx_pkt; + struct rte_mbuf *tx_pkt, *next_tx_pkt; struct vnic_wq *wq = (struct vnic_wq *)tx_queue; struct enic *enic = vnic_dev_priv(wq->vdev); unsigned short vlan_id; unsigned short ol_flags; + uint8_t last_seg, eop; for (index = 0; index < nb_pkts; index++) { tx_pkt = *tx_pkts++; inc_len = 0; nb_segs = tx_pkt->nb_segs; if (nb_segs > vnic_wq_desc_avail(wq)) { + if (index > 0) + enic_post_wq_index(wq); + /* wq cleanup and try again */ if (!enic_cleanup_wq(enic, wq) || - (nb_segs > vnic_wq_desc_avail(wq))) + (nb_segs > vnic_wq_desc_avail(wq))) { return index; + } } pkt_len = tx_pkt->pkt_len; vlan_id = tx_pkt->vlan_tci; @@ -510,14 +515,15 @@ static uint16_t enicpmd_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, for (frags = 0; inc_len < pkt_len; frags++) { if (!tx_pkt) break; + next_tx_pkt = tx_pkt->next; seg_len = tx_pkt->data_len; inc_len += seg_len; - if (enic_send_pkt(enic, wq, tx_pkt, - (unsigned short)seg_len, !frags, - (pkt_len == inc_len), ol_flags, vlan_id)) { - break; - } - tx_pkt = tx_pkt->next; + eop = (pkt_len == inc_len) || (!next_tx_pkt); + last_seg = eop && + (index == ((unsigned int)nb_pkts - 1)); + enic_send_pkt(enic, wq, tx_pkt, (unsigned short)seg_len, + !frags, eop, last_seg, ol_flags, vlan_id); + tx_pkt = next_tx_pkt; } } diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index c3c62c4..07a9810 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -58,6 +58,7 @@ #include "vnic_cq.h" #include "vnic_intr.h" #include "vnic_nic.h" +#include "enic_vnic_wq.h" static inline int enic_is_sriov_vf(struct enic *enic) { @@ -151,15 +152,18 @@ unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq) -1 /*wq_work_to_do*/, enic_wq_service, NULL); } +void enic_post_wq_index(struct vnic_wq *wq) +{ + enic_vnic_post_wq_index(wq); +} -int enic_send_pkt(struct enic *enic, struct vnic_wq *wq, - struct rte_mbuf *tx_pkt, unsigned short len, - uint8_t sop, uint8_t eop, - uint16_t ol_flags, uint16_t vlan_tag) +void enic_send_pkt(struct enic *enic, struct vnic_wq *wq, + struct rte_mbuf *tx_pkt, unsigned short len, + uint8_t sop, uint8_t eop, uint8_t cq_entry, + uint16_t ol_flags, uint16_t vlan_tag) { struct wq_enet_desc *desc = vnic_wq_next_desc(wq); uint16_t mss = 0; - uint8_t cq_entry = eop; uint8_t vlan_tag_insert = 0; uint64_t bus_addr = (dma_addr_t) (tx_pkt->buf_physaddr + RTE_PKTMBUF_HEADROOM); @@ -190,14 +194,12 @@ int enic_send_pkt(struct enic *enic, struct vnic_wq *wq, vlan_tag, 0 /* loopback */); - vnic_wq_post(wq, (void *)tx_pkt, bus_addr, len, - sop, eop, - 1 /*desc_skip_cnt*/, - cq_entry, - 0 /*compressed send*/, - 0 /*wrid*/); - - return 0; + enic_vnic_post_wq(wq, (void *)tx_pkt, bus_addr, len, + sop, + 1 /*desc_skip_cnt*/, + cq_entry, + 0 /*compressed send*/, + 0 /*wrid*/); } void enic_dev_stats_clear(struct enic *enic)