“24d142d5be8f195b6c08ca1868885cf3a546444a”上不存在“include/linux/git@gitcode.net:openharmony/kernel_linux.git”
提交 0c225db5 编写于 作者: S Saeed Mahameed 提交者: Xie XiuQi

net/mlx5e: XDP, Avoid checksum complete when XDP prog is loaded

[ Upstream commit 5d0bb3bac4b9f6c22280b04545626fdfd99edc6b ]

XDP programs might change packets data contents which will make the
reported skb checksum (checksum complete) invalid.

When XDP programs are loaded/unloaded set/clear rx RQs
MLX5E_RQ_STATE_NO_CSUM_COMPLETE flag.

Fixes: 86994156 ("net/mlx5e: XDP fast RX drop bpf programs support")
Reviewed-by: NTariq Toukan <tariqt@mellanox.com>
Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 8157b18d
...@@ -1517,7 +1517,8 @@ static int set_pflag_rx_no_csum_complete(struct net_device *netdev, bool enable) ...@@ -1517,7 +1517,8 @@ static int set_pflag_rx_no_csum_complete(struct net_device *netdev, bool enable)
struct mlx5e_channel *c; struct mlx5e_channel *c;
int i; int i;
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) if (!test_bit(MLX5E_STATE_OPENED, &priv->state) ||
priv->channels.params.xdp_prog)
return 0; return 0;
for (i = 0; i < channels->num; i++) { for (i = 0; i < channels->num; i++) {
......
...@@ -934,7 +934,11 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, ...@@ -934,7 +934,11 @@ static int mlx5e_open_rq(struct mlx5e_channel *c,
if (params->rx_dim_enabled) if (params->rx_dim_enabled)
__set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state);
if (params->pflags & MLX5E_PFLAG_RX_NO_CSUM_COMPLETE) /* We disable csum_complete when XDP is enabled since
* XDP programs might manipulate packets which will render
* skb->checksum incorrect.
*/
if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE) || c->xdp)
__set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state);
return 0; return 0;
......
...@@ -754,7 +754,8 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, ...@@ -754,7 +754,8 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
return; return;
} }
if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) /* True when explicitly set via priv flag, or XDP prog is loaded */
if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))
goto csum_unnecessary; goto csum_unnecessary;
/* CQE csum doesn't cover padding octets in short ethernet /* CQE csum doesn't cover padding octets in short ethernet
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册