Skip to content

Commit d64e78c

Browse files
committed
Merge branch 'cxgb4-dcb'
Anish Bhatt says: ==================== cxgb4 DCB updates The following patchset covers changes to work better with the userspace tools cgdcbxd and cgrulesengd and improves firmware support for host-managed mode. Also exports traffic class information that was previously not being exported via dcbnl_ops and unfifies how app selector information is passed to firmware. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents b52effd + 397665d commit d64e78c

File tree

3 files changed

+42
-17
lines changed

3 files changed

+42
-17
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ static const char * const dcb_ver_array[] = {
3131
"Auto Negotiated"
3232
};
3333

34+
static inline bool cxgb4_dcb_state_synced(enum cxgb4_dcb_state state)
35+
{
36+
if (state == CXGB4_DCB_STATE_FW_ALLSYNCED ||
37+
state == CXGB4_DCB_STATE_HOST)
38+
return true;
39+
else
40+
return false;
41+
}
42+
3443
/* Initialize a port's Data Center Bridging state. Typically used after a
3544
* Link Down event.
3645
*/
@@ -603,7 +612,7 @@ static void cxgb4_getpfccfg(struct net_device *dev, int priority, u8 *pfccfg)
603612
struct port_info *pi = netdev2pinfo(dev);
604613
struct port_dcb_info *dcb = &pi->dcb;
605614

