Skip to content

Commit

Permalink
net/enic: fix filter mode detection
Browse files Browse the repository at this point in the history
[ upstream commit fb92745 ]

vnic_dev_capable_filter_mode() currently fails when
CMD_CAPABILITY(CMD_ADD_FILTER) returns ERR_EPERM. In turn, this
failure causes the driver initialization to fail.

But, firmware may legitimately return ERR_EPERM. For example, VF vNIC
returns ERR_EPERM when it does not support filtering at all. So, treat
ERR_EPERM as "no filtering available" instead of an unexpected error.

Fixes: 322b355 ("net/enic/base: bring NIC interface functions up to date")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
  • Loading branch information
Hyong Youb Kim authored and cpaelzer committed Nov 30, 2021
1 parent e67b39e commit 72dd222
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/net/enic/base/vnic_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,8 @@ static int vnic_dev_flowman_enable(struct vnic_dev *vdev, u32 *mode,
return 1;
}

/* Determine the "best" filtering mode VIC is capaible of. Returns one of 4
* value or 0 on error:
/* Determine the "best" filtering mode VIC is capable of. Returns one of 4
* value or 0 if filtering is unavailble:
* FILTER_FLOWMAN- flowman api capable
* FILTER_DPDK_1- advanced filters availabile
* FILTER_USNIC_IP_FLAG - advanced filters but with the restriction that
Expand Down Expand Up @@ -606,6 +606,14 @@ int vnic_dev_capable_filter_mode(struct vnic_dev *vdev, u32 *mode,
args[0] = CMD_ADD_FILTER;
args[1] = 0;
err = vnic_dev_cmd_args(vdev, CMD_CAPABILITY, args, 2, 1000);
/*
* ERR_EPERM may be returned if, for example, vNIC is
* on a VF. It simply means no filtering is available
*/
if (err == -ERR_EPERM) {
*mode = 0;
return 0;
}
if (err)
return err;
max_level = args[1];
Expand Down

0 comments on commit 72dd222

Please sign in to comment.