qed: Add DCBX API - qed_dcbx_get_priority_tc()
[linux-2.6-microblaze.git] / drivers / net / ethernet / qlogic / qed / qed_dcbx.c
index d02e774..86307b9 100644 (file)
@@ -989,6 +989,24 @@ void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
        qed_dcbx_update_protocol_data(p_dcb_data, p_src, DCBX_PROTOCOL_ETH);
 }
 
+u8 qed_dcbx_get_priority_tc(struct qed_hwfn *p_hwfn, u8 pri)
+{
+       struct qed_dcbx_get *dcbx_info = &p_hwfn->p_dcbx_info->get;
+
+       if (pri >= QED_MAX_PFC_PRIORITIES) {
+               DP_ERR(p_hwfn, "Invalid priority %d\n", pri);
+               return QED_DCBX_DEFAULT_TC;
+       }
+
+       if (!dcbx_info->operational.valid) {
+               DP_VERBOSE(p_hwfn, QED_MSG_DCB,
+                          "Dcbx parameters not available\n");
+               return QED_DCBX_DEFAULT_TC;
+       }
+
+       return dcbx_info->operational.params.ets_pri_tc_tbl[pri];
+}
+
 #ifdef CONFIG_DCB
 static int qed_dcbx_query_params(struct qed_hwfn *p_hwfn,
                                 struct qed_dcbx_get *p_get,