Commit 84404d5f authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnxt_en: Fix ethtool self-test loopback.

The current code has 2 problems.  It assumes that the RX ring for
the loopback packet is combined with the TX ring.  This is not
true if the ethtool channels are set to non-combined mode.  The
second problem is that it won't work on 57500 chips without
adjusting the logic to get the proper completion ring (cpr) pointer.
Fix both issues by locating the proper cpr pointer through the RX
ring.

Fixes: e44758b7 ("bnxt_en: Use bnxt_cp_ring_info struct pointer as parameter for RX path.")
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 912cb1d5
...@@ -2572,6 +2572,7 @@ static int bnxt_poll_loopback(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, ...@@ -2572,6 +2572,7 @@ static int bnxt_poll_loopback(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
static int bnxt_run_loopback(struct bnxt *bp) static int bnxt_run_loopback(struct bnxt *bp)
{ {
struct bnxt_tx_ring_info *txr = &bp->tx_ring[0]; struct bnxt_tx_ring_info *txr = &bp->tx_ring[0];
struct bnxt_rx_ring_info *rxr = &bp->rx_ring[0];
struct bnxt_cp_ring_info *cpr; struct bnxt_cp_ring_info *cpr;
int pkt_size, i = 0; int pkt_size, i = 0;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -2579,7 +2580,9 @@ static int bnxt_run_loopback(struct bnxt *bp) ...@@ -2579,7 +2580,9 @@ static int bnxt_run_loopback(struct bnxt *bp)
u8 *data; u8 *data;
int rc; int rc;
cpr = &txr->bnapi->cp_ring; cpr = &rxr->bnapi->cp_ring;
if (bp->flags & BNXT_FLAG_CHIP_P5)
cpr = cpr->cp_ring_arr[BNXT_RX_HDL];
pkt_size = min(bp->dev->mtu + ETH_HLEN, bp->rx_copy_thresh); pkt_size = min(bp->dev->mtu + ETH_HLEN, bp->rx_copy_thresh);
skb = netdev_alloc_skb(bp->dev, pkt_size); skb = netdev_alloc_skb(bp->dev, pkt_size);
if (!skb) if (!skb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment