Skip to content

Commit 6a29a42

Browse files
committed
Merge branch 'cxgb4-T6-update'
Hariprasad Shenai says: ==================== Update support for T6 adapters This patch changes updates the various code changes related to register, stats and hardware related changes for T6 family of adapters. This patch series has been created against net-next tree and includes patches on cxgb4 and cxgb4vf driver. We have included all the maintainers of respective drivers. Kindly review the change and let us know in case of any review comments. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents aeb7ed1 + 10aa3b7 commit 6a29a42

File tree

12 files changed

+338
-73
lines changed

12 files changed

+338
-73
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ struct devlog_params {
301301
/* Stores chip specific parameters */
302302
struct arch_specific_params {
303303
u8 nchan;
304+
u8 pm_stats_cnt;
305+
u8 cng_ch_bits_log; /* congestion channel map bits width */
304306
u16 mps_rplc_size;
305307
u16 vfcount;
306308
u32 sge_fl_db;
@@ -1255,6 +1257,7 @@ int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver);
12551257
int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op);
12561258
int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
12571259
const u8 *fw_data, unsigned int size, int force);
1260+
int t4_fl_pkt_align(struct adapter *adap);
12581261
unsigned int t4_flash_cfg_addr(struct adapter *adapter);
12591262
int t4_check_fw_version(struct adapter *adap);
12601263
int t4_get_fw_version(struct adapter *adapter, u32 *vers);

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

Lines changed: 109 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,8 @@ static int pm_stats_show(struct seq_file *seq, void *v)
757757
};
758758

759759
int i;
760-
u32 tx_cnt[PM_NSTATS], rx_cnt[PM_NSTATS];
761-
u64 tx_cyc[PM_NSTATS], rx_cyc[PM_NSTATS];
760+
u32 tx_cnt[T6_PM_NSTATS], rx_cnt[T6_PM_NSTATS];
761+
u64 tx_cyc[T6_PM_NSTATS], rx_cyc[T6_PM_NSTATS];
762762
struct adapter *adap = seq->private;
763763

764764
t4_pmtx_get_stats(adap, tx_cnt, tx_cyc);
@@ -773,6 +773,32 @@ static int pm_stats_show(struct seq_file *seq, void *v)
773773
for (i = 0; i < PM_NSTATS - 1; i++)
774774
seq_printf(seq, "%-13s %10u %20llu\n",
775775
rx_pm_stats[i], rx_cnt[i], rx_cyc[i]);
776+
777+
if (CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) {
778+
/* In T5 the granularity of the total wait is too fine.
779+
* It is not useful as it reaches the max value too fast.
780+
* Hence display this Input FIFO wait for T6 onwards.
781+
*/
782+
seq_printf(seq, "%13s %10s %20s\n",
783+
" ", "Total wait", "Total Occupancy");
784+
seq_printf(seq, "Tx FIFO wait %10u %20llu\n",
785+
tx_cnt[i], tx_cyc[i]);
786+
seq_printf(seq, "Rx FIFO wait %10u %20llu\n",
787+
rx_cnt[i], rx_cyc[i]);
788+
789+
/* Skip index 6 as there is nothing useful ihere */
790+
i += 2;
791+
792+
/* At index 7, a new stat for read latency (count, total wait)
793+
* is added.
794+
*/
795+
seq_printf(seq, "%13s %10s %20s\n",
796+
" ", "Reads", "Total wait");
797+
seq_printf(seq, "Tx latency %10u %20llu\n",
798+
tx_cnt[i], tx_cyc[i]);
799+
seq_printf(seq, "Rx latency %10u %20llu\n",
800+
rx_cnt[i], rx_cyc[i]);
801+
}
776802
return 0;
777803
}
778804

