Commit 613142b0 authored by Eryk Rybak's avatar Eryk Rybak Committed by Tony Nguyen

i40e: Log error for oversized MTU on device

When attempting to link XDP prog with MTU larger than supported,
user is not informed why XDP linking fails. Adding proper
error message: "MTU too large to enable XDP".
Signed-off-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: default avatarEryk Rybak <eryk.roch.rybak@intel.com>
Tested-by: default avatarKiran Bhandare <kiranx.bhandare@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent f020fa1a
...@@ -12448,9 +12448,10 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb, ...@@ -12448,9 +12448,10 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb,
* i40e_xdp_setup - add/remove an XDP program * i40e_xdp_setup - add/remove an XDP program
* @vsi: VSI to changed * @vsi: VSI to changed
* @prog: XDP program * @prog: XDP program
* @extack: netlink extended ack
**/ **/
static int i40e_xdp_setup(struct i40e_vsi *vsi, static int i40e_xdp_setup(struct i40e_vsi *vsi, struct bpf_prog *prog,
struct bpf_prog *prog) struct netlink_ext_ack *extack)
{ {
int frame_size = vsi->netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN; int frame_size = vsi->netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
...@@ -12459,8 +12460,10 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi, ...@@ -12459,8 +12460,10 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi,
int i; int i;
/* Don't allow frames that span over multiple buffers */ /* Don't allow frames that span over multiple buffers */
if (frame_size > vsi->rx_buf_len) if (frame_size > vsi->rx_buf_len) {
NL_SET_ERR_MSG_MOD(extack, "MTU too large to enable XDP");
return -EINVAL; return -EINVAL;
}
if (!i40e_enabled_xdp_vsi(vsi) && !prog) if (!i40e_enabled_xdp_vsi(vsi) && !prog)
return 0; return 0;
...@@ -12769,7 +12772,7 @@ static int i40e_xdp(struct net_device *dev, ...@@ -12769,7 +12772,7 @@ static int i40e_xdp(struct net_device *dev,
switch (xdp->command) { switch (xdp->command) {
case XDP_SETUP_PROG: case XDP_SETUP_PROG:
return i40e_xdp_setup(vsi, xdp->prog); return i40e_xdp_setup(vsi, xdp->prog, xdp->extack);
case XDP_SETUP_XSK_POOL: case XDP_SETUP_XSK_POOL:
return i40e_xsk_pool_setup(vsi, xdp->xsk.pool, return i40e_xsk_pool_setup(vsi, xdp->xsk.pool,
xdp->xsk.queue_id); xdp->xsk.queue_id);
......
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