@@ -2588,6 +2588,30 @@ void qed_iov_set_link(struct qed_hwfn *p_hwfn,
25882588 p_bulletin -> capability_speed = p_caps -> speed_capabilities ;
25892589}
25902590
2591+ static void qed_iov_get_link (struct qed_hwfn * p_hwfn ,
2592+ u16 vfid ,
2593+ struct qed_mcp_link_params * p_params ,
2594+ struct qed_mcp_link_state * p_link ,
2595+ struct qed_mcp_link_capabilities * p_caps )
2596+ {
2597+ struct qed_vf_info * p_vf = qed_iov_get_vf_info (p_hwfn ,
2598+ vfid ,
2599+ false);
2600+ struct qed_bulletin_content * p_bulletin ;
2601+
2602+ if (!p_vf )
2603+ return ;
2604+
2605+ p_bulletin = p_vf -> bulletin .p_virt ;
2606+
2607+ if (p_params )
2608+ __qed_vf_get_link_params (p_hwfn , p_params , p_bulletin );
2609+ if (p_link )
2610+ __qed_vf_get_link_state (p_hwfn , p_link , p_bulletin );
2611+ if (p_caps )
2612+ __qed_vf_get_link_caps (p_hwfn , p_caps , p_bulletin );
2613+ }
2614+
25912615static void qed_iov_process_mbx_req (struct qed_hwfn * p_hwfn ,
25922616 struct qed_ptt * p_ptt , int vfid )
25932617{
@@ -2840,6 +2864,17 @@ bool qed_iov_is_vf_stopped(struct qed_hwfn *p_hwfn, int vfid)
28402864 return p_vf_info -> state == VF_STOPPED ;
28412865}
28422866
2867+ static bool qed_iov_spoofchk_get (struct qed_hwfn * p_hwfn , int vfid )
2868+ {
2869+ struct qed_vf_info * vf_info ;
2870+
2871+ vf_info = qed_iov_get_vf_info (p_hwfn , (u16 ) vfid , true);
2872+ if (!vf_info )
2873+ return false;
2874+
2875+ return vf_info -> spoof_chk ;
2876+ }
2877+
28432878int qed_iov_spoofchk_set (struct qed_hwfn * p_hwfn , int vfid , bool val )
28442879{
28452880 struct qed_vf_info * vf ;
@@ -2937,6 +2972,23 @@ int qed_iov_configure_min_tx_rate(struct qed_dev *cdev, int vfid, u32 rate)
29372972 return qed_configure_vport_wfq (cdev , vport_id , rate );
29382973}
29392974
2975+ static int qed_iov_get_vf_min_rate (struct qed_hwfn * p_hwfn , int vfid )
2976+ {
2977+ struct qed_wfq_data * vf_vp_wfq ;
2978+ struct qed_vf_info * vf_info ;
2979+
2980+ vf_info = qed_iov_get_vf_info (p_hwfn , (u16 ) vfid , true);
2981+ if (!vf_info )
2982+ return 0 ;
2983+
2984+ vf_vp_wfq = & p_hwfn -> qm_info .wfq_data [vf_info -> vport_id ];
2985+
2986+ if (vf_vp_wfq -> configured )
2987+ return vf_vp_wfq -> min_speed ;
2988+ else
2989+ return 0 ;
2990+ }
2991+
29402992/**
29412993 * qed_schedule_iov - schedules IOV task for VF and PF
29422994 * @hwfn: hardware function pointer
@@ -3153,6 +3205,46 @@ static int qed_sriov_pf_set_vlan(struct qed_dev *cdev, u16 vid, int vfid)
31533205 return 0 ;
31543206}
31553207
3208+ static int qed_get_vf_config (struct qed_dev * cdev ,
3209+ int vf_id , struct ifla_vf_info * ivi )
3210+ {
3211+ struct qed_hwfn * hwfn = QED_LEADING_HWFN (cdev );
3212+ struct qed_public_vf_info * vf_info ;
3213+ struct qed_mcp_link_state link ;
3214+ u32 tx_rate ;
3215+
3216+ /* Sanitize request */
3217+ if (IS_VF (cdev ))
3218+ return - EINVAL ;
3219+
3220+ if (!qed_iov_is_valid_vfid (& cdev -> hwfns [0 ], vf_id , true)) {
3221+ DP_VERBOSE (cdev , QED_MSG_IOV ,
3222+ "VF index [%d] isn't active\n" , vf_id );
3223+ return - EINVAL ;
3224+ }
3225+
3226+ vf_info = qed_iov_get_public_vf_info (hwfn , vf_id , true);
3227+
3228+ qed_iov_get_link (hwfn , vf_id , NULL , & link , NULL );
3229+
3230+ /* Fill information about VF */
3231+ ivi -> vf = vf_id ;
3232+
3233+ if (is_valid_ether_addr (vf_info -> forced_mac ))
3234+ ether_addr_copy (ivi -> mac , vf_info -> forced_mac );
3235+ else
3236+ ether_addr_copy (ivi -> mac , vf_info -> mac );
3237+
3238+ ivi -> vlan = vf_info -> forced_vlan ;
3239+ ivi -> spoofchk = qed_iov_spoofchk_get (hwfn , vf_id );
3240+ ivi -> linkstate = vf_info -> link_state ;
3241+ tx_rate = vf_info -> tx_rate ;
3242+ ivi -> max_tx_rate = tx_rate ? tx_rate : link .speed ;
3243+ ivi -> min_tx_rate = qed_iov_get_vf_min_rate (hwfn , vf_id );
3244+
3245+ return 0 ;
3246+ }
3247+
31563248void qed_inform_vf_link_state (struct qed_hwfn * hwfn )
31573249{
31583250 struct qed_mcp_link_capabilities caps ;
@@ -3506,6 +3598,7 @@ const struct qed_iov_hv_ops qed_iov_ops_pass = {
35063598 .configure = & qed_sriov_configure ,
35073599 .set_mac = & qed_sriov_pf_set_mac ,
35083600 .set_vlan = & qed_sriov_pf_set_vlan ,
3601+ .get_config = & qed_get_vf_config ,
35093602 .set_link_state = & qed_set_vf_link_state ,
35103603 .set_spoof = & qed_spoof_configure ,
35113604 .set_rate = & qed_set_vf_rate ,
0 commit comments