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: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Eryk Rybak <eryk.roch.rybak@intel.com> Tested-by: Kiran Bhandare <kiranx.bhandare@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
Родитель
f020fa1a79
Коммит
613142b0bb
|
@ -12448,9 +12448,10 @@ out_err:
|
|||
* i40e_xdp_setup - add/remove an XDP program
|
||||
* @vsi: VSI to changed
|
||||
* @prog: XDP program
|
||||
* @extack: netlink extended ack
|
||||
**/
|
||||
static int i40e_xdp_setup(struct i40e_vsi *vsi,
|
||||
struct bpf_prog *prog)
|
||||
static int i40e_xdp_setup(struct i40e_vsi *vsi, struct bpf_prog *prog,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
int frame_size = vsi->netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
|
||||
struct i40e_pf *pf = vsi->back;
|
||||
|
@ -12459,8 +12460,10 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi,
|
|||
int i;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
if (!i40e_enabled_xdp_vsi(vsi) && !prog)
|
||||
return 0;
|
||||
|
@ -12769,7 +12772,7 @@ static int i40e_xdp(struct net_device *dev,
|
|||
|
||||
switch (xdp->command) {
|
||||
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:
|
||||
return i40e_xsk_pool_setup(vsi, xdp->xsk.pool,
|
||||
xdp->xsk.queue_id);
|
||||
|
|
Загрузка…
Ссылка в новой задаче