netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next v2 10/12] bnxt_en: Refactor tx completion path.
Date: Thu,  2 Feb 2017 11:55:38 -0500	[thread overview]
Message-ID: <1486054540-366-11-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1486054540-366-1-git-send-email-michael.chan@broadcom.com>

XDP_TX requires a different function to handle completion.  Add a
function pointer to handle tx completion logic.  Regular TX rings
will be assigned the current bnxt_tx_int() for the ->tx_int()
function pointer.

Also, add a struct page pointer as a union with the current skb pointer
to the struct bnxt_sw_tx_bd.  XDP TX rings will use the struct page
pointer.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c |  5 ++++-
 drivers/net/ethernet/broadcom/bnxt/bnxt.h | 10 +++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 0292bea..ff651a0 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1762,7 +1762,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
 	BNXT_CP_DB(cpr->cp_doorbell, cpr->cp_raw_cons);
 
 	if (tx_pkts)
-		bnxt_tx_int(bp, bnapi, tx_pkts);
+		bnapi->tx_int(bp, bnapi, tx_pkts);
 
 	if (event & BNXT_RX_EVENT) {
 		struct bnxt_rx_ring_info *rxr = bnapi->rx_ring;
@@ -3045,6 +3045,9 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool irq_re_init)
 			if (i >= bp->tx_nr_rings_xdp)
 				bp->tx_ring[i].txq_index = i -
 					bp->tx_nr_rings_xdp;
+			else
+				bp->bnapi[j]->flags |= BNXT_NAPI_FLAG_XDP;
+			bp->bnapi[j]->tx_int = bnxt_tx_int;
 		}
 
 		rc = bnxt_alloc_stats(bp);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 9bc908f..6bf9444 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -515,7 +515,10 @@ struct rx_tpa_end_cmp_ext {
 #define BNXT_AGG_EVENT	2
 
 struct bnxt_sw_tx_bd {
-	struct sk_buff		*skb;
+	union {
+		struct sk_buff		*skb;
+		struct page		*page;
+	};
 	DEFINE_DMA_UNMAP_ADDR(mapping);
 	u8			is_gso;
 	u8			is_push;
@@ -664,6 +667,11 @@ struct bnxt_napi {
 	struct bnxt_rx_ring_info	*rx_ring;
 	struct bnxt_tx_ring_info	*tx_ring;
 
+	void			(*tx_int)(struct bnxt *, struct bnxt_napi *,
+					  int);
+	u32			flags;
+#define BNXT_NAPI_FLAG_XDP	0x1
+
 	bool			in_reset;
 };
 
-- 
1.8.3.1

  parent reply	other threads:[~2017-02-02 16:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 16:55 [PATCH net-next v2 00/12] bnxt_en: Add XDP support Michael Chan
2017-02-02 16:55 ` [PATCH net-next v2 01/12] bnxt_en: Refactor rx SKB function Michael Chan
2017-02-02 22:56   ` Jakub Kicinski
2017-02-02 23:40     ` Michael Chan
2017-02-03  0:22       ` Jakub Kicinski
2017-02-03  0:34         ` Michael Chan
2017-02-02 16:55 ` [PATCH net-next v2 02/12] bnxt_en: Don't use DEFINE_DMA_UNMAP_ADDR to store DMA address in RX path Michael Chan
2017-02-02 16:55 ` [PATCH net-next v2 03/12] bnxt_en: Add bp->rx_dir field for rx buffer DMA direction Michael Chan
2017-02-02 16:55 ` [PATCH net-next v2 04/12] bnxt_en: Parameterize RX buffer offsets Michael Chan
2017-02-02 16:55 ` [PATCH net-next v2 05/12] bnxt_en: Add RX page mode support Michael Chan
2017-02-02 16:55 ` [PATCH net-next v2 06/12] bnxt_en: Use event bit map in RX path Michael Chan
2017-02-02 16:55 ` [PATCH net-next v2 07/12] bnxt_en: Centralize logic to reserve rings Michael Chan
2017-02-02 16:55 ` [PATCH net-next v2 08/12] bnxt_en: Add tx ring mapping logic Michael Chan
2017-02-02 16:55 ` [PATCH net-next v2 09/12] bnxt_en: Add a set of TX rings to support XDP Michael Chan
2017-02-02 16:55 ` Michael Chan [this message]
2017-02-02 16:55 ` [PATCH net-next v2 11/12] bnxt_en: Add basic XDP support Michael Chan
2017-02-02 17:18   ` Mintz, Yuval
2017-02-02 21:30     ` Michael Chan
2017-02-02 23:08   ` Jakub Kicinski
2017-02-02 23:57     ` Alexei Starovoitov
2017-02-02 16:55 ` [PATCH net-next v2 12/12] bnxt_en: Add support for XDP_TX action Michael Chan
2017-02-03 20:49 ` [PATCH net-next v2 00/12] bnxt_en: Add XDP support David Miller
2017-02-03 21:13   ` Michael Chan
2017-02-03 21:50     ` David Miller
2017-02-03 21:58       ` Tom Herbert
2017-02-03 22:02         ` David Miller
2017-02-03 22:25           ` Tom Herbert
2017-02-03 22:29             ` David Miller
2017-02-04  0:33       ` Jakub Kicinski
2017-02-04  1:32         ` Michael Chan
2017-02-04  1:41           ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486054540-366-11-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).