DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/enic: fix filter mode detection
@ 2021-10-13  1:21 Hyong Youb Kim
  2021-10-13 13:41 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Hyong Youb Kim @ 2021-10-13  1:21 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Hyong Youb Kim, stable, John Daley

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: 322b355f2183 ("net/enic/base: bring NIC interface functions up to date")
Cc: stable@dpdk.org

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/base/vnic_dev.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/enic/base/vnic_dev.c b/drivers/net/enic/base/vnic_dev.c
index ab6e05739b..9c42595ced 100644
--- a/drivers/net/enic/base/vnic_dev.c
+++ b/drivers/net/enic/base/vnic_dev.c
@@ -644,8 +644,8 @@ static int vnic_dev_flowman_enable(struct vnic_dev *vdev, uint32_t *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
@@ -680,6 +680,14 @@ int vnic_dev_capable_filter_mode(struct vnic_dev *vdev, uint32_t *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];
-- 
2.26.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/enic: fix filter mode detection
  2021-10-13  1:21 [dpdk-dev] [PATCH] net/enic: fix filter mode detection Hyong Youb Kim
@ 2021-10-13 13:41 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2021-10-13 13:41 UTC (permalink / raw)
  To: Hyong Youb Kim; +Cc: dev, stable, John Daley

On 10/13/2021 2:21 AM, Hyong Youb Kim wrote:
> 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: 322b355f2183 ("net/enic/base: bring NIC interface functions up to date")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
> Reviewed-by: John Daley <johndale@cisco.com>

Applied to dpdk-next-net/main, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-13 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13  1:21 [dpdk-dev] [PATCH] net/enic: fix filter mode detection Hyong Youb Kim
2021-10-13 13:41 ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).