[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200618160941.879717-6-jonathan.lemon@gmail.com>
Date: Thu, 18 Jun 2020 09:09:25 -0700
From: Jonathan Lemon <jonathan.lemon@...il.com>
To: <netdev@...r.kernel.org>
CC: <kernel-team@...com>, <axboe@...nel.dk>
Subject: [RFC PATCH 05/21] mlx5/xsk: check that xsk does not conflict with netgpu
netgpu will use the same data structures as xsk, so make sure that
they are not conflicting.
Signed-off-by: Jonathan Lemon <jonathan.lemon@...il.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.c | 3 +++
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.h | 3 +++
2 files changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.c
index 7b17fcd0a56d..f3d3569816cb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.c
@@ -27,7 +27,10 @@ static int mlx5e_xsk_get_umems(struct mlx5e_xsk *xsk)
sizeof(*xsk->umems), GFP_KERNEL);
if (unlikely(!xsk->umems))
return -ENOMEM;
+ xsk->is_netgpu = false;
}
+ if (xsk->is_netgpu)
+ return -EINVAL;
xsk->refcnt++;
xsk->ever_used = true;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.h b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.h
index 25b4cbe58b54..c7eff534d28a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/umem.h
@@ -15,6 +15,9 @@ static inline struct xdp_umem *mlx5e_xsk_get_umem(struct mlx5e_params *params,
if (unlikely(ix >= params->num_channels))
return NULL;
+ if (unlikely(xsk->is_netgpu))
+ return NULL;
+
return xsk->umems[ix];
}
--
2.24.1
Powered by blists - more mailing lists