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 05F96A046B for ; Tue, 28 May 2019 21:24:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5BBFC1B94F; Tue, 28 May 2019 21:23:59 +0200 (CEST) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id EF9B74CA6 for ; Tue, 28 May 2019 21:23:54 +0200 (CEST) Received: by mail-pg1-f196.google.com with SMTP id z3so6947603pgp.8 for ; Tue, 28 May 2019 12:23:54 -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=hKhW9lJgWV91ReBGtN1A1IFlrA9yIofb+FYDaFmC5UoztE9dGOCv+mJd7WIo7A5+oT ZXD4PzrNHgVrg15fDYOoF4hz8OeGB65ZMbKS4k9yS/B1itEbBK3qBOXMRFLfwCAsiD09 ZG+fFtNEKbNCi0M0ZlswkdIFit4O/jvKrM/yU= 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=V5JHrwAkpoz0OqwaZ2RJPOQCQzpUZ92du59v/qNLe7NYq4TNfRsMWiCHJEBUUlXOPV KVwQjPQVdArsK7so6j85+BlgB9NqTTuxGc6Go6FT2mX6F7jOdZ5BXVYrb41tkzTXyGQ/ 878/I3abXH/HghFLI+jPvtFcSyMoTTWzf51M+zHWsjGqa1HKDMMjdCcCftdAFocbLMRo hmfFtZNN+eAK26KG/6JVtZiauFe8aOecRLzkf9AJHOMLF5wTyvPPXoj4ZQpL//Ny241h HCG25i1uYqpDOTrAszFPb4SpjZso7PSe2zJ+8hcAMuuv+TYrM2m/sdnpPOv0hvCQ2EXq cXEg== X-Gm-Message-State: APjAAAXLE2i+us4zSJERZ8DMU1etKKIDiZxvb4RQ9gpdVJKxyRNsN5ig jzaww9D9F9JInCRqjfrx2o6OxfaTCfnjZdu1GCuA65LcaFuCBODKvf3PqkvVpoLuuyml/N62w8H G4XMYaO6ttHQC16qUfcSSmhDgc0fLvTKF1G0TrsGDbMV4cwxhZ9/qVF95+szKbzCK X-Google-Smtp-Source: APXvYqymXw+5wyCxjDDJ67c7SKMhD4V9NmNF61OAoKws/+u5i3QqB6gr006tGIxtWvyJ2GkqA2o5iQ== X-Received: by 2002:a65:60d2:: with SMTP id r18mr22903869pgv.217.1559071433993; Tue, 28 May 2019 12:23:53 -0700 (PDT) Received: from lrichardson-VirtualBox.dhcp.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id q66sm3733070pjb.13.2019.05.28.12.23.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 12:23:53 -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: Tue, 28 May 2019 15:23:33 -0400 Message-Id: <20190528192339.10903-3-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190528192339.10903-1-lance.richardson@broadcom.com> References: <20190521213953.25425-1-ajit.khaparde@broadcom.com> <20190528192339.10903-1-lance.richardson@broadcom.com> Subject: [dpdk-dev] [PATCH v3 2/8] 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