forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
....@@ -1,21 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2013-2014 Chelsio Communications. All rights reserved.
34 *
45 * Written by Anish Bhatt (anish@chelsio.com)
56 * Casey Leedom (leedom@chelsio.com)
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms and conditions of the GNU General Public License,
9
- * version 2, as published by the Free Software Foundation.
10
- *
11
- * This program is distributed in the hope it will be useful, but WITHOUT
12
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14
- * more details.
15
- *
16
- * The full GNU General Public License is included in this distribution in
17
- * the file called "COPYING".
18
- *
197 */
208
219 #include "cxgb4.h"
....@@ -114,6 +102,24 @@
114102 cxgb4_dcb_state_init(dev);
115103 }
116104
105
+/* update the dcb port support, if version is IEEE then set it to
106
+ * FW_PORT_DCB_VER_IEEE and if DCB_CAP_DCBX_VER_CEE is already set then
107
+ * clear that. and if it is set to CEE then set dcb supported to
108
+ * DCB_CAP_DCBX_VER_CEE & if DCB_CAP_DCBX_VER_IEEE is set, clear it
109
+ */
110
+static inline void cxgb4_dcb_update_support(struct port_dcb_info *dcb)
111
+{
112
+ if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) {
113
+ if (dcb->supported & DCB_CAP_DCBX_VER_CEE)
114
+ dcb->supported &= ~DCB_CAP_DCBX_VER_CEE;
115
+ dcb->supported |= DCB_CAP_DCBX_VER_IEEE;
116
+ } else if (dcb->dcb_version == FW_PORT_DCB_VER_CEE1D01) {
117
+ if (dcb->supported & DCB_CAP_DCBX_VER_IEEE)
118
+ dcb->supported &= ~DCB_CAP_DCBX_VER_IEEE;
119
+ dcb->supported |= DCB_CAP_DCBX_VER_CEE;
120
+ }
121
+}
122
+
117123 /* Finite State machine for Data Center Bridging.
118124 */
119125 void cxgb4_dcb_state_fsm(struct net_device *dev,
....@@ -165,6 +171,15 @@
165171 }
166172
167173 case CXGB4_DCB_STATE_FW_INCOMPLETE: {
174
+ if (transition_to != CXGB4_DCB_INPUT_FW_DISABLED) {
175
+ /* during this CXGB4_DCB_STATE_FW_INCOMPLETE state,
176
+ * check if the dcb version is changed (there can be
177
+ * mismatch in default config & the negotiated switch
178
+ * configuration at FW, so update the dcb support
179
+ * accordingly.
180
+ */
181
+ cxgb4_dcb_update_support(dcb);
182
+ }
168183 switch (transition_to) {
169184 case CXGB4_DCB_INPUT_FW_ENABLED: {
170185 /* we're alreaady in firmware DCB mode */