cxgbe(4): Read the rx 'c' channel for a port and make it available.

MFC after:	1 week
Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2021-02-25 18:10:52 -08:00
parent 763db58932
commit dfff1de729
3 changed files with 21 additions and 0 deletions

View File

@ -306,6 +306,7 @@ struct port_info {
uint8_t tx_chan;
uint8_t mps_bg_map; /* rx MPS buffer group bitmap */
uint8_t rx_e_chan_map; /* rx TP e-channel bitmap */
uint8_t rx_c_chan; /* rx TP c-channel */
struct link_config link_cfg;
struct ifmedia media;

View File

@ -6818,6 +6818,23 @@ static unsigned int t4_get_rx_e_chan_map(struct adapter *adap, int idx)
return 1 << idx;
}
/*
* TP RX c-channel associated with the port.
*/
static unsigned int t4_get_rx_c_chan(struct adapter *adap, int idx)
{
u32 param, val;
int ret;
param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_TPCHMAP));
ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, &param, &val);
if (!ret)
return (val >> (8 * idx)) & 0xff;
return 0;
}
/**
* t4_get_port_type_description - return Port Type string description
* @port_type: firmware Port Type enumeration
@ -9840,6 +9857,7 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf, int port_id)
p->tx_chan = j;
p->mps_bg_map = t4_get_mps_bg_map(adap, j);
p->rx_e_chan_map = t4_get_rx_e_chan_map(adap, j);
p->rx_c_chan = t4_get_rx_c_chan(adap, j);
p->lport = j;
if (!(adap->flags & IS_VF) ||

View File

@ -7077,6 +7077,8 @@ cxgbe_sysctls(struct port_info *pi)
pi->mps_bg_map, "MPS buffer group map");
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "rx_e_chan_map", CTLFLAG_RD,
NULL, pi->rx_e_chan_map, "TP rx e-channel map");
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "rx_c_chan", CTLFLAG_RD, NULL,
pi->rx_c_chan, "TP rx c-channel");
if (sc->flags & IS_VF)
return;