diff options
author | Thanneeru Srinivasulu <tsrinivasulu@caviumnetworks.com> | 2015-10-23 20:14:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-25 21:13:02 -0400 |
commit | 34411b68b132e403ddf395419e986475a9993d9b (patch) | |
tree | 7a9884f3554961cfadfbcf8fe6d44e6e649750c3 | |
parent | 88ed237720bd618240439714a57fb69ea96428e7 (diff) |
net: thunderx: Incorporate pass2 silicon CPI index configuration changes
Add support for ThunderX pass2 CPI and MPI configuration changes.
MPI_ALG is not enabled i.e MCAM parsing is disabled.
Signed-off-by: Thanneeru Srinivasulu <tsrinivasulu@caviumnetworks.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nic_main.c | 29 | ||||
-rw-r--r-- | drivers/net/ethernet/cavium/thunder/nic_reg.h | 4 |
2 files changed, 27 insertions, 6 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 52e1acb69562..c561fdcb79a7 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c | |||
@@ -43,6 +43,7 @@ struct nicpf { | |||
43 | u8 duplex[MAX_LMAC]; | 43 | u8 duplex[MAX_LMAC]; |
44 | u32 speed[MAX_LMAC]; | 44 | u32 speed[MAX_LMAC]; |
45 | u16 cpi_base[MAX_NUM_VFS_SUPPORTED]; | 45 | u16 cpi_base[MAX_NUM_VFS_SUPPORTED]; |
46 | u16 rssi_base[MAX_NUM_VFS_SUPPORTED]; | ||
46 | u16 rss_ind_tbl_size; | 47 | u16 rss_ind_tbl_size; |
47 | bool mbx_lock[MAX_NUM_VFS_SUPPORTED]; | 48 | bool mbx_lock[MAX_NUM_VFS_SUPPORTED]; |
48 | 49 | ||
@@ -396,8 +397,18 @@ static void nic_config_cpi(struct nicpf *nic, struct cpi_cfg_msg *cfg) | |||
396 | padd = cpi % 8; /* 3 bits CS out of 6bits DSCP */ | 397 | padd = cpi % 8; /* 3 bits CS out of 6bits DSCP */ |
397 | 398 | ||
398 | /* Leave RSS_SIZE as '0' to disable RSS */ | 399 | /* Leave RSS_SIZE as '0' to disable RSS */ |
399 | nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi << 3), | 400 | if (pass1_silicon(nic)) { |
400 | (vnic << 24) | (padd << 16) | (rssi_base + rssi)); | 401 | nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi << 3), |
402 | (vnic << 24) | (padd << 16) | | ||
403 | (rssi_base + rssi)); | ||
404 | } else { | ||
405 | /* Set MPI_ALG to '0' to disable MCAM parsing */ | ||
406 | nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi << 3), | ||
407 | (padd << 16)); | ||
408 | /* MPI index is same as CPI if MPI_ALG is not enabled */ | ||
409 | nic_reg_write(nic, NIC_PF_MPI_0_2047_CFG | (cpi << 3), | ||
410 | (vnic << 24) | (rssi_base + rssi)); | ||
411 | } | ||
401 | 412 | ||
402 | if ((rssi + 1) >= cfg->rq_cnt) | 413 | if ((rssi + 1) >= cfg->rq_cnt) |
403 | continue; | 414 | continue; |
@@ -410,6 +421,7 @@ static void nic_config_cpi(struct nicpf *nic, struct cpi_cfg_msg *cfg) | |||
410 | rssi = ((cpi - cpi_base) & 0x38) >> 3; | 421 | rssi = ((cpi - cpi_base) & 0x38) >> 3; |
411 | } | 422 | } |
412 | nic->cpi_base[cfg->vf_id] = cpi_base; | 423 | nic->cpi_base[cfg->vf_id] = cpi_base; |
424 | nic->rssi_base[cfg->vf_id] = rssi_base; | ||
413 | } | 425 | } |
414 | 426 | ||
415 | /* Responsds to VF with its RSS indirection table size */ | 427 | /* Responsds to VF with its RSS indirection table size */ |
@@ -435,10 +447,9 @@ static void nic_config_rss(struct nicpf *nic, struct rss_cfg_msg *cfg) | |||
435 | { | 447 | { |
436 | u8 qset, idx = 0; | 448 | u8 qset, idx = 0; |
437 | u64 cpi_cfg, cpi_base, rssi_base, rssi; | 449 | u64 cpi_cfg, cpi_base, rssi_base, rssi; |
450 | u64 idx_addr; | ||
438 | 451 | ||
439 | cpi_base = nic->cpi_base[cfg->vf_id]; | 452 | rssi_base = nic->rssi_base[cfg->vf_id] + cfg->tbl_offset; |
440 | cpi_cfg = nic_reg_read(nic, NIC_PF_CPI_0_2047_CFG | (cpi_base << 3)); | ||
441 | rssi_base = (cpi_cfg & 0x0FFF) + cfg->tbl_offset; | ||
442 | 453 | ||
443 | rssi = rssi_base; | 454 | rssi = rssi_base; |
444 | qset = cfg->vf_id; | 455 | qset = cfg->vf_id; |
@@ -455,9 +466,15 @@ static void nic_config_rss(struct nicpf *nic, struct rss_cfg_msg *cfg) | |||
455 | idx++; | 466 | idx++; |
456 | } | 467 | } |
457 | 468 | ||
469 | cpi_base = nic->cpi_base[cfg->vf_id]; | ||
470 | if (pass1_silicon(nic)) | ||
471 | idx_addr = NIC_PF_CPI_0_2047_CFG; | ||
472 | else | ||
473 | idx_addr = NIC_PF_MPI_0_2047_CFG; | ||
474 | cpi_cfg = nic_reg_read(nic, idx_addr | (cpi_base << 3)); | ||
458 | cpi_cfg &= ~(0xFULL << 20); | 475 | cpi_cfg &= ~(0xFULL << 20); |
459 | cpi_cfg |= (cfg->hash_bits << 20); | 476 | cpi_cfg |= (cfg->hash_bits << 20); |
460 | nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi_base << 3), cpi_cfg); | 477 | nic_reg_write(nic, idx_addr | (cpi_base << 3), cpi_cfg); |
461 | } | 478 | } |
462 | 479 | ||
463 | /* 4 level transmit side scheduler configutation | 480 | /* 4 level transmit side scheduler configutation |
diff --git a/drivers/net/ethernet/cavium/thunder/nic_reg.h b/drivers/net/ethernet/cavium/thunder/nic_reg.h index 58197bb2f805..dd536be20193 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_reg.h +++ b/drivers/net/ethernet/cavium/thunder/nic_reg.h | |||
@@ -85,7 +85,11 @@ | |||
85 | #define NIC_PF_ECC3_DBE_INT_W1S (0x2708) | 85 | #define NIC_PF_ECC3_DBE_INT_W1S (0x2708) |
86 | #define NIC_PF_ECC3_DBE_ENA_W1C (0x2710) | 86 | #define NIC_PF_ECC3_DBE_ENA_W1C (0x2710) |
87 | #define NIC_PF_ECC3_DBE_ENA_W1S (0x2718) | 87 | #define NIC_PF_ECC3_DBE_ENA_W1S (0x2718) |
88 | #define NIC_PF_MCAM_0_191_ENA (0x100000) | ||
89 | #define NIC_PF_MCAM_0_191_M_0_5_DATA (0x110000) | ||
90 | #define NIC_PF_MCAM_CTRL (0x120000) | ||
88 | #define NIC_PF_CPI_0_2047_CFG (0x200000) | 91 | #define NIC_PF_CPI_0_2047_CFG (0x200000) |
92 | #define NIC_PF_MPI_0_2047_CFG (0x210000) | ||
89 | #define NIC_PF_RSSI_0_4097_RQ (0x220000) | 93 | #define NIC_PF_RSSI_0_4097_RQ (0x220000) |
90 | #define NIC_PF_LMAC_0_7_CFG (0x240000) | 94 | #define NIC_PF_LMAC_0_7_CFG (0x240000) |
91 | #define NIC_PF_LMAC_0_7_SW_XOFF (0x242000) | 95 | #define NIC_PF_LMAC_0_7_SW_XOFF (0x242000) |