| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2013-2014 Chelsio Communications. All rights reserved. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Written by Anish Bhatt (anish@chelsio.com) |
|---|
| 5 | 6 | * 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 | | - * |
|---|
| 19 | 7 | */ |
|---|
| 20 | 8 | |
|---|
| 21 | 9 | #include "cxgb4.h" |
|---|
| .. | .. |
|---|
| 114 | 102 | cxgb4_dcb_state_init(dev); |
|---|
| 115 | 103 | } |
|---|
| 116 | 104 | |
|---|
| 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 | + |
|---|
| 117 | 123 | /* Finite State machine for Data Center Bridging. |
|---|
| 118 | 124 | */ |
|---|
| 119 | 125 | void cxgb4_dcb_state_fsm(struct net_device *dev, |
|---|
| .. | .. |
|---|
| 165 | 171 | } |
|---|
| 166 | 172 | |
|---|
| 167 | 173 | 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 | + } |
|---|
| 168 | 183 | switch (transition_to) { |
|---|
| 169 | 184 | case CXGB4_DCB_INPUT_FW_ENABLED: { |
|---|
| 170 | 185 | /* we're alreaady in firmware DCB mode */ |
|---|