diff options
author | Hariprasad Shenai <hariprasad@chelsio.com> | 2013-12-03 06:35:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-03 16:55:40 -0500 |
commit | d14807dd8e7eaa41a8fee5fc3acbdaf2a0258b76 (patch) | |
tree | 069fd7c30e44064cb7235ab35bb3d25a84445ce0 /drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |
parent | 1b85ee09aac2f32f24b8db72eb152089b92ace87 (diff) |
cxgb4: Much cleaner implementation of is_t4()/is_t5()
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 8b929eeecd2d..35933cd18e0f 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -1083,7 +1083,7 @@ static int upgrade_fw(struct adapter *adap) | |||
1083 | struct device *dev = adap->pdev_dev; | 1083 | struct device *dev = adap->pdev_dev; |
1084 | char *fw_file_name; | 1084 | char *fw_file_name; |
1085 | 1085 | ||
1086 | switch (CHELSIO_CHIP_VERSION(adap->chip)) { | 1086 | switch (CHELSIO_CHIP_VERSION(adap->params.chip)) { |
1087 | case CHELSIO_T4: | 1087 | case CHELSIO_T4: |
1088 | fw_file_name = FW_FNAME; | 1088 | fw_file_name = FW_FNAME; |
1089 | exp_major = FW_VERSION_MAJOR; | 1089 | exp_major = FW_VERSION_MAJOR; |
@@ -1093,7 +1093,7 @@ static int upgrade_fw(struct adapter *adap) | |||
1093 | exp_major = FW_VERSION_MAJOR_T5; | 1093 | exp_major = FW_VERSION_MAJOR_T5; |
1094 | break; | 1094 | break; |
1095 | default: | 1095 | default: |
1096 | dev_err(dev, "Unsupported chip type, %x\n", adap->chip); | 1096 | dev_err(dev, "Unsupported chip type, %x\n", adap->params.chip); |
1097 | return -EINVAL; | 1097 | return -EINVAL; |
1098 | } | 1098 | } |
1099 | 1099 | ||
@@ -1415,7 +1415,7 @@ static int get_sset_count(struct net_device *dev, int sset) | |||
1415 | static int get_regs_len(struct net_device *dev) | 1415 | static int get_regs_len(struct net_device *dev) |
1416 | { | 1416 | { |
1417 | struct adapter *adap = netdev2adap(dev); | 1417 | struct adapter *adap = netdev2adap(dev); |
1418 | if (is_t4(adap->chip)) | 1418 | if (is_t4(adap->params.chip)) |
1419 | return T4_REGMAP_SIZE; | 1419 | return T4_REGMAP_SIZE; |
1420 | else | 1420 | else |
1421 | return T5_REGMAP_SIZE; | 1421 | return T5_REGMAP_SIZE; |
@@ -1499,7 +1499,7 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, | |||
1499 | data += sizeof(struct port_stats) / sizeof(u64); | 1499 | data += sizeof(struct port_stats) / sizeof(u64); |
1500 | collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data); | 1500 | collect_sge_port_stats(adapter, pi, (struct queue_port_stats *)data); |
1501 | data += sizeof(struct queue_port_stats) / sizeof(u64); | 1501 | data += sizeof(struct queue_port_stats) / sizeof(u64); |
1502 | if (!is_t4(adapter->chip)) { | 1502 | if (!is_t4(adapter->params.chip)) { |
1503 | t4_write_reg(adapter, SGE_STAT_CFG, STATSOURCE_T5(7)); | 1503 | t4_write_reg(adapter, SGE_STAT_CFG, STATSOURCE_T5(7)); |
1504 | val1 = t4_read_reg(adapter, SGE_STAT_TOTAL); | 1504 | val1 = t4_read_reg(adapter, SGE_STAT_TOTAL); |
1505 | val2 = t4_read_reg(adapter, SGE_STAT_MATCH); | 1505 | val2 = t4_read_reg(adapter, SGE_STAT_MATCH); |
@@ -1521,8 +1521,8 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, | |||
1521 | */ | 1521 | */ |
1522 | static inline unsigned int mk_adap_vers(const struct adapter *ap) | 1522 | static inline unsigned int mk_adap_vers(const struct adapter *ap) |
1523 | { | 1523 | { |
1524 | return CHELSIO_CHIP_VERSION(ap->chip) | | 1524 | return CHELSIO_CHIP_VERSION(ap->params.chip) | |
1525 | (CHELSIO_CHIP_RELEASE(ap->chip) << 10) | (1 << 16); | 1525 | (CHELSIO_CHIP_RELEASE(ap->params.chip) << 10) | (1 << 16); |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | static void reg_block_dump(struct adapter *ap, void *buf, unsigned int start, | 1528 | static void reg_block_dump(struct adapter *ap, void *buf, unsigned int start, |
@@ -2189,7 +2189,7 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
2189 | static const unsigned int *reg_ranges; | 2189 | static const unsigned int *reg_ranges; |
2190 | int arr_size = 0, buf_size = 0; | 2190 | int arr_size = 0, buf_size = 0; |
2191 | 2191 | ||
2192 | if (is_t4(ap->chip)) { | 2192 | if (is_t4(ap->params.chip)) { |
2193 | reg_ranges = &t4_reg_ranges[0]; | 2193 | reg_ranges = &t4_reg_ranges[0]; |
2194 | arr_size = ARRAY_SIZE(t4_reg_ranges); | 2194 | arr_size = ARRAY_SIZE(t4_reg_ranges); |
2195 | buf_size = T4_REGMAP_SIZE; | 2195 | buf_size = T4_REGMAP_SIZE; |
@@ -2967,7 +2967,7 @@ static int setup_debugfs(struct adapter *adap) | |||
2967 | size = t4_read_reg(adap, MA_EDRAM1_BAR); | 2967 | size = t4_read_reg(adap, MA_EDRAM1_BAR); |
2968 | add_debugfs_mem(adap, "edc1", MEM_EDC1, EDRAM_SIZE_GET(size)); | 2968 | add_debugfs_mem(adap, "edc1", MEM_EDC1, EDRAM_SIZE_GET(size)); |
2969 | } | 2969 | } |
2970 | if (is_t4(adap->chip)) { | 2970 | if (is_t4(adap->params.chip)) { |
2971 | size = t4_read_reg(adap, MA_EXT_MEMORY_BAR); | 2971 | size = t4_read_reg(adap, MA_EXT_MEMORY_BAR); |
2972 | if (i & EXT_MEM_ENABLE) | 2972 | if (i & EXT_MEM_ENABLE) |
2973 | add_debugfs_mem(adap, "mc", MEM_MC, | 2973 | add_debugfs_mem(adap, "mc", MEM_MC, |
@@ -3419,7 +3419,7 @@ unsigned int cxgb4_dbfifo_count(const struct net_device *dev, int lpfifo) | |||
3419 | 3419 | ||
3420 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); | 3420 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); |
3421 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); | 3421 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); |
3422 | if (is_t4(adap->chip)) { | 3422 | if (is_t4(adap->params.chip)) { |
3423 | lp_count = G_LP_COUNT(v1); | 3423 | lp_count = G_LP_COUNT(v1); |
3424 | hp_count = G_HP_COUNT(v1); | 3424 | hp_count = G_HP_COUNT(v1); |
3425 | } else { | 3425 | } else { |
@@ -3588,7 +3588,7 @@ static void drain_db_fifo(struct adapter *adap, int usecs) | |||
3588 | do { | 3588 | do { |
3589 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); | 3589 | v1 = t4_read_reg(adap, A_SGE_DBFIFO_STATUS); |
3590 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); | 3590 | v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2); |
3591 | if (is_t4(adap->chip)) { | 3591 | if (is_t4(adap->params.chip)) { |
3592 | lp_count = G_LP_COUNT(v1); | 3592 | lp_count = G_LP_COUNT(v1); |
3593 | hp_count = G_HP_COUNT(v1); | 3593 | hp_count = G_HP_COUNT(v1); |
3594 | } else { | 3594 | } else { |
@@ -3708,7 +3708,7 @@ static void process_db_drop(struct work_struct *work) | |||
3708 | 3708 | ||
3709 | adap = container_of(work, struct adapter, db_drop_task); | 3709 | adap = container_of(work, struct adapter, db_drop_task); |
3710 | 3710 | ||
3711 | if (is_t4(adap->chip)) { | 3711 | if (is_t4(adap->params.chip)) { |
3712 | disable_dbs(adap); | 3712 | disable_dbs(adap); |
3713 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_DROP); | 3713 | notify_rdma_uld(adap, CXGB4_CONTROL_DB_DROP); |
3714 | drain_db_fifo(adap, 1); | 3714 | drain_db_fifo(adap, 1); |
@@ -3753,7 +3753,7 @@ static void process_db_drop(struct work_struct *work) | |||
3753 | 3753 | ||
3754 | void t4_db_full(struct adapter *adap) | 3754 | void t4_db_full(struct adapter *adap) |
3755 | { | 3755 | { |
3756 | if (is_t4(adap->chip)) { | 3756 | if (is_t4(adap->params.chip)) { |
3757 | t4_set_reg_field(adap, SGE_INT_ENABLE3, | 3757 | t4_set_reg_field(adap, SGE_INT_ENABLE3, |
3758 | DBFIFO_HP_INT | DBFIFO_LP_INT, 0); | 3758 | DBFIFO_HP_INT | DBFIFO_LP_INT, 0); |
3759 | queue_work(workq, &adap->db_full_task); | 3759 | queue_work(workq, &adap->db_full_task); |
@@ -3762,7 +3762,7 @@ void t4_db_full(struct adapter *adap) | |||
3762 | 3762 | ||
3763 | void t4_db_dropped(struct adapter *adap) | 3763 | void t4_db_dropped(struct adapter *adap) |
3764 | { | 3764 | { |
3765 | if (is_t4(adap->chip)) | 3765 | if (is_t4(adap->params.chip)) |
3766 | queue_work(workq, &adap->db_drop_task); | 3766 | queue_work(workq, &adap->db_drop_task); |
3767 | } | 3767 | } |
3768 | 3768 | ||
@@ -3789,7 +3789,7 @@ static void uld_attach(struct adapter *adap, unsigned int uld) | |||
3789 | lli.nchan = adap->params.nports; | 3789 | lli.nchan = adap->params.nports; |
3790 | lli.nports = adap->params.nports; | 3790 | lli.nports = adap->params.nports; |
3791 | lli.wr_cred = adap->params.ofldq_wr_cred; | 3791 | lli.wr_cred = adap->params.ofldq_wr_cred; |
3792 | lli.adapter_type = adap->params.rev; | 3792 | lli.adapter_type = adap->params.chip; |
3793 | lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2)); | 3793 | lli.iscsi_iolen = MAXRXDATA_GET(t4_read_reg(adap, TP_PARA_REG2)); |
3794 | lli.udb_density = 1 << QUEUESPERPAGEPF0_GET( | 3794 | lli.udb_density = 1 << QUEUESPERPAGEPF0_GET( |
3795 | t4_read_reg(adap, SGE_EGRESS_QUEUES_PER_PAGE_PF) >> | 3795 | t4_read_reg(adap, SGE_EGRESS_QUEUES_PER_PAGE_PF) >> |
@@ -4483,7 +4483,7 @@ static void setup_memwin(struct adapter *adap) | |||
4483 | u32 bar0, mem_win0_base, mem_win1_base, mem_win2_base; | 4483 | u32 bar0, mem_win0_base, mem_win1_base, mem_win2_base; |
4484 | 4484 | ||
4485 | bar0 = pci_resource_start(adap->pdev, 0); /* truncation intentional */ | 4485 | bar0 = pci_resource_start(adap->pdev, 0); /* truncation intentional */ |
4486 | if (is_t4(adap->chip)) { | 4486 | if (is_t4(adap->params.chip)) { |
4487 | mem_win0_base = bar0 + MEMWIN0_BASE; | 4487 | mem_win0_base = bar0 + MEMWIN0_BASE; |
4488 | mem_win1_base = bar0 + MEMWIN1_BASE; | 4488 | mem_win1_base = bar0 + MEMWIN1_BASE; |
4489 | mem_win2_base = bar0 + MEMWIN2_BASE; | 4489 | mem_win2_base = bar0 + MEMWIN2_BASE; |
@@ -4686,7 +4686,7 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
4686 | * then use that. Otherwise, use the configuration file stored | 4686 | * then use that. Otherwise, use the configuration file stored |
4687 | * in the adapter flash ... | 4687 | * in the adapter flash ... |
4688 | */ | 4688 | */ |
4689 | switch (CHELSIO_CHIP_VERSION(adapter->chip)) { | 4689 | switch (CHELSIO_CHIP_VERSION(adapter->params.chip)) { |
4690 | case CHELSIO_T4: | 4690 | case CHELSIO_T4: |
4691 | fw_config_file = FW_CFNAME; | 4691 | fw_config_file = FW_CFNAME; |
4692 | break; | 4692 | break; |
@@ -5787,7 +5787,7 @@ static void print_port_info(const struct net_device *dev) | |||
5787 | 5787 | ||
5788 | netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n", | 5788 | netdev_info(dev, "Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n", |
5789 | adap->params.vpd.id, | 5789 | adap->params.vpd.id, |
5790 | CHELSIO_CHIP_RELEASE(adap->params.rev), buf, | 5790 | CHELSIO_CHIP_RELEASE(adap->params.chip), buf, |
5791 | is_offload(adap) ? "R" : "", adap->params.pci.width, spd, | 5791 | is_offload(adap) ? "R" : "", adap->params.pci.width, spd, |
5792 | (adap->flags & USING_MSIX) ? " MSI-X" : | 5792 | (adap->flags & USING_MSIX) ? " MSI-X" : |
5793 | (adap->flags & USING_MSI) ? " MSI" : ""); | 5793 | (adap->flags & USING_MSI) ? " MSI" : ""); |
@@ -5910,7 +5910,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
5910 | if (err) | 5910 | if (err) |
5911 | goto out_unmap_bar0; | 5911 | goto out_unmap_bar0; |
5912 | 5912 | ||
5913 | if (!is_t4(adapter->chip)) { | 5913 | if (!is_t4(adapter->params.chip)) { |
5914 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; | 5914 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; |
5915 | qpp = 1 << QUEUESPERPAGEPF0_GET(t4_read_reg(adapter, | 5915 | qpp = 1 << QUEUESPERPAGEPF0_GET(t4_read_reg(adapter, |
5916 | SGE_EGRESS_QUEUES_PER_PAGE_PF) >> s_qpp); | 5916 | SGE_EGRESS_QUEUES_PER_PAGE_PF) >> s_qpp); |
@@ -6064,7 +6064,7 @@ sriov: | |||
6064 | out_free_dev: | 6064 | out_free_dev: |
6065 | free_some_resources(adapter); | 6065 | free_some_resources(adapter); |
6066 | out_unmap_bar: | 6066 | out_unmap_bar: |
6067 | if (!is_t4(adapter->chip)) | 6067 | if (!is_t4(adapter->params.chip)) |
6068 | iounmap(adapter->bar2); | 6068 | iounmap(adapter->bar2); |
6069 | out_unmap_bar0: | 6069 | out_unmap_bar0: |
6070 | iounmap(adapter->regs); | 6070 | iounmap(adapter->regs); |
@@ -6116,7 +6116,7 @@ static void remove_one(struct pci_dev *pdev) | |||
6116 | 6116 | ||
6117 | free_some_resources(adapter); | 6117 | free_some_resources(adapter); |
6118 | iounmap(adapter->regs); | 6118 | iounmap(adapter->regs); |
6119 | if (!is_t4(adapter->chip)) | 6119 | if (!is_t4(adapter->params.chip)) |
6120 | iounmap(adapter->bar2); | 6120 | iounmap(adapter->bar2); |
6121 | kfree(adapter); | 6121 | kfree(adapter); |
6122 | pci_disable_pcie_error_reporting(pdev); | 6122 | pci_disable_pcie_error_reporting(pdev); |