diff options
author | Divy Le Ray <divy@chelsio.com> | 2007-03-31 03:23:19 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-03 22:31:09 -0400 |
commit | 8ac3ba68e25a73594646ec30b7c482b364644c92 (patch) | |
tree | 1c15afe834f8f86f8a6c0a2c5da217de4afb6664 | |
parent | 9f238486f5438b2e44f760b11fa3a08714c1ddb6 (diff) |
cxgb3 - detect NIC only adapters
Differentiate NIC only adapters from RNICs.
Initialize offload capabilities for RNICs only.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/cxgb3/common.h | 6 | ||||
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 8 | ||||
-rw-r--r-- | drivers/net/cxgb3/mc5.c | 3 | ||||
-rw-r--r-- | drivers/net/cxgb3/sge.c | 2 | ||||
-rw-r--r-- | drivers/net/cxgb3/t3_hw.c | 24 |
5 files changed, 29 insertions, 14 deletions
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h index 38a0565ad1c1..97128d88eaef 100644 --- a/drivers/net/cxgb3/common.h +++ b/drivers/net/cxgb3/common.h | |||
@@ -112,8 +112,7 @@ enum { | |||
112 | }; | 112 | }; |
113 | 113 | ||
114 | enum { | 114 | enum { |
115 | SUPPORTED_OFFLOAD = 1 << 24, | 115 | SUPPORTED_IRQ = 1 << 24 |
116 | SUPPORTED_IRQ = 1 << 25 | ||
117 | }; | 116 | }; |
118 | 117 | ||
119 | enum { /* adapter interrupt-maintained statistics */ | 118 | enum { /* adapter interrupt-maintained statistics */ |
@@ -405,6 +404,7 @@ struct adapter_params { | |||
405 | unsigned int stats_update_period; /* MAC stats accumulation period */ | 404 | unsigned int stats_update_period; /* MAC stats accumulation period */ |
406 | unsigned int linkpoll_period; /* link poll period in 0.1s */ | 405 | unsigned int linkpoll_period; /* link poll period in 0.1s */ |
407 | unsigned int rev; /* chip revision */ | 406 | unsigned int rev; /* chip revision */ |
407 | unsigned int offload; | ||
408 | }; | 408 | }; |
409 | 409 | ||
410 | enum { /* chip revisions */ | 410 | enum { /* chip revisions */ |
@@ -605,7 +605,7 @@ static inline int is_10G(const struct adapter *adap) | |||
605 | 605 | ||
606 | static inline int is_offload(const struct adapter *adap) | 606 | static inline int is_offload(const struct adapter *adap) |
607 | { | 607 | { |
608 | return adapter_info(adap)->caps & SUPPORTED_OFFLOAD; | 608 | return adap->params.offload; |
609 | } | 609 | } |
610 | 610 | ||
611 | static inline unsigned int core_ticks_per_usec(const struct adapter *adap) | 611 | static inline unsigned int core_ticks_per_usec(const struct adapter *adap) |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index b82544e08689..145b67cc1d2e 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -407,7 +407,7 @@ static void quiesce_rx(struct adapter *adap) | |||
407 | static int setup_sge_qsets(struct adapter *adap) | 407 | static int setup_sge_qsets(struct adapter *adap) |
408 | { | 408 | { |
409 | int i, j, err, irq_idx = 0, qset_idx = 0, dummy_dev_idx = 0; | 409 | int i, j, err, irq_idx = 0, qset_idx = 0, dummy_dev_idx = 0; |
410 | unsigned int ntxq = is_offload(adap) ? SGE_TXQ_PER_SET : 1; | 410 | unsigned int ntxq = SGE_TXQ_PER_SET; |
411 | 411 | ||
412 | if (adap->params.rev > 0 && !(adap->flags & USING_MSI)) | 412 | if (adap->params.rev > 0 && !(adap->flags & USING_MSI)) |
413 | irq_idx = -1; | 413 | irq_idx = -1; |
@@ -922,7 +922,7 @@ static int cxgb_open(struct net_device *dev) | |||
922 | return err; | 922 | return err; |
923 | 923 | ||
924 | set_bit(pi->port_id, &adapter->open_device_map); | 924 | set_bit(pi->port_id, &adapter->open_device_map); |
925 | if (!ofld_disable) { | 925 | if (is_offload(adapter) && !ofld_disable) { |
926 | err = offload_open(dev); | 926 | err = offload_open(dev); |
927 | if (err) | 927 | if (err) |
928 | printk(KERN_WARNING | 928 | printk(KERN_WARNING |
@@ -2270,9 +2270,9 @@ static void __devinit print_port_info(struct adapter *adap, | |||
2270 | 2270 | ||
2271 | if (!test_bit(i, &adap->registered_device_map)) | 2271 | if (!test_bit(i, &adap->registered_device_map)) |
2272 | continue; | 2272 | continue; |
2273 | printk(KERN_INFO "%s: %s %s RNIC (rev %d) %s%s\n", | 2273 | printk(KERN_INFO "%s: %s %s %sNIC (rev %d) %s%s\n", |
2274 | dev->name, ai->desc, pi->port_type->desc, | 2274 | dev->name, ai->desc, pi->port_type->desc, |
2275 | adap->params.rev, buf, | 2275 | is_offload(adap) ? "R" : "", adap->params.rev, buf, |
2276 | (adap->flags & USING_MSIX) ? " MSI-X" : | 2276 | (adap->flags & USING_MSIX) ? " MSI-X" : |
2277 | (adap->flags & USING_MSI) ? " MSI" : ""); | 2277 | (adap->flags & USING_MSI) ? " MSI" : ""); |
2278 | if (adap->name == dev->name && adap->params.vpd.mclk) | 2278 | if (adap->name == dev->name && adap->params.vpd.mclk) |
diff --git a/drivers/net/cxgb3/mc5.c b/drivers/net/cxgb3/mc5.c index 644d62ea86a6..84c1ffa8e2d3 100644 --- a/drivers/net/cxgb3/mc5.c +++ b/drivers/net/cxgb3/mc5.c | |||
@@ -328,6 +328,9 @@ int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, | |||
328 | unsigned int tcam_size = mc5->tcam_size; | 328 | unsigned int tcam_size = mc5->tcam_size; |
329 | struct adapter *adap = mc5->adapter; | 329 | struct adapter *adap = mc5->adapter; |
330 | 330 | ||
331 | if (!tcam_size) | ||
332 | return 0; | ||
333 | |||
331 | if (nroutes > MAX_ROUTES || nroutes + nservers + nfilters > tcam_size) | 334 | if (nroutes > MAX_ROUTES || nroutes + nservers + nfilters > tcam_size) |
332 | return -EINVAL; | 335 | return -EINVAL; |
333 | 336 | ||
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index c23783432e51..027ab2c3825c 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -2631,7 +2631,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, | |||
2631 | q->txq[TXQ_ETH].stop_thres = nports * | 2631 | q->txq[TXQ_ETH].stop_thres = nports * |
2632 | flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3); | 2632 | flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3); |
2633 | 2633 | ||
2634 | if (ntxq == 1) { | 2634 | if (!is_offload(adapter)) { |
2635 | #ifdef USE_RX_PAGE | 2635 | #ifdef USE_RX_PAGE |
2636 | q->fl[0].buf_size = RX_PAGE_SIZE; | 2636 | q->fl[0].buf_size = RX_PAGE_SIZE; |
2637 | #else | 2637 | #else |
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index 791ed6dc1943..d83f075ef2d7 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
@@ -438,23 +438,23 @@ static const struct adapter_info t3_adap_info[] = { | |||
438 | {2, 0, 0, 0, | 438 | {2, 0, 0, 0, |
439 | F_GPIO2_OEN | F_GPIO4_OEN | | 439 | F_GPIO2_OEN | F_GPIO4_OEN | |
440 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, | 440 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, |
441 | SUPPORTED_OFFLOAD, | 441 | 0, |
442 | &mi1_mdio_ops, "Chelsio PE9000"}, | 442 | &mi1_mdio_ops, "Chelsio PE9000"}, |
443 | {2, 0, 0, 0, | 443 | {2, 0, 0, 0, |
444 | F_GPIO2_OEN | F_GPIO4_OEN | | 444 | F_GPIO2_OEN | F_GPIO4_OEN | |
445 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, | 445 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, |
446 | SUPPORTED_OFFLOAD, | 446 | 0, |
447 | &mi1_mdio_ops, "Chelsio T302"}, | 447 | &mi1_mdio_ops, "Chelsio T302"}, |
448 | {1, 0, 0, 0, | 448 | {1, 0, 0, 0, |
449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | | 449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | |
450 | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, | 450 | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, |
451 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, | 451 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
452 | &mi1_mdio_ext_ops, "Chelsio T310"}, | 452 | &mi1_mdio_ext_ops, "Chelsio T310"}, |
453 | {2, 0, 0, 0, | 453 | {2, 0, 0, 0, |
454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | | 454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | |
455 | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | | 455 | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | |
456 | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, | 456 | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, |
457 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, | 457 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
458 | &mi1_mdio_ext_ops, "Chelsio T320"}, | 458 | &mi1_mdio_ext_ops, "Chelsio T320"}, |
459 | }; | 459 | }; |
460 | 460 | ||
@@ -2900,6 +2900,9 @@ static int mc7_init(struct mc7 *mc7, unsigned int mc7_clock, int mem_type) | |||
2900 | struct adapter *adapter = mc7->adapter; | 2900 | struct adapter *adapter = mc7->adapter; |
2901 | const struct mc7_timing_params *p = &mc7_timings[mem_type]; | 2901 | const struct mc7_timing_params *p = &mc7_timings[mem_type]; |
2902 | 2902 | ||
2903 | if (!mc7->size) | ||
2904 | return 0; | ||
2905 | |||
2903 | val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); | 2906 | val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); |
2904 | slow = val & F_SLOW; | 2907 | slow = val & F_SLOW; |
2905 | width = G_WIDTH(val); | 2908 | width = G_WIDTH(val); |
@@ -3100,8 +3103,10 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params) | |||
3100 | do { /* wait for uP to initialize */ | 3103 | do { /* wait for uP to initialize */ |
3101 | msleep(20); | 3104 | msleep(20); |
3102 | } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts); | 3105 | } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts); |
3103 | if (!attempts) | 3106 | if (!attempts) { |
3107 | CH_ERR(adapter, "uP initialization timed out\n"); | ||
3104 | goto out_err; | 3108 | goto out_err; |
3109 | } | ||
3105 | 3110 | ||
3106 | err = 0; | 3111 | err = 0; |
3107 | out_err: | 3112 | out_err: |
@@ -3201,7 +3206,7 @@ static void __devinit mc7_prep(struct adapter *adapter, struct mc7 *mc7, | |||
3201 | mc7->name = name; | 3206 | mc7->name = name; |
3202 | mc7->offset = base_addr - MC7_PMRX_BASE_ADDR; | 3207 | mc7->offset = base_addr - MC7_PMRX_BASE_ADDR; |
3203 | cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); | 3208 | cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); |
3204 | mc7->size = mc7_calc_size(cfg); | 3209 | mc7->size = mc7->size = G_DEN(cfg) == M_DEN ? 0 : mc7_calc_size(cfg); |
3205 | mc7->width = G_WIDTH(cfg); | 3210 | mc7->width = G_WIDTH(cfg); |
3206 | } | 3211 | } |
3207 | 3212 | ||
@@ -3228,6 +3233,7 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai) | |||
3228 | V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1)); | 3233 | V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1)); |
3229 | t3_write_reg(adapter, A_T3DBG_GPIO_EN, | 3234 | t3_write_reg(adapter, A_T3DBG_GPIO_EN, |
3230 | ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL); | 3235 | ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL); |
3236 | t3_write_reg(adapter, A_MC5_DB_SERVER_INDEX, 0); | ||
3231 | 3237 | ||
3232 | if (adapter->params.rev == 0 || !uses_xaui(adapter)) | 3238 | if (adapter->params.rev == 0 || !uses_xaui(adapter)) |
3233 | val |= F_ENRGMII; | 3239 | val |= F_ENRGMII; |
@@ -3326,7 +3332,13 @@ int __devinit t3_prep_adapter(struct adapter *adapter, | |||
3326 | p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size); | 3332 | p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size); |
3327 | p->ntimer_qs = p->cm_size >= (128 << 20) || | 3333 | p->ntimer_qs = p->cm_size >= (128 << 20) || |
3328 | adapter->params.rev > 0 ? 12 : 6; | 3334 | adapter->params.rev > 0 ? 12 : 6; |
3335 | } | ||
3336 | |||
3337 | adapter->params.offload = t3_mc7_size(&adapter->pmrx) && | ||
3338 | t3_mc7_size(&adapter->pmtx) && | ||
3339 | t3_mc7_size(&adapter->cm); | ||
3329 | 3340 | ||
3341 | if (is_offload(adapter)) { | ||
3330 | adapter->params.mc5.nservers = DEFAULT_NSERVERS; | 3342 | adapter->params.mc5.nservers = DEFAULT_NSERVERS; |
3331 | adapter->params.mc5.nfilters = adapter->params.rev > 0 ? | 3343 | adapter->params.mc5.nfilters = adapter->params.rev > 0 ? |
3332 | DEFAULT_NFILTERS : 0; | 3344 | DEFAULT_NFILTERS : 0; |