@@ -1559,25 +1585,35 @@ static int mps_tcam_show(struct seq_file *seq, void *v)
15591585
{
15601586
struct adapter *adap = seq->private;
15611587
unsigned int chip_ver = CHELSIO_CHIP_VERSION(adap->params.chip);
1562-
15631588
if (v == SEQ_START_TOKEN) {
1564-
if (adap->params.arch.mps_rplc_size > 128)
1589+
if (chip_ver > CHELSIO_T5) {
15651590
seq_puts(seq, "Idx Ethernet address Mask "
1591+
" VNI Mask IVLAN Vld "
1592+
"DIP_Hit Lookup Port "
15661593
"Vld Ports PF VF "
15671594
"Replication "
15681595
" P0 P1 P2 P3 ML\n");
1569-
else
1570-
seq_puts(seq, "Idx Ethernet address Mask "
1571-
"Vld Ports PF VF Replication"
1572-
" P0 P1 P2 P3 ML\n");
1596+
} else {
1597+
if (adap->params.arch.mps_rplc_size > 128)
1598+
seq_puts(seq, "Idx Ethernet address Mask "
1599+
"Vld Ports PF VF "
1600+
"Replication "
1601+
" P0 P1 P2 P3 ML\n");
1602+
else
1603+
seq_puts(seq, "Idx Ethernet address Mask "
1604+
"Vld Ports PF VF Replication"
1605+
" P0 P1 P2 P3 ML\n");
1606+
}
15731607
} else {
15741608
u64 mask;
15751609
u8 addr[ETH_ALEN];
1576-
bool replicate;
1610+
bool replicate, dip_hit = false, vlan_vld = false;
15771611
unsigned int idx = (uintptr_t)v - 2;
15781612
u64 tcamy, tcamx, val;
1579-
u32 cls_lo, cls_hi, ctl;
1613+
u32 cls_lo, cls_hi, ctl, data2, vnix = 0, vniy = 0;
15801614
u32 rplc[8] = {0};
1615+
u8 lookup_type = 0, port_num = 0;
1616+
u16 ivlan = 0;
15811617

15821618
if (chip_ver > CHELSIO_T5) {
15831619
/* CtlCmdType - 0: Read, 1: Write
@@ -1596,13 +1632,35 @@ static int mps_tcam_show(struct seq_file *seq, void *v)
15961632
val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A);
15971633
tcamy = DMACH_G(val) << 32;
15981634
tcamy |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A);
1635+
data2 = t4_read_reg(adap, MPS_CLS_TCAM_DATA2_CTL_A);
1636+
lookup_type = DATALKPTYPE_G(data2);
1637+
/* 0 - Outer header, 1 - Inner header
1638+
* [71:48] bit locations are overloaded for
1639+
* outer vs. inner lookup types.
1640+
*/
1641+
if (lookup_type && (lookup_type != DATALKPTYPE_M)) {
1642+
/* Inner header VNI */
1643+
vniy = ((data2 & DATAVIDH2_F) << 23) |
1644+
(DATAVIDH1_G(data2) << 16) | VIDL_G(val);
1645+
dip_hit = data2 & DATADIPHIT_F;
1646+
} else {
1647+
vlan_vld = data2 & DATAVIDH2_F;
1648+
ivlan = VIDL_G(val);
1649+
}
1650+
port_num = DATAPORTNUM_G(data2);
15991651

16001652
/* Read tcamx. Change the control param */
16011653
ctl |= CTLXYBITSEL_V(1);
16021654
t4_write_reg(adap, MPS_CLS_TCAM_DATA2_CTL_A, ctl);
16031655
val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A);
16041656
tcamx = DMACH_G(val) << 32;
16051657
tcamx |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A);
1658+
data2 = t4_read_reg(adap, MPS_CLS_TCAM_DATA2_CTL_A);
1659+
if (lookup_type && (lookup_type != DATALKPTYPE_M)) {
1660+
/* Inner header VNI mask */
1661+
vnix = ((data2 & DATAVIDH2_F) << 23) |
1662+
(DATAVIDH1_G(data2) << 16) | VIDL_G(val);
1663+
}
16061664
} else {
16071665
tcamy = t4_read_reg64(adap, MPS_CLS_TCAM_Y_L(idx));
16081666
tcamx = t4_read_reg64(adap, MPS_CLS_TCAM_X_L(idx));
@@ -1662,17 +1720,47 @@ static int mps_tcam_show(struct seq_file *seq, void *v)
16621720
}
16631721

