net/qede/base: add UDP ports in bulletin board message
authorRasesh Mody <rasesh.mody@cavium.com>
Wed, 29 Mar 2017 20:36:54 +0000 (13:36 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 17:02:54 +0000 (19:02 +0200)
Add UDP ports in bulletin board message.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
drivers/net/qede/base/ecore_iov_api.h
drivers/net/qede/base/ecore_sriov.c
drivers/net/qede/base/ecore_vf.c
drivers/net/qede/base/ecore_vf_api.h
drivers/net/qede/base/ecore_vfpf_if.h

index 6a0fc5a..870c57e 100644 (file)
@@ -716,6 +716,8 @@ enum _ecore_status_t ecore_iov_configure_min_tx_rate(struct ecore_dev *p_dev,
  */
 u16 ecore_iov_get_next_active_vf(struct ecore_hwfn *p_hwfn, u16 rel_vf_id);
 
+void ecore_iov_bulletin_set_udp_ports(struct ecore_hwfn *p_hwfn, int vfid,
+                                     u16 vxlan_port, u16 geneve_port);
 #endif /* CONFIG_ECORE_SRIOV */
 
 #define ecore_for_each_vf(_p_hwfn, _i)                                 \
index 20b51c4..532c492 100644 (file)
@@ -2253,6 +2253,7 @@ static void ecore_iov_vf_mbx_update_tunn_param(struct ecore_hwfn *p_hwfn,
        bool b_update_required = false;
        struct ecore_tunnel_info tunn;
        u16 tunn_feature_mask = 0;
+       int i;
 
        mbx->offset = (u8 *)mbx->reply_virt;
 
@@ -2300,11 +2301,20 @@ static void ecore_iov_vf_mbx_update_tunn_param(struct ecore_hwfn *p_hwfn,
 
        /* If ECORE client is willing to update anything ? */
        if (b_update_required) {
+               u16 geneve_port;
+
                rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, &tunn,
                                                 ECORE_SPQ_MODE_EBLOCK,
                                                 OSAL_NULL);
                if (rc != ECORE_SUCCESS)
                        status = PFVF_STATUS_FAILURE;
+
+               geneve_port = p_tun->geneve_port.port;
+               ecore_for_each_vf(p_hwfn, i) {
+                       ecore_iov_bulletin_set_udp_ports(p_hwfn, i,
+                                                        p_tun->vxlan_port.port,
+                                                        geneve_port);
+               }
        }
 
 send_resp:
@@ -4028,6 +4038,29 @@ void ecore_iov_bulletin_set_forced_vlan(struct ecore_hwfn *p_hwfn,
        ecore_iov_configure_vport_forced(p_hwfn, vf_info, feature);
 }
 
+void ecore_iov_bulletin_set_udp_ports(struct ecore_hwfn *p_hwfn,
+                                     int vfid, u16 vxlan_port, u16 geneve_port)
+{
+       struct ecore_vf_info *vf_info;
+
+       vf_info = ecore_iov_get_vf_info(p_hwfn, (u16)vfid, true);
+       if (!vf_info) {
+               DP_NOTICE(p_hwfn->p_dev, true,
+                         "Can not set udp ports, invalid vfid [%d]\n", vfid);
+               return;
+       }
+
+       if (vf_info->b_malicious) {
+               DP_VERBOSE(p_hwfn, ECORE_MSG_IOV,
+                          "Can not set udp ports to malicious VF [%d]\n",
+                          vfid);
+               return;
+       }
+
+       vf_info->bulletin.p_virt->vxlan_udp_port = vxlan_port;
+       vf_info->bulletin.p_virt->geneve_udp_port = geneve_port;
+}
+
 bool ecore_iov_vf_has_vport_instance(struct ecore_hwfn *p_hwfn, int vfid)
 {
        struct ecore_vf_info *p_vf_info;
index bf516cc..8ce9340 100644 (file)
@@ -1652,6 +1652,18 @@ bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac,
        return true;
 }
 
+void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn *p_hwfn,
+                                    u16 *p_vxlan_port,
+                                    u16 *p_geneve_port)
+{
+       struct ecore_bulletin_content *p_bulletin;
+
+       p_bulletin = &p_hwfn->vf_iov_info->bulletin_shadow;
+
+       *p_vxlan_port = p_bulletin->vxlan_udp_port;
+       *p_geneve_port = p_bulletin->geneve_udp_port;
+}
+
 bool ecore_vf_bulletin_get_forced_vlan(struct ecore_hwfn *hwfn, u16 *dst_pvid)
 {
        struct ecore_bulletin_content *bulletin;
index 77b93ff..a6e5f32 100644 (file)
@@ -152,5 +152,7 @@ void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn,
                             u16 *fw_minor,
                             u16 *fw_rev,
                             u16 *fw_eng);
+void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn *p_hwfn,
+                                    u16 *p_vxlan_port, u16 *p_geneve_port);
 #endif
 #endif
index e0b63bf..6618442 100644 (file)
@@ -554,9 +554,12 @@ struct ecore_bulletin_content {
        u8 pfc_enabled;
        u8 partner_tx_flow_ctrl_en;
        u8 partner_rx_flow_ctrl_en;
+
        u8 partner_adv_pause;
        u8 sfp_tx_fault;
-       u8 padding4[6];
+       u16 vxlan_udp_port;
+       u16 geneve_udp_port;
+       u8 padding4[2];
 
        u32 speed;
        u32 partner_adv_speed;