cxgb4: IEEE fixes for DCBx state machine
Subsystems (3)
PATCH 1/1 cxgb4: IEEE fixes for DCBx state machine
* Changes required due to 16eecd9be4b05 ("dcbnl : Fix misleading dcb_app->priority explanation")
* Driver was previously not aware of what DCBx version was negotiated by firmware, this could lead to DCB app table in kernel or in firmware being populated wrong since IEEE/CEE used different formats made clear by above mentioned commit, both cases addressed.
* Driver was missing a couple of state transitions that could be caused by other drivers that use chelsio hardware, resulting in incorrect behaviour (the change that addresses this also flips the state machine to switch on state instead of transition, hope this is okay in current window)
* Prio queue info & tsa is no longer thrown away
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 3 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 260 +++++++++++++++++------- drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h | 10 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 + drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 12 +- 5 files changed, 216 insertions(+), 71 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +3 -0
@@ -522,6 +522,9 @@ struct sge_txq {struct sge_eth_txq {/* state for an SGE Ethernet Tx queue */ struct sge_txq q;struct netdev_queue *txq;/* associated netdev TX queue */ +#ifdef CONFIG_CHELSIO_T4_DCB +u8 dcb_prio;/* DCB Priority bound to queue */ +#endif unsigned long tso;/* # of TSO requests */ unsigned long tx_cso;/* # of Tx checksum offloads */ unsigned long vlan_ins;/* # of Tx VLAN insertions */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +190 -70
442 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h +10 -0
@@ -63,6 +63,13 @@#define INIT_PORT_DCB_WRITE_CMD (__pcmd, __port) \ INIT_PORT_DCB_CMD(__pcmd, __port, EXEC, FW_PORT_ACTION_L2_DCB_CFG) +#define IEEE_FAUX_SYNC (__dev, __dcb) \ + do { \ + if ((__dcb)->dcb_version == FW_PORT_DCB_VER_IEEE) \ + cxgb4_dcb_state_fsm((__dev), \ + CXGB4_DCB_STATE_FW_ALLSYNCED); \ + } while (0) +/* States we can be in for a port's Data Center Bridging. */ enum cxgb4_dcb_state {
@@ -108,11 +115,13 @@ struct port_dcb_info {* Native Endian format). */ u32 pgid;/* Priority Group[0..7] */ +u8 dcb_version;/* Running DCBx version */ u8 pfcen;/* Priority Flow Control[0..7] */ u8 pg_num_tcs_supported;/* max PG Traffic Classes */ u8 pfc_num_tcs_supported;/* max PFC Traffic Classes */ u8 pgrate[8 ];/* Priority Group Rate[0..7] */ u8 priorate[8 ];/* Priority Rate[0..7] */ +u8 tsa[8 ];/* TSA Algorithm[0..7] */ struct app_priority {/* Application Information */ u8 user_prio_map;/* Priority Map bitfield */ u8 sel_field;/* Protocol ID interpretation */
@@ -121,6 +130,7 @@ struct port_dcb_info { };void cxgb4_dcb_state_init (struct net_device *); +void cxgb4_dcb_version_init (struct net_device *);void cxgb4_dcb_state_fsm (struct net_device *,enum cxgb4_dcb_state_input );void cxgb4_dcb_handle_fw_update (struct adapter *,const struct fw_port_cmd *);void cxgb4_dcb_set_caps (struct adapter *,const struct fw_port_cmd *);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +2 -0
@@ -522,6 +522,8 @@ static void dcb_tx_queue_prio_enable(struct net_device *dev, int enable)dev_err (adap->pdev_dev,"Can't %s DCB Priority on port %d, TX Queue %d: err=%d\n" , enable ?"set" :"unset" , pi->port_id, i, -err); + else + txq->dcb_prio = value; } }#endif /* CONFIG_CHELSIO_T4_DCB */
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +11 -1
@@ -1629,6 +1629,14 @@ enum fw_port_l2cfg_ctlbf {FW_PORT_L2_CTLBF_TXIPG =0x20 }; +enum fw_port_dcb_versions { +FW_PORT_DCB_VER_UNKNOWN , +FW_PORT_DCB_VER_CEE1D0 , +FW_PORT_DCB_VER_CEE1D01 , +FW_PORT_DCB_VER_IEEE , +FW_PORT_DCB_VER_AUTO =7 +}; +enum fw_port_dcb_cfg {FW_PORT_DCB_CFG_PG =0x01 ,FW_PORT_DCB_CFG_PFC =0x02 ,
@@ -1709,6 +1717,7 @@ struct fw_port_cmd {__u8 r10_lo[5 ];__u8 num_tcs_supported;__u8 pgrate[8 ]; +__u8 tsa[8 ]; } pgrate;struct fw_port_dcb_priorate {__u8 type;
@@ -1735,7 +1744,7 @@ struct fw_port_cmd {struct fw_port_dcb_control {__u8 type;__u8 all_syncd_pkd; -__be16 pfc_state_to_app_state; +__be16 dcb_version_to_app_state;__be32 r11;__be64 r12; } control;
@@ -1778,6 +1787,7 @@ struct fw_port_cmd {#define FW_PORT_CMD_DCBXDIS (1U << 7)#define FW_PORT_CMD_APPLY (1U << 7)#define FW_PORT_CMD_ALL_SYNCD (1U << 7) +#define FW_PORT_CMD_DCB_VERSION_GET (x) (((x) >> 8) & 0xf)#define FW_PORT_CMD_PPPEN (x) ((x) << 31)#define FW_PORT_CMD_TPSRC (x) ((x) << 28)
Signature · 1 line
2.0.4
David Miller
maintainerFrom: Anish Bhatt <[email protected]>
Date: Thu, 7 Aug 2014 13:10:56 -0700
Quoted 2 lines
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +2
-0+netdev_info (dev,"%s: Initializing DCB state for port[%d]\n" , + __func__, pi->port_id);
...
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c void cxgb4_dcb_state_init(struct net_device *dev) · line 74
Quoted 2 lines
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +2
-0+netdev_info (dev,"%s: State change from %d to %d for %s\n" , + __func__, dcb->state, transition_to, dev->name);
These logging messages look excessive, especially at KERN_INFO logging level.
Either remove them or make them _dbg() or similar.