net/enic: update the UDP RSS detection mechanism
[dpdk.git] / drivers / net / enic / base / vnic_dev.c
index 364458a..16e8814 100644 (file)
@@ -528,21 +528,20 @@ parse_max_level:
        return 0;
 }
 
-int vnic_dev_capable_udp_rss(struct vnic_dev *vdev)
+void vnic_dev_capable_udp_rss_weak(struct vnic_dev *vdev, bool *cfg_chk,
+                                  bool *weak)
 {
        u64 a0 = CMD_NIC_CFG, a1 = 0;
-       u64 rss_hash_type;
        int wait = 1000;
        int err;
 
+       *cfg_chk = false;
+       *weak = false;
        err = vnic_dev_cmd(vdev, CMD_CAPABILITY, &a0, &a1, wait);
-       if (err)
-               return 0;
-       if (a0 == 0)
-               return 0;
-       rss_hash_type = (a1 >> NIC_CFG_RSS_HASH_TYPE_SHIFT) &
-               NIC_CFG_RSS_HASH_TYPE_MASK_FIELD;
-       return ((rss_hash_type & NIC_CFG_RSS_HASH_TYPE_UDP) ? 1 : 0);
+       if (err == 0 && a0 != 0 && a1 != 0) {
+               *cfg_chk = true;
+               *weak = !!((a1 >> 32) & CMD_NIC_CFG_CAPF_UDP_WEAK);
+       }
 }
 
 int vnic_dev_capable(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd)
@@ -1062,3 +1061,36 @@ int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry,
 
        return ret;
 }
+
+int vnic_dev_overlay_offload_ctrl(struct vnic_dev *vdev, u8 overlay, u8 config)
+{
+       u64 a0 = overlay;
+       u64 a1 = config;
+       int wait = 1000;
+
+       return vnic_dev_cmd(vdev, CMD_OVERLAY_OFFLOAD_CTRL, &a0, &a1, wait);
+}
+
+int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay,
+                                u16 vxlan_udp_port_number)
+{
+       u64 a1 = vxlan_udp_port_number;
+       u64 a0 = overlay;
+       int wait = 1000;
+
+       return vnic_dev_cmd(vdev, CMD_OVERLAY_OFFLOAD_CFG, &a0, &a1, wait);
+}
+
+int vnic_dev_capable_vxlan(struct vnic_dev *vdev)
+{
+       u64 a0 = VIC_FEATURE_VXLAN;
+       u64 a1 = 0;
+       int wait = 1000;
+       int ret;
+
+       ret = vnic_dev_cmd(vdev, CMD_GET_SUPP_FEATURE_VER, &a0, &a1, wait);
+       /* 1 if the NIC can do VXLAN for both IPv4 and IPv6 with multiple WQs */
+       return ret == 0 &&
+               (a1 & (FEATURE_VXLAN_IPV6 | FEATURE_VXLAN_MULTI_WQ)) ==
+               (FEATURE_VXLAN_IPV6 | FEATURE_VXLAN_MULTI_WQ);
+}