606-
if (dcb->state != CXGB4_DCB_STATE_FW_ALLSYNCED ||
615+
if (!cxgb4_dcb_state_synced(dcb->state) ||
607616
priority >= CXGB4_MAX_PRIORITY)
608617
*pfccfg = 0;
609618
else
@@ -620,7 +629,7 @@ static void cxgb4_setpfccfg(struct net_device *dev, int priority, u8 pfccfg)
620629
struct adapter *adap = pi->adapter;
621630
int err;
622631

623-
if (pi->dcb.state != CXGB4_DCB_STATE_FW_ALLSYNCED ||
632+
if (!cxgb4_dcb_state_synced(pi->dcb.state) ||
624633
priority >= CXGB4_MAX_PRIORITY)
625634
return;
626635

@@ -732,7 +741,7 @@ static u8 cxgb4_getpfcstate(struct net_device *dev)
732741
{
733742
struct port_info *pi = netdev2pinfo(dev);
734743

735-
if (pi->dcb.state != CXGB4_DCB_STATE_FW_ALLSYNCED)
744+
if (!cxgb4_dcb_state_synced(pi->dcb.state))
736745
return false;
737746

738747
return pi->dcb.pfcen != 0;
@@ -756,7 +765,7 @@ static int __cxgb4_getapp(struct net_device *dev, u8 app_idtype, u16 app_id,
756765
struct adapter *adap = pi->adapter;
757766
int i;
758767

759-
if (pi->dcb.state != CXGB4_DCB_STATE_FW_ALLSYNCED)
768+
if (!cxgb4_dcb_state_synced(pi->dcb.state))
760769
return 0;
761770

762771
for (i = 0; i < CXGB4_MAX_DCBX_APP_SUPPORTED; i++) {
@@ -794,7 +803,9 @@ static int __cxgb4_getapp(struct net_device *dev, u8 app_idtype, u16 app_id,
794803
*/
795804
static int cxgb4_getapp(struct net_device *dev, u8 app_idtype, u16 app_id)
796805
{
797-
return __cxgb4_getapp(dev, app_idtype, app_id, 0);
806+
/* Convert app_idtype to firmware format before querying */
807+
return __cxgb4_getapp(dev, app_idtype == DCB_APP_IDTYPE_ETHTYPE ?
808+
app_idtype : 3, app_id, 0);
798809
}
799810

800811
/* Write a new Application User Priority Map for the specified Application ID
@@ -808,7 +819,7 @@ static int __cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id,
808819
int i, err;
809820

810821

811-
if (pi->dcb.state != CXGB4_DCB_STATE_FW_ALLSYNCED)
822+
if (!cxgb4_dcb_state_synced(pi->dcb.state))
812823
return -EINVAL;
813824

814825
/* DCB info gets thrown away on link up */
@@ -896,10 +907,11 @@ cxgb4_ieee_negotiation_complete(struct net_device *dev,
896907
struct port_info *pi = netdev2pinfo(dev);
897908
struct port_dcb_info *dcb = &pi->dcb;
898909

899-
if (dcb_subtype && !(dcb->msgs & dcb_subtype))
900-
return 0;
910+
if (dcb->state == CXGB4_DCB_STATE_FW_ALLSYNCED)
911+
if (dcb_subtype && !(dcb->msgs & dcb_subtype))
912+
return 0;
901913

902-
return (dcb->state == CXGB4_DCB_STATE_FW_ALLSYNCED &&
914+
return (cxgb4_dcb_state_synced(dcb->state) &&
903915
(dcb->supported & DCB_CAP_DCBX_VER_IEEE));
904916
}
905917

@@ -1057,7 +1069,7 @@ static u8 cxgb4_setdcbx(struct net_device *dev, u8 dcb_request)
10571069

10581070
/* Can't enable DCB if we haven't successfully negotiated it.
10591071
*/
1060-
if (pi->dcb.state != CXGB4_DCB_STATE_FW_ALLSYNCED)
1072+
if (!cxgb4_dcb_state_synced(pi->dcb.state))
10611073
return 1;
10621074

10631075
/* There's currently no mechanism to allow for the firmware DCBX
@@ -1080,7 +1092,7 @@ static int cxgb4_getpeer_app(struct net_device *dev,
10801092
struct adapter *adap = pi->adapter;
10811093
int i, err = 0;
10821094

1083-
if (pi->dcb.state != CXGB4_DCB_STATE_FW_ALLSYNCED)
1095+
if (!cxgb4_dcb_state_synced(pi->dcb.state))
10841096
return 1;
10851097

10861098
info->willing = 0;
@@ -1114,7 +1126,7 @@ static int cxgb4_getpeerapp_tbl(struct net_device *dev, struct dcb_app *table)
11141126
struct adapter *adap = pi->adapter;
11151127
int i, err = 0;
11161128

1117-
if (pi->dcb.state != CXGB4_DCB_STATE_FW_ALLSYNCED)
1129+
if (!cxgb4_dcb_state_synced(pi->dcb.state))
11181130
return 1;
11191131

11201132
for (i = 0; i < CXGB4_MAX_DCBX_APP_SUPPORTED; i++) {
@@ -1133,7 +1145,7 @@ static int cxgb4_getpeerapp_tbl(struct net_device *dev, struct dcb_app *table)
11331145
if (!pcmd.u.dcb.app_priority.protocolid)
11341146
break;
11351147

1136-
table[i].selector = pcmd.u.dcb.app_priority.sel_field;
1148+
table[i].selector = (pcmd.u.dcb.app_priority.sel_field + 1);
11371149
table[i].protocol =
11381150
be16_to_cpu(pcmd.u.dcb.app_priority.protocolid);
11391151
table[i].priority =
@@ -1181,6 +1193,8 @@ static int cxgb4_cee_peer_getpg(struct net_device *dev, struct cee_pg *pg)
11811193
for (i = 0; i < CXGB4_MAX_PRIORITY; i++)
11821194
pg->pg_bw[i] = pcmd.u.dcb.pgrate.pgrate[i];
11831195

1196+
pg->tcs_supported = pcmd.u.dcb.pgrate.num_tcs_supported;
1197+
11841198
return 0;
11851199
}
11861200

@@ -1198,6 +1212,8 @@ static int cxgb4_cee_peer_getpfc(struct net_device *dev, struct cee_pfc *pfc)
11981212
*/
11991213
pfc->pfc_en = bitswap_1(pi->dcb.pfcen);
12001214

1215+
pfc->tcs_supported = pi->dcb.pfc_num_tcs_supported;
1216+
12011217
return 0;
12021218
}
12031219

drivers/net/ethernet/chelsio/cxgb4/sge.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ cxgb_fcoe_offload(struct sk_buff *skb, struct adapter *adap,
11371137
*/
11381138
netdev_tx_t t4_eth_xmit(struct sk_buff *skb, struct net_device *dev)
11391139
{
1140-
u32 wr_mid;
1140+
u32 wr_mid, ctrl0;
11411141
u64 cntrl, *end;
11421142
int qidx, credits;
11431143
unsigned int flits, ndesc;
@@ -1274,9 +1274,15 @@ out_free: dev_kfree_skb_any(skb);
12741274
#endif /* CONFIG_CHELSIO_T4_FCOE */
12751275
}
12761276

1277-
cpl->ctrl0 = htonl(TXPKT_OPCODE_V(CPL_TX_PKT_XT) |
1278-
TXPKT_INTF_V(pi->tx_chan) |
1279-
TXPKT_PF_V(adap->pf));
1277+
ctrl0 = TXPKT_OPCODE_V(CPL_TX_PKT_XT) | TXPKT_INTF_V(pi->tx_chan) |
1278+
TXPKT_PF_V(adap->pf);
1279+
#ifdef CONFIG_CHELSIO_T4_DCB
1280+
if (is_t4(adap->params.chip))
1281+
ctrl0 |= TXPKT_OVLAN_IDX_V(q->dcb_prio);
1282+
else
1283+
ctrl0 |= TXPKT_T5_OVLAN_IDX_V(q->dcb_prio);
1284+
#endif
1285+
cpl->ctrl0 = htonl(ctrl0);
12801286
cpl->pack = htons(0);
12811287
cpl->len = htons(skb->len);
12821288
cpl->ctrl1 = cpu_to_be64(cntrl);

drivers/net/ethernet/chelsio/cxgb4/t4_msg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,9 @@ struct cpl_tx_pkt {
660660
#define TXPKT_OVLAN_IDX_S 12
661661
#define TXPKT_OVLAN_IDX_V(x) ((x) << TXPKT_OVLAN_IDX_S)
662662

663+
#define TXPKT_T5_OVLAN_IDX_S 12
664+
#define TXPKT_T5_OVLAN_IDX_V(x) ((x) << TXPKT_T5_OVLAN_IDX_S)
665+
663666
#define TXPKT_INTF_S 16
664667
#define TXPKT_INTF_V(x) ((x) << TXPKT_INTF_S)
665668

0 commit comments

Comments
 (0)