diff options
author | Doug Berger <opendmb@gmail.com> | 2017-07-14 16:12:10 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-15 21:29:08 -0700 |
commit | f48bed16a756f5bc0244acd581f61968f7d7c2a4 (patch) | |
tree | 5f8729e923872327c2a12f47a9f3693b7874aa88 /drivers/net/ethernet/broadcom/genet/bcmgenet.h | |
parent | 876dbadd53a7102e2a84afc84ea2bd3ee6dc5636 (diff) | |
download | lwn-f48bed16a756f5bc0244acd581f61968f7d7c2a4.tar.gz lwn-f48bed16a756f5bc0244acd581f61968f7d7c2a4.zip |
net: bcmgenet: Free skb after last Tx frag
Since the skb is attached to the first control block of a fragmented
skb it is possible that the skb could be freed when reclaiming that
control block before all fragments of the skb have been consumed by
the hardware and unmapped.
This commit introduces first_cb and last_cb pointers to the skb
control block used by the driver to keep track of which transmit
control blocks within a transmit ring are the first and last ones
associated with the skb.
It then splits the bcmgenet_free_cb() function into transmit
(bcmgenet_free_tx_cb) and receive (bcmgenet_free_rx_cb) versions
that can handle the unmapping of dma mapped memory and cleaning up
the corresponding control block structure so that the skb is only
freed after the last associated transmit control block is reclaimed.
Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Signed-off-by: Doug Berger <opendmb@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/genet/bcmgenet.h')
-rw-r--r-- | drivers/net/ethernet/broadcom/genet/bcmgenet.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h index efd07020b89f..b9344de669f8 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h @@ -544,6 +544,8 @@ struct bcmgenet_hw_params { }; struct bcmgenet_skb_cb { + struct enet_cb *first_cb; /* First control block of SKB */ + struct enet_cb *last_cb; /* Last control block of SKB */ unsigned int bytes_sent; /* bytes on the wire (no TSB) */ }; |