Commit 76581af2 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: count all failed TX attempts as errors

Currently if we need to modify the head of the skb and allocation
fails we would free the skb and not increment the error counter.
Make sure all errors are counted.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ca72efb6
...@@ -873,17 +873,14 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev) ...@@ -873,17 +873,14 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
} }
md_bytes = nfp_net_prep_port_id(skb); md_bytes = nfp_net_prep_port_id(skb);
if (unlikely(md_bytes < 0)) { if (unlikely(md_bytes < 0))
nfp_net_tx_xmit_more_flush(tx_ring); goto err_flush;
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
/* Start with the head skbuf */ /* Start with the head skbuf */
dma_addr = dma_map_single(dp->dev, skb->data, skb_headlen(skb), dma_addr = dma_map_single(dp->dev, skb->data, skb_headlen(skb),
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (dma_mapping_error(dp->dev, dma_addr)) if (dma_mapping_error(dp->dev, dma_addr))
goto err_free; goto err_dma_err;
wr_idx = D_IDX(tx_ring, tx_ring->wr_p); wr_idx = D_IDX(tx_ring, tx_ring->wr_p);
...@@ -979,8 +976,9 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev) ...@@ -979,8 +976,9 @@ static int nfp_net_tx(struct sk_buff *skb, struct net_device *netdev)
tx_ring->txbufs[wr_idx].skb = NULL; tx_ring->txbufs[wr_idx].skb = NULL;
tx_ring->txbufs[wr_idx].dma_addr = 0; tx_ring->txbufs[wr_idx].dma_addr = 0;
tx_ring->txbufs[wr_idx].fidx = -2; tx_ring->txbufs[wr_idx].fidx = -2;
err_free: err_dma_err:
nn_dp_warn(dp, "Failed to map DMA TX buffer\n"); nn_dp_warn(dp, "Failed to map DMA TX buffer\n");
err_flush:
nfp_net_tx_xmit_more_flush(tx_ring); nfp_net_tx_xmit_more_flush(tx_ring);
u64_stats_update_begin(&r_vec->tx_sync); u64_stats_update_begin(&r_vec->tx_sync);
r_vec->tx_errors++; r_vec->tx_errors++;
......
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