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 4852FA045E for ; Wed, 29 May 2019 23:02:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 386011B950; Wed, 29 May 2019 23:02:38 +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 A663537A2 for ; Wed, 29 May 2019 23:02:35 +0200 (CEST) Received: by mail-pg1-f196.google.com with SMTP id 196so603352pgc.6 for ; Wed, 29 May 2019 14:02:35 -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=ar0RwgJzTJU9O1qToSzJCgZAZXlvz43uBX7uTcZs9FcZ74mVEpAwAoruOl0j7Kyvym AU2oP3CmzLNcULSQvYBSh3opDsPQgIUosrsQXC/Flki3SKHPz6ZLIxgZ4XN4G0Qv0ynw wKQ77uEtToud3xjjlCmgpKXjoFeP25vD+zua4= 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=Y8OnemHmjxyu0T+hjVRvQRW1HLouidTkg1fM7uKuQkC3hF3qqnPvTPIfH5kapV5L7a 9bF3xpKMNHi4OolZS8n7o+avK9pf4fGt6GALwAV8rl8ijbnClcXAaKha46UyBqIhRfQV e2ybbFsLPWg3ZeUxx4rDzlBCPtm6+GdVqR3iTJn0e+Qkr/vicbeoCJw0CsoOXVH/kFdk uGVnkHCeXCNrBsMamRZaFdbh63YVE4vbAN8hdJ4qs4V7sBtrFOR5VQwxcpdAXEmnK+DT UojMGAmKKFgA4f2qVSxjAS9oe+1mMBXHEehSYqN9LyxaQSszAgOCnBdp7tCDUJh8e0bo hTAg== X-Gm-Message-State: APjAAAUvM6n7Zl1mBI6sQiwgMZ1lRl2940lIMKqQhm3OPNikfWZhkEIZ zLVGbcrDuIJPD1efvOp+9A0O1JC5AroHaEjnpxzvSGSgAb7FyI3sIGznGyDl2vyRDCYYXA3M1DS 2/3iOliDXUDnLoPtccCJOZLxtBQQzGsNP/n2oGGtD/LBIY7SQjjrkbsXKdk9jF7Yg X-Google-Smtp-Source: APXvYqwxXiHwyRTW+i0W6/2AUyWHCDq3X3PQmHuobwKwy16jfuF8MNlZnJYxA2s+K4I2jB/u8PveYw== X-Received: by 2002:a62:5587:: with SMTP id j129mr131173106pfb.45.1559163754762; Wed, 29 May 2019 14:02:34 -0700 (PDT) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id r4sm403889pjd.25.2019.05.29.14.02.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 May 2019 14:02:34 -0700 (PDT) From: Lance Richardson To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com, maxime.coquelin@redhat.com, ktraynor@redhat.com, Lance Richardson Date: Wed, 29 May 2019 17:02:21 -0400 Message-Id: <20190529210227.17092-3-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190529210227.17092-1-lance.richardson@broadcom.com> References: <20190521213953.25425-1-ajit.khaparde@broadcom.com> <20190529210227.17092-1-lance.richardson@broadcom.com> Subject: [dpdk-dev] [PATCH v5 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