16641722
tcamxy2valmask(tcamx, tcamy, addr, &mask);
1665-
if (chip_ver > CHELSIO_T5)
1666-
seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x "
1667-
"%012llx%3c %#x%4u%4d",
1668-
idx, addr[0], addr[1], addr[2], addr[3],
1669-
addr[4], addr[5], (unsigned long long)mask,
1670-
(cls_lo & T6_SRAM_VLD_F) ? 'Y' : 'N',
1671-
PORTMAP_G(cls_hi),
1672-
T6_PF_G(cls_lo),
1673-
(cls_lo & T6_VF_VALID_F) ?
1674-
T6_VF_G(cls_lo) : -1);
1675-
else
1723+
if (chip_ver > CHELSIO_T5) {
1724+
/* Inner header lookup */
1725+
if (lookup_type && (lookup_type != DATALKPTYPE_M)) {
1726+
seq_printf(seq,
1727+
"%3u %02x:%02x:%02x:%02x:%02x:%02x "
1728+
"%012llx %06x %06x - - %3c"
1729+
" %3c %4x "
1730+
"%3c %#x%4u%4d", idx, addr[0],
1731+
addr[1], addr[2], addr[3],
1732+
addr[4], addr[5],
1733+
(unsigned long long)mask,
1734+
vniy, vnix, dip_hit ? 'Y' : 'N',
1735+
lookup_type ? 'I' : 'O', port_num,
1736+
(cls_lo & T6_SRAM_VLD_F) ? 'Y' : 'N',
1737+
PORTMAP_G(cls_hi),
1738+
T6_PF_G(cls_lo),
1739+
(cls_lo & T6_VF_VALID_F) ?
1740+
T6_VF_G(cls_lo) : -1);
1741+
} else {
1742+
seq_printf(seq,
1743+
"%3u %02x:%02x:%02x:%02x:%02x:%02x "
1744+
"%012llx - - ",
1745+
idx, addr[0], addr[1], addr[2],
1746+
addr[3], addr[4], addr[5],
1747+
(unsigned long long)mask);
1748+
1749+
if (vlan_vld)
1750+
seq_printf(seq, "%4u Y ", ivlan);
1751+
else
1752+
seq_puts(seq, " - N ");
1753+
1754+
seq_printf(seq,
1755+
"- %3c %4x %3c %#x%4u%4d",
1756+
lookup_type ? 'I' : 'O', port_num,
1757+
(cls_lo & T6_SRAM_VLD_F) ? 'Y' : 'N',
1758+
PORTMAP_G(cls_hi),
1759+
T6_PF_G(cls_lo),
1760+
(cls_lo & T6_VF_VALID_F) ?
1761+
T6_VF_G(cls_lo) : -1);
1762+
}
1763+
} else
16761764
seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x "
16771765
"%012llx%3c %#x%4u%4d",
16781766
idx, addr[0], addr[1], addr[2], addr[3],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ static int set_pauseparam(struct net_device *dev,
686686
if (epause->tx_pause)
687687
lc->requested_fc |= PAUSE_TX;
688688
if (netif_running(dev))
689-
return t4_link_l1cfg(p->adapter, p->adapter->pf, p->tx_chan,
689+
return t4_link_l1cfg(p->adapter, p->adapter->mbox, p->tx_chan,
690690
lc);
691691
return 0;
692692
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4855,8 +4855,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
48554855

48564856
/* configure SGE_STAT_CFG_A to read WC stats */
48574857
if (!is_t4(adapter->params.chip))
4858-
t4_write_reg(adapter, SGE_STAT_CFG_A,
4859-
STATSOURCE_T5_V(7) | STATMODE_V(0));
4858+
t4_write_reg(adapter, SGE_STAT_CFG_A, STATSOURCE_T5_V(7) |
4859+
(is_t5(adapter->params.chip) ? STATMODE_V(0) :
4860+
T6_STATMODE_V(0)));
48604861

48614862
for_each_port(adapter, i) {
48624863
struct net_device *netdev;

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

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,8 +2670,9 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
26702670
* simple (and hopefully less wrong).
26712671
*/
26722672
if (!is_t4(adap->params.chip) && cong >= 0) {
2673-
u32 param, val;
2673+
u32 param, val, ch_map = 0;
26742674
int i;
2675+
u16 cng_ch_bits_log = adap->params.arch.cng_ch_bits_log;
26752676

26762677
param = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DMAQ) |
26772678
FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DMAQ_CONM_CTXT) |
@@ -2683,9 +2684,9 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
26832684
CONMCTXT_CNGTPMODE_V(CONMCTXT_CNGTPMODE_CHANNEL_X);
26842685
for (i = 0; i < 4; i++) {
26852686
if (cong & (1 << i))
2686-
val |=
2687-
CONMCTXT_CNGCHMAP_V(1 << (i << 2));
2687+
ch_map |= 1 << (i << cng_ch_bits_log);
26882688
}
2689+
val |= CONMCTXT_CNGCHMAP_V(ch_map);
26892690
}
26902691
ret = t4_set_params(adap, adap->mbox, adap->pf, 0, 1,
26912692
&param, &val);
@@ -3173,8 +3174,7 @@ static int t4_sge_init_soft(struct adapter *adap)
31733174
int t4_sge_init(struct adapter *adap)
31743175
{
31753176
struct sge *s = &adap->sge;
3176-
u32 sge_control, sge_control2, sge_conm_ctrl;
3177-
unsigned int ingpadboundary, ingpackboundary;
3177+
u32 sge_control, sge_conm_ctrl;
31783178
int ret, egress_threshold;
31793179

31803180
/*
@@ -3185,35 +3185,7 @@ int t4_sge_init(struct adapter *adap)
31853185
s->pktshift = PKTSHIFT_G(sge_control);
31863186
s->stat_len = (sge_control & EGRSTATUSPAGESIZE_F) ? 128 : 64;
31873187

3188-
/* T4 uses a single control field to specify both the PCIe Padding and
3189-
* Packing Boundary. T5 introduced the ability to specify these
3190-
* separately. The actual Ingress Packet Data alignment boundary
3191-
* within Packed Buffer Mode is the maximum of these two
3192-
* specifications. (Note that it makes no real practical sense to
3193-
* have the Pading Boudary be larger than the Packing Boundary but you
3194-
* could set the chip up that way and, in fact, legacy T4 code would
3195-
* end doing this because it would initialize the Padding Boundary and
3196-
* leave the Packing Boundary initialized to 0 (16 bytes).)
3197-
*/
3198-
ingpadboundary = 1 << (INGPADBOUNDARY_G(sge_control) +
3199-
INGPADBOUNDARY_SHIFT_X);
3200-
if (is_t4(adap->params.chip)) {
3201-
s->fl_align = ingpadboundary;
3202-
} else {
3203-
/* T5 has a different interpretation of one of the PCIe Packing
3204-
* Boundary values.
3205-
*/
3206-
sge_control2 = t4_read_reg(adap, SGE_CONTROL2_A);
3207-
ingpackboundary = INGPACKBOUNDARY_G(sge_control2);
3208-
if (ingpackboundary == INGPACKBOUNDARY_16B_X)
3209-
ingpackboundary = 16;
3210-
else
3211-
ingpackboundary = 1 << (ingpackboundary +
3212-
INGPACKBOUNDARY_SHIFT_X);
3213-
3214-
s->fl_align = max(ingpadboundary, ingpackboundary);
3215-
}
3216-
3188+
s->fl_align = t4_fl_pkt_align(adap);
32173189
ret = t4_sge_init_soft(adap);
32183190
if (ret < 0)
32193191
return ret;
@@ -3231,10 +3203,21 @@ int t4_sge_init(struct adapter *adap)
32313203
* buffers.
32323204
*/
32333205
sge_conm_ctrl = t4_read_reg(adap, SGE_CONM_CTRL_A);
3234-
if (is_t4(adap->params.chip))
3206+
switch (CHELSIO_CHIP_VERSION(adap->params.chip)) {
3207+
case CHELSIO_T4:
32353208
egress_threshold = EGRTHRESHOLD_G(sge_conm_ctrl);
3236-
else
3209+
break;
3210+
case CHELSIO_T5:
32373211
egress_threshold = EGRTHRESHOLDPACKING_G(sge_conm_ctrl);
3212+
break;
3213+
case CHELSIO_T6:
3214+
egress_threshold = T6_EGRTHRESHOLDPACKING_G(sge_conm_ctrl);
3215+
break;
3216+
default:
3217+
dev_err(adap->pdev_dev, "Unsupported Chip version %d\n",
3218+
CHELSIO_CHIP_VERSION(adap->params.chip));
3219+
return -EINVAL;
3220+
}
32383221
s->fl_starve_thres = 2*egress_threshold + 1;
32393222

32403223
t4_idma_monitor_init(adap, &s->idma_monitor);

0 commit comments

Comments
 (0)