summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrenden Blanco <bblanco@plumgrid.com>2016-07-21 03:22:33 +0300
committerDavid S. Miller <davem@davemloft.net>2016-07-21 08:07:23 +0300
commitcb7386d37eae20141cbc292a883e5e358cb5a929 (patch)
tree0354fdaaa1a67cd7ffeef329d85a83d63a37b68c
parentf67fe5c80ba09edeca7f3d05800382cca89bc1d5 (diff)
downloadlinux-cb7386d37eae20141cbc292a883e5e358cb5a929.tar.xz
net/mlx4_en: use READ_ONCE when freeing xdp_prog
For consistency, and in order to hint at the synchronous nature of the xdp_prog field, use READ_ONCE in the destroy path of the ring. All occurrences should now use either READ_ONCE or xchg. Signed-off-by: Brenden Blanco <bblanco@plumgrid.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 11d88c817137..a02dec6fb256 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -535,9 +535,11 @@ void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv,
{
struct mlx4_en_dev *mdev = priv->mdev;
struct mlx4_en_rx_ring *ring = *pring;
+ struct bpf_prog *old_prog;
- if (ring->xdp_prog)
- bpf_prog_put(ring->xdp_prog);
+ old_prog = READ_ONCE(ring->xdp_prog);
+ if (old_prog)
+ bpf_prog_put(old_prog);
mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE);
vfree(ring->rx_info);
ring->rx_info = NULL;