cxgb4: Update mps_tcam output to include T6 fields

In T6, MPS classification has a 512 deep TCAM to do the match lookup.
Each entry has 80x2b sets containing 48 bit MAC address, port number,
VLAN Valid/ID, VNI, lookup type (outer or inner packet header).
[71:48] bit locations are overloaded for outer vs. inner lookup types.

Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Hariprasad Shenai 2015-12-23 22:47:17 +05:30 committed by David S. Miller
parent 6df397539c
commit 115b56af88
2 changed files with 105 additions and 19 deletions

View File

@ -1585,25 +1585,35 @@ static int mps_tcam_show(struct seq_file *seq, void *v)
{ {
struct adapter *adap = seq->private; struct adapter *adap = seq->private;
unsigned int chip_ver = CHELSIO_CHIP_VERSION(adap->params.chip); unsigned int chip_ver = CHELSIO_CHIP_VERSION(adap->params.chip);
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
if (adap->params.arch.mps_rplc_size > 128) if (chip_ver > CHELSIO_T5) {
seq_puts(seq, "Idx Ethernet address Mask " seq_puts(seq, "Idx Ethernet address Mask "
" VNI Mask IVLAN Vld "
"DIP_Hit Lookup Port "
"Vld Ports PF VF " "Vld Ports PF VF "
"Replication " "Replication "
" P0 P1 P2 P3 ML\n"); " P0 P1 P2 P3 ML\n");
else } else {
seq_puts(seq, "Idx Ethernet address Mask " if (adap->params.arch.mps_rplc_size > 128)
"Vld Ports PF VF Replication" seq_puts(seq, "Idx Ethernet address Mask "
" P0 P1 P2 P3 ML\n"); "Vld Ports PF VF "
"Replication "
" P0 P1 P2 P3 ML\n");
else
seq_puts(seq, "Idx Ethernet address Mask "
"Vld Ports PF VF Replication"
" P0 P1 P2 P3 ML\n");
}
} else { } else {
u64 mask; u64 mask;
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
bool replicate; bool replicate, dip_hit = false, vlan_vld = false;
unsigned int idx = (uintptr_t)v - 2; unsigned int idx = (uintptr_t)v - 2;
u64 tcamy, tcamx, val; u64 tcamy, tcamx, val;
u32 cls_lo, cls_hi, ctl; u32 cls_lo, cls_hi, ctl, data2, vnix = 0, vniy = 0;
u32 rplc[8] = {0}; u32 rplc[8] = {0};
u8 lookup_type = 0, port_num = 0;
u16 ivlan = 0;
if (chip_ver > CHELSIO_T5) { if (chip_ver > CHELSIO_T5) {
/* CtlCmdType - 0: Read, 1: Write /* CtlCmdType - 0: Read, 1: Write
@ -1622,6 +1632,22 @@ static int mps_tcam_show(struct seq_file *seq, void *v)
val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A); val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A);
tcamy = DMACH_G(val) << 32; tcamy = DMACH_G(val) << 32;
tcamy |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A); tcamy |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A);
data2 = t4_read_reg(adap, MPS_CLS_TCAM_DATA2_CTL_A);
lookup_type = DATALKPTYPE_G(data2);
/* 0 - Outer header, 1 - Inner header
* [71:48] bit locations are overloaded for
* outer vs. inner lookup types.
*/
if (lookup_type && (lookup_type != DATALKPTYPE_M)) {
/* Inner header VNI */
vniy = ((data2 & DATAVIDH2_F) << 23) |
(DATAVIDH1_G(data2) << 16) | VIDL_G(val);
dip_hit = data2 & DATADIPHIT_F;
} else {
vlan_vld = data2 & DATAVIDH2_F;
ivlan = VIDL_G(val);
}
port_num = DATAPORTNUM_G(data2);
/* Read tcamx. Change the control param */ /* Read tcamx. Change the control param */
ctl |= CTLXYBITSEL_V(1); ctl |= CTLXYBITSEL_V(1);
@ -1629,6 +1655,12 @@ static int mps_tcam_show(struct seq_file *seq, void *v)
val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A); val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A);
tcamx = DMACH_G(val) << 32; tcamx = DMACH_G(val) << 32;
tcamx |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A); tcamx |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A);
data2 = t4_read_reg(adap, MPS_CLS_TCAM_DATA2_CTL_A);
if (lookup_type && (lookup_type != DATALKPTYPE_M)) {
/* Inner header VNI mask */
vnix = ((data2 & DATAVIDH2_F) << 23) |
(DATAVIDH1_G(data2) << 16) | VIDL_G(val);
}
} else { } else {
tcamy = t4_read_reg64(adap, MPS_CLS_TCAM_Y_L(idx)); tcamy = t4_read_reg64(adap, MPS_CLS_TCAM_Y_L(idx));
tcamx = t4_read_reg64(adap, MPS_CLS_TCAM_X_L(idx)); tcamx = t4_read_reg64(adap, MPS_CLS_TCAM_X_L(idx));
@ -1688,17 +1720,47 @@ static int mps_tcam_show(struct seq_file *seq, void *v)
} }
tcamxy2valmask(tcamx, tcamy, addr, &mask); tcamxy2valmask(tcamx, tcamy, addr, &mask);
if (chip_ver > CHELSIO_T5) if (chip_ver > CHELSIO_T5) {
seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x " /* Inner header lookup */
"%012llx%3c %#x%4u%4d", if (lookup_type && (lookup_type != DATALKPTYPE_M)) {
idx, addr[0], addr[1], addr[2], addr[3], seq_printf(seq,
addr[4], addr[5], (unsigned long long)mask, "%3u %02x:%02x:%02x:%02x:%02x:%02x "
(cls_lo & T6_SRAM_VLD_F) ? 'Y' : 'N', "%012llx %06x %06x - - %3c"
PORTMAP_G(cls_hi), " %3c %4x "
T6_PF_G(cls_lo), "%3c %#x%4u%4d", idx, addr[0],
(cls_lo & T6_VF_VALID_F) ? addr[1], addr[2], addr[3],
T6_VF_G(cls_lo) : -1); addr[4], addr[5],
else (unsigned long long)mask,
vniy, vnix, dip_hit ? 'Y' : 'N',
lookup_type ? 'I' : 'O', port_num,
(cls_lo & T6_SRAM_VLD_F) ? 'Y' : 'N',
PORTMAP_G(cls_hi),
T6_PF_G(cls_lo),
(cls_lo & T6_VF_VALID_F) ?
T6_VF_G(cls_lo) : -1);
} else {
seq_printf(seq,
"%3u %02x:%02x:%02x:%02x:%02x:%02x "
"%012llx - - ",
idx, addr[0], addr[1], addr[2],
addr[3], addr[4], addr[5],
(unsigned long long)mask);
if (vlan_vld)
seq_printf(seq, "%4u Y ", ivlan);
else
seq_puts(seq, " - N ");
seq_printf(seq,
"- %3c %4x %3c %#x%4u%4d",
lookup_type ? 'I' : 'O', port_num,
(cls_lo & T6_SRAM_VLD_F) ? 'Y' : 'N',
PORTMAP_G(cls_hi),
T6_PF_G(cls_lo),
(cls_lo & T6_VF_VALID_F) ?
T6_VF_G(cls_lo) : -1);
}
} else
seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x " seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x "
"%012llx%3c %#x%4u%4d", "%012llx%3c %#x%4u%4d",
idx, addr[0], addr[1], addr[2], addr[3], idx, addr[0], addr[1], addr[2], addr[3],

