net/hns3: fix return value for unsupported tuple
[dpdk.git] / drivers / net / enic / base / vnic_dev.c
index 55c08eb..00d7782 100644 (file)
@@ -594,6 +594,9 @@ static int vnic_dev_flowman_enable(struct vnic_dev *vdev, uint32_t *mode,
        uint64_t ops;
        static uint32_t instance;
 
+       /* Advanced filtering is a prerequisite */
+       if (!vnic_dev_capable_adv_filters(vdev))
+               return 0;
        /* flowman devcmd available? */
        if (!vnic_dev_capable(vdev, CMD_FLOW_MANAGER_OP))
                return 0;
@@ -644,8 +647,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 +683,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];
@@ -889,7 +900,7 @@ int vnic_dev_add_addr(struct vnic_dev *vdev, uint8_t *addr)
 
        err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait);
        if (err)
-               pr_err("Can't add addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
+               pr_err("Can't add addr [" RTE_ETHER_ADDR_PRT_FMT "], %d\n",
                        addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
                        err);
 
@@ -908,7 +919,7 @@ int vnic_dev_del_addr(struct vnic_dev *vdev, uint8_t *addr)
 
        err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait);
        if (err)
-               pr_err("Can't del addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
+               pr_err("Can't del addr [" RTE_ETHER_ADDR_PRT_FMT "], %d\n",
                        addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
                        err);