qed: Add a flag which indicates if offload TC is set
authorDenis Bolotin <denis.bolotin@cavium.com>
Tue, 7 Aug 2018 12:48:09 +0000 (15:48 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Aug 2018 20:22:10 +0000 (13:22 -0700)
Distinguish not set offload_tc from offload_tc 0 and add getters and
setters.

Signed-off-by: Michal Kalderon <michal.kalderon@cavium.com>
Signed-off-by: Ariel Elior <ariel.elior@cavium.com>
Signed-off-by: Denis Bolotin <denis.bolotin@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed.h
drivers/net/ethernet/qlogic/qed/qed_dcbx.c
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_mcp.c

index 1dfaccd151f0d457a2ce38447400925113ae546d..f916f139f80e2c42395a056f88550376cf9bb4e7 100644 (file)
@@ -336,6 +336,7 @@ struct qed_hw_info {
         */
        u8 num_active_tc;
        u8                              offload_tc;
+       bool                            offload_tc_set;
 
        u32                             concrete_fid;
        u16                             opaque_fid;
@@ -921,4 +922,6 @@ int qed_mfw_tlv_req(struct qed_hwfn *hwfn);
 int qed_mfw_fill_tlv_data(struct qed_hwfn *hwfn,
                          enum qed_mfw_tlv_type type,
                          union qed_mfw_tlv_data *tlv_data);
+
+void qed_hw_info_set_offload_tc(struct qed_hw_info *p_info, u8 tc);
 #endif /* _QED_H */
index 86307b90d83595ae9e05a5664a933b3f97e0f305..6bb76e6d3c141c7fb5f4854dbd6cef514b090bf1 100644 (file)
@@ -208,7 +208,7 @@ qed_dcbx_set_params(struct qed_dcbx_results *p_data,
 
        /* QM reconf data */
        if (p_info->personality == personality)
-               p_info->offload_tc = tc;
+               qed_hw_info_set_offload_tc(p_info, tc);
 }
 
 /* Update app protocol data and hw_info fields with the TLV info */
index 6a0b46f214f4fae3e365eb7b8e5aa5cf2248c9fb..a8e768342ad73ea36c6a9236b06901a3c314c708 100644 (file)
@@ -394,7 +394,25 @@ static void qed_init_qm_advance_vport(struct qed_hwfn *p_hwfn)
 /* defines for pq init */
 #define PQ_INIT_DEFAULT_WRR_GROUP       1
 #define PQ_INIT_DEFAULT_TC              0
-#define PQ_INIT_OFLD_TC                 (p_hwfn->hw_info.offload_tc)
+
+void qed_hw_info_set_offload_tc(struct qed_hw_info *p_info, u8 tc)
+{
+       p_info->offload_tc = tc;
+       p_info->offload_tc_set = true;
+}
+
+static bool qed_is_offload_tc_set(struct qed_hwfn *p_hwfn)
+{
+       return p_hwfn->hw_info.offload_tc_set;
+}
+
+static u32 qed_get_offload_tc(struct qed_hwfn *p_hwfn)
+{
+       if (qed_is_offload_tc_set(p_hwfn))
+               return p_hwfn->hw_info.offload_tc;
+
+       return PQ_INIT_DEFAULT_TC;
+}
 
 static void qed_init_qm_pq(struct qed_hwfn *p_hwfn,
                           struct qed_qm_info *qm_info,
@@ -538,7 +556,8 @@ static void qed_init_qm_pure_ack_pq(struct qed_hwfn *p_hwfn)
                return;
 
        qed_init_qm_set_idx(p_hwfn, PQ_FLAGS_ACK, qm_info->num_pqs);
-       qed_init_qm_pq(p_hwfn, qm_info, PQ_INIT_OFLD_TC, PQ_INIT_SHARE_VPORT);
+       qed_init_qm_pq(p_hwfn, qm_info, qed_get_offload_tc(p_hwfn),
+                      PQ_INIT_SHARE_VPORT);
 }
 
 static void qed_init_qm_offload_pq(struct qed_hwfn *p_hwfn)
@@ -549,7 +568,8 @@ static void qed_init_qm_offload_pq(struct qed_hwfn *p_hwfn)
                return;
 
        qed_init_qm_set_idx(p_hwfn, PQ_FLAGS_OFLD, qm_info->num_pqs);
-       qed_init_qm_pq(p_hwfn, qm_info, PQ_INIT_OFLD_TC, PQ_INIT_SHARE_VPORT);
+       qed_init_qm_pq(p_hwfn, qm_info, qed_get_offload_tc(p_hwfn),
+                      PQ_INIT_SHARE_VPORT);
 }
 
 static void qed_init_qm_low_latency_pq(struct qed_hwfn *p_hwfn)
@@ -560,7 +580,8 @@ static void qed_init_qm_low_latency_pq(struct qed_hwfn *p_hwfn)
                return;
 
        qed_init_qm_set_idx(p_hwfn, PQ_FLAGS_LLT, qm_info->num_pqs);
-       qed_init_qm_pq(p_hwfn, qm_info, PQ_INIT_OFLD_TC, PQ_INIT_SHARE_VPORT);
+       qed_init_qm_pq(p_hwfn, qm_info, qed_get_offload_tc(p_hwfn),
+                      PQ_INIT_SHARE_VPORT);
 }
 
 static void qed_init_qm_mcos_pqs(struct qed_hwfn *p_hwfn)
@@ -601,7 +622,8 @@ static void qed_init_qm_rl_pqs(struct qed_hwfn *p_hwfn)
 
        qed_init_qm_set_idx(p_hwfn, PQ_FLAGS_RLS, qm_info->num_pqs);
        for (pf_rls_idx = 0; pf_rls_idx < num_pf_rls; pf_rls_idx++)
-               qed_init_qm_pq(p_hwfn, qm_info, PQ_INIT_OFLD_TC, PQ_INIT_PF_RL);
+               qed_init_qm_pq(p_hwfn, qm_info, qed_get_offload_tc(p_hwfn),
+                              PQ_INIT_PF_RL);
 }
 
 static void qed_init_qm_pq_params(struct qed_hwfn *p_hwfn)
index 8e4f60e4520a34fcdd5a242584663a423f616caa..d89a0e22f6e4307896cae0383889c7b5b8f05c22 100644 (file)
@@ -1552,7 +1552,8 @@ qed_mcp_handle_ufp_event(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
 
        if (p_hwfn->ufp_info.mode == QED_UFP_MODE_VNIC_BW) {
                p_hwfn->qm_info.ooo_tc = p_hwfn->ufp_info.tc;
-               p_hwfn->hw_info.offload_tc = p_hwfn->ufp_info.tc;
+               qed_hw_info_set_offload_tc(&p_hwfn->hw_info,
+                                          p_hwfn->ufp_info.tc);
 
                qed_qm_reconf(p_hwfn, p_ptt);
        } else if (p_hwfn->ufp_info.mode == QED_UFP_MODE_ETS) {