View File

@ -2398,6 +2398,30 @@
#define MPS_CLS_TCAM_DATA0_A 0xf000 #define MPS_CLS_TCAM_DATA0_A 0xf000
#define MPS_CLS_TCAM_DATA1_A 0xf004 #define MPS_CLS_TCAM_DATA1_A 0xf004
#define VIDL_S 16
#define VIDL_M 0xffffU
#define VIDL_G(x) (((x) >> VIDL_S) & VIDL_M)
#define DATALKPTYPE_S 10
#define DATALKPTYPE_M 0x3U
#define DATALKPTYPE_G(x) (((x) >> DATALKPTYPE_S) & DATALKPTYPE_M)
#define DATAPORTNUM_S 12
#define DATAPORTNUM_M 0xfU
#define DATAPORTNUM_G(x) (((x) >> DATAPORTNUM_S) & DATAPORTNUM_M)
#define DATADIPHIT_S 8
#define DATADIPHIT_V(x) ((x) << DATADIPHIT_S)
#define DATADIPHIT_F DATADIPHIT_V(1U)
#define DATAVIDH2_S 7
#define DATAVIDH2_V(x) ((x) << DATAVIDH2_S)
#define DATAVIDH2_F DATAVIDH2_V(1U)
#define DATAVIDH1_S 0
#define DATAVIDH1_M 0x7fU
#define DATAVIDH1_G(x) (((x) >> DATAVIDH1_S) & DATAVIDH1_M)
#define USED_S 16 #define USED_S 16
#define USED_M 0x7ffU #define USED_M 0x7ffU
#define USED_G(x) (((x) >> USED_S) & USED_M) #define USED_G(x) (((x) >> USED_S) & USED_M)