]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
enic: add devcmds for vxlan offload
authorGovindarajulu Varadarajan <gvaradar@cisco.com>
Thu, 9 Feb 2017 00:43:07 +0000 (16:43 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Feb 2017 22:24:29 +0000 (17:24 -0500)
This patch adds devcmds needed for vxlan offload. Implement 3 new devcmd

overlay_offload_ctrl: enable/disable offload
overlay_offload_cfg: update offload udp port number
get_supported_feature_ver: get hw supported offload version. Each
   version has different bitmap for csum_ok/encap

Signed-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cisco/enic/vnic_dev.c
drivers/net/ethernet/cisco/enic/vnic_dev.h
drivers/net/ethernet/cisco/enic/vnic_devcmd.h
drivers/net/ethernet/cisco/enic/vnic_enet.h

index 8f27df3207bc0799d78c36b8b539caef1ad84ea4..1841ad45d2157c0e5635f013dc4165787476bfbf 100644 (file)
@@ -1247,3 +1247,37 @@ 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_get_supported_feature_ver(struct vnic_dev *vdev, u8 feature,
+                                      u64 *supported_versions)
+{
+       u64 a0 = feature;
+       int wait = 1000;
+       u64 a1 = 0;
+       int ret;
+
+       ret = vnic_dev_cmd(vdev, CMD_GET_SUPP_FEATURE_VER, &a0, &a1, wait);
+       if (!ret)
+               *supported_versions = a0;
+
+       return ret;
+}
index 54156c48442484dcdcc78a027eac0173ab1cd62f..9d43d6bb9907ec323d9c1520720447bb7731c808 100644 (file)
@@ -179,5 +179,10 @@ int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr);
 int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry,
                        struct filter *data);
 int vnic_devcmd_init(struct vnic_dev *vdev);
+int vnic_dev_overlay_offload_ctrl(struct vnic_dev *vdev, u8 overlay, u8 config);
+int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay,
+                                u16 vxlan_udp_port_number);
+int vnic_dev_get_supported_feature_ver(struct vnic_dev *vdev, u8 feature,
+                                      u64 *supported_versions);
 
 #endif /* _VNIC_DEV_H_ */
index 2a812880b884f35e8ebc51d971be3639c8f71c74..d83880b0d46852d51ddaec76f59fbed19cefba0c 100644 (file)
@@ -406,6 +406,31 @@ enum vnic_devcmd_cmd {
         * in: (u32) a0=Queue Pair number
         */
        CMD_QP_STATS_CLEAR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 63),
+
+       /* Use this devcmd for agreeing on the highest common version supported
+        * by both driver and fw for features who need such a facility.
+        * in:  (u64) a0 = feature (driver requests for the supported versions
+        *      on this feature)
+        * out: (u64) a0 = bitmap of all supported versions for that feature
+        */
+       CMD_GET_SUPP_FEATURE_VER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 69),
+
+       /* Control (Enable/Disable) overlay offloads on the given vnic
+        * in: (u8) a0 = OVERLAY_FEATURE_NVGRE : NVGRE
+        *          a0 = OVERLAY_FEATURE_VXLAN : VxLAN
+        * in: (u8) a1 = OVERLAY_OFFLOAD_ENABLE : Enable or
+        *          a1 = OVERLAY_OFFLOAD_DISABLE : Disable or
+        *          a1 = OVERLAY_OFFLOAD_ENABLE_V2 : Enable with version 2
+        */
+       CMD_OVERLAY_OFFLOAD_CTRL = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 72),
+
+       /* Configuration of overlay offloads feature on a given vNIC
+        * in: (u8) a0 = DEVCMD_OVERLAY_NVGRE : NVGRE
+        *          a0 = DEVCMD_OVERLAY_VXLAN : VxLAN
+        * in: (u8) a1 = VXLAN_PORT_UPDATE : VxLAN
+        * in: (u16) a2 = unsigned short int port information
+        */
+       CMD_OVERLAY_OFFLOAD_CFG = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 73),
 };
 
 /* CMD_ENABLE2 flags */
@@ -657,4 +682,30 @@ struct devcmd2_result {
 #define DEVCMD2_RING_SIZE      32
 #define DEVCMD2_DESC_SIZE      128
 
+enum overlay_feature_t {
+       OVERLAY_FEATURE_NVGRE = 1,
+       OVERLAY_FEATURE_VXLAN,
+       OVERLAY_FEATURE_MAX,
+};
+
+enum overlay_ofld_cmd {
+       OVERLAY_OFFLOAD_ENABLE,
+       OVERLAY_OFFLOAD_DISABLE,
+       OVERLAY_OFFLOAD_ENABLE_P2,
+       OVERLAY_OFFLOAD_MAX,
+};
+
+#define OVERLAY_CFG_VXLAN_PORT_UPDATE  0
+
+/* Use this enum to get the supported versions for each of these features
+ * If you need to use the devcmd_get_supported_feature_version(), add
+ * the new feature into this enum and install function handler in devcmd.c
+ */
+enum vic_feature_t {
+       VIC_FEATURE_VXLAN,
+       VIC_FEATURE_RDMA,
+       VIC_FEATURE_VXLAN_PATCH,
+       VIC_FEATURE_MAX,
+};
+
 #endif /* _VNIC_DEVCMD_H_ */
index 75aced2de86987b6a96205ca6d079f4d5cfd77be..7d6fbb5635a47ca21fd2bd1274948bd4687bd221 100644 (file)
@@ -48,6 +48,7 @@ struct vnic_enet_config {
 #define VENETF_RSSHASH_IPV6_EX 0x200   /* Hash on IPv6 extended fields */
 #define VENETF_RSSHASH_TCPIPV6_EX 0x400        /* Hash on TCP + IPv6 ext. fields */
 #define VENETF_LOOP            0x800   /* Loopback enabled */
+#define VENETF_VXLAN           0x10000 /* VxLAN offload */
 
 #define VENET_INTR_TYPE_MIN    0       /* Timer specs min interrupt spacing */
 #define VENET_INTR_TYPE_IDLE   1       /* Timer specs idle time before irq */