From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 1F010A05D3 for ; Fri, 24 May 2019 16:50:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A41011B947; Fri, 24 May 2019 16:50:07 +0200 (CEST) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id D3C9C2C16 for ; Fri, 24 May 2019 16:50:04 +0200 (CEST) Received: by mail-pf1-f193.google.com with SMTP id a23so5481760pff.4 for ; Fri, 24 May 2019 07:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xqntc0zx8qv6Px9K8cRLEJlZz5wdigPelpcCLb5s6XE=; b=FG6kDDwRUI0ucbngRUfqy2MeRtEvFDmFOS/knWhF0fa80FHpR8cArPR+vAmukOWaSY kJL7UHWPpXk1aKQ2+MT47DfWjLH4iUoQTkGmsGtfRoRqUF+mrT7EtHA5mn29EJr/JEva O9BKCy95DNatcHDpQx0U3Lk6wrWC4dSmwayxw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xqntc0zx8qv6Px9K8cRLEJlZz5wdigPelpcCLb5s6XE=; b=XrJPmb8nEuIDMFwuByrfIHC+Fu3vGZtxXwH8p0PzzkHkHQhDA73io9HrYNK4E3Lqf6 YvXI1ns8WsVTiXhLPgSV/SYLOIl/EF5giu5ERds6HFckBTfpNRkxX1Rs89LvTuvYcndz WPhR4XMOLk9DXqaZdcTLUERIhtd6B1B8fYc2jSH42BDQPi87MXO95+FaJexiBbVH1LfU kW9V1DdB/qZ6zQxq0QZTV6pIxCOxn2G+jByA0vYVFCbhugnAn8mCwn7Mkpzm4q1nZuEm /WmX0gEpMfu2B/irnRNyFmhy2AD7JeS89LYxyyF7Ax+Ov0KqOuzo0/Uhf7Yws0u/qhoD 2Skg== X-Gm-Message-State: APjAAAXPT3f4tQ0JlNkpm+Ydp/l5ETR6nivcboQ7IpvkQGCSwrOrIHTN gVtjAfXhsOECOMTFUZYK/nkcuwDiJXENcm7PCz+MbV4iq/U7Qm8WJ32xURcdGTvQrtcTnTKZ9V3 hf0yK8lFAgo6kiFoouvTweO7RMQQav8y9YsnMd6OpvKf1uHfhmOUz5EbbA9mwQN79 X-Google-Smtp-Source: APXvYqwUpUrfCKw3P+DRYUxuPq3BoFilEuILp4oCN0saH6Zx3BE6eefrlvNae+VLnzVTNPLqkYKmcw== X-Received: by 2002:a63:e408:: with SMTP id a8mr18783864pgi.146.1558709403631; Fri, 24 May 2019 07:50:03 -0700 (PDT) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id x23sm2723705pfn.160.2019.05.24.07.50.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 May 2019 07:50:02 -0700 (PDT) From: Lance Richardson To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com, maxime.coquelin@redhat.com, Lance Richardson Date: Fri, 24 May 2019 10:49:26 -0400 Message-Id: <20190524144935.18765-2-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190524144935.18765-1-lance.richardson@broadcom.com> References: <20190521213953.25425-1-ajit.khaparde@broadcom.com> <20190524144935.18765-1-lance.richardson@broadcom.com> Subject: [dpdk-dev] [PATCH v2 01/10] net/bnxt: move tx bd checking to header file 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" To allow sharing of tx_bds_in_hw() and bnxt_tx_avail() between vector-mode and non-vector transmit functions, move these functions into bnxt_txr.h. Signed-off-by: Lance Richardson Reviewed-by: Ajit Khaparde Reviewed-by: Maxime Coquelin --- drivers/net/bnxt/bnxt_txr.c | 15 --------------- drivers/net/bnxt/bnxt_txr.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c index 9de12e0d0..16598ba63 100644 --- a/drivers/net/bnxt/bnxt_txr.c +++ b/drivers/net/bnxt/bnxt_txr.c @@ -103,21 +103,6 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id) return 0; } -static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq) -{ - return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) & - txq->tx_ring->tx_ring_struct->ring_mask); -} - -static inline uint32_t bnxt_tx_avail(struct bnxt_tx_queue *txq) -{ - /* Tell compiler to fetch tx indices from memory. */ - rte_compiler_barrier(); - - return ((txq->tx_ring->tx_ring_struct->ring_size - - bnxt_tx_bds_in_hw(txq)) - 1); -} - static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt, struct bnxt_tx_queue *txq, uint16_t *coal_pkts, diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h index f802d5080..13ca04676 100644 --- a/drivers/net/bnxt/bnxt_txr.h +++ b/drivers/net/bnxt/bnxt_txr.h @@ -37,6 +37,21 @@ struct bnxt_sw_tx_bd { unsigned short nr_bds; }; +static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq) +{ + return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) & + txq->tx_ring->tx_ring_struct->ring_mask); +} + +static inline uint32_t bnxt_tx_avail(struct bnxt_tx_queue *txq) +{ + /* Tell compiler to fetch tx indices from memory. */ + rte_compiler_barrier(); + + return ((txq->tx_ring->tx_ring_struct->ring_size - + bnxt_tx_bds_in_hw(txq)) - 1); +} + void bnxt_free_tx_rings(struct bnxt *bp); int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq); int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id); -- 2.17.1