diff options
Diffstat (limited to 'drivers/net/ethernet/chelsio')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 137 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/sge.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 55 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 39 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | 6 |
10 files changed, 226 insertions, 63 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index 97842d03675b..c6ff4890d171 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
@@ -376,8 +376,6 @@ enum { | |||
376 | enum { | 376 | enum { |
377 | INGQ_EXTRAS = 2, /* firmware event queue and */ | 377 | INGQ_EXTRAS = 2, /* firmware event queue and */ |
378 | /* forwarded interrupts */ | 378 | /* forwarded interrupts */ |
379 | MAX_EGRQ = MAX_ETH_QSETS*2 + MAX_OFLD_QSETS*2 | ||
380 | + MAX_CTRL_QUEUES + MAX_RDMA_QUEUES + MAX_ISCSI_QUEUES, | ||
381 | MAX_INGQ = MAX_ETH_QSETS + MAX_OFLD_QSETS + MAX_RDMA_QUEUES | 379 | MAX_INGQ = MAX_ETH_QSETS + MAX_OFLD_QSETS + MAX_RDMA_QUEUES |
382 | + MAX_RDMA_CIQS + MAX_ISCSI_QUEUES + INGQ_EXTRAS, | 380 | + MAX_RDMA_CIQS + MAX_ISCSI_QUEUES + INGQ_EXTRAS, |
383 | }; | 381 | }; |
@@ -616,11 +614,13 @@ struct sge { | |||
616 | unsigned int idma_qid[2]; /* SGE IDMA Hung Ingress Queue ID */ | 614 | unsigned int idma_qid[2]; /* SGE IDMA Hung Ingress Queue ID */ |
617 | 615 | ||
618 | unsigned int egr_start; | 616 | unsigned int egr_start; |
617 | unsigned int egr_sz; | ||
619 | unsigned int ingr_start; | 618 | unsigned int ingr_start; |
620 | void *egr_map[MAX_EGRQ]; /* qid->queue egress queue map */ | 619 | unsigned int ingr_sz; |
621 | struct sge_rspq *ingr_map[MAX_INGQ]; /* qid->queue ingress queue map */ | 620 | void **egr_map; /* qid->queue egress queue map */ |
622 | DECLARE_BITMAP(starving_fl, MAX_EGRQ); | 621 | struct sge_rspq **ingr_map; /* qid->queue ingress queue map */ |
623 | DECLARE_BITMAP(txq_maperr, MAX_EGRQ); | 622 | unsigned long *starving_fl; |
623 | unsigned long *txq_maperr; | ||
624 | struct timer_list rx_timer; /* refills starving FLs */ | 624 | struct timer_list rx_timer; /* refills starving FLs */ |
625 | struct timer_list tx_timer; /* checks Tx queues */ | 625 | struct timer_list tx_timer; /* checks Tx queues */ |
626 | }; | 626 | }; |
@@ -1136,6 +1136,8 @@ int cxgb4_t4_bar2_sge_qregs(struct adapter *adapter, | |||
1136 | 1136 | ||
1137 | unsigned int qtimer_val(const struct adapter *adap, | 1137 | unsigned int qtimer_val(const struct adapter *adap, |
1138 | const struct sge_rspq *q); | 1138 | const struct sge_rspq *q); |
1139 | |||
1140 | int t4_init_devlog_params(struct adapter *adapter); | ||
1139 | int t4_init_sge_params(struct adapter *adapter); | 1141 | int t4_init_sge_params(struct adapter *adapter); |
1140 | int t4_init_tp_params(struct adapter *adap); | 1142 | int t4_init_tp_params(struct adapter *adap); |
1141 | int t4_filter_field_shift(const struct adapter *adap, int filter_sel); | 1143 | int t4_filter_field_shift(const struct adapter *adap, int filter_sel); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index 78854ceb0870..dcb047945290 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | |||
@@ -670,9 +670,13 @@ static int cctrl_tbl_show(struct seq_file *seq, void *v) | |||
670 | "0.9375" }; | 670 | "0.9375" }; |
671 | 671 | ||
672 | int i; | 672 | int i; |
673 | u16 incr[NMTUS][NCCTRL_WIN]; | 673 | u16 (*incr)[NCCTRL_WIN]; |
674 | struct adapter *adap = seq->private; | 674 | struct adapter *adap = seq->private; |
675 | 675 | ||
676 | incr = kmalloc(sizeof(*incr) * NMTUS, GFP_KERNEL); | ||
677 | if (!incr) | ||
678 | return -ENOMEM; | ||
679 | |||
676 | t4_read_cong_tbl(adap, incr); | 680 | t4_read_cong_tbl(adap, incr); |
677 | 681 | ||
678 | for (i = 0; i < NCCTRL_WIN; ++i) { | 682 | for (i = 0; i < NCCTRL_WIN; ++i) { |
@@ -685,6 +689,8 @@ static int cctrl_tbl_show(struct seq_file *seq, void *v) | |||
685 | adap->params.a_wnd[i], | 689 | adap->params.a_wnd[i], |
686 | dec_fac[adap->params.b_wnd[i]]); | 690 | dec_fac[adap->params.b_wnd[i]]); |
687 | } | 691 | } |
692 | |||
693 | kfree(incr); | ||
688 | return 0; | 694 | return 0; |
689 | } | 695 | } |
690 | 696 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index a22cf932ca35..d92995138f7e 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -920,7 +920,7 @@ static void quiesce_rx(struct adapter *adap) | |||
920 | { | 920 | { |
921 | int i; | 921 | int i; |
922 | 922 | ||
923 | for (i = 0; i < ARRAY_SIZE(adap->sge.ingr_map); i++) { | 923 | for (i = 0; i < adap->sge.ingr_sz; i++) { |
924 | struct sge_rspq *q = adap->sge.ingr_map[i]; | 924 | struct sge_rspq *q = adap->sge.ingr_map[i]; |
925 | 925 | ||
926 | if (q && q->handler) { | 926 | if (q && q->handler) { |
@@ -934,6 +934,21 @@ static void quiesce_rx(struct adapter *adap) | |||
934 | } | 934 | } |
935 | } | 935 | } |
936 | 936 | ||
937 | /* Disable interrupt and napi handler */ | ||
938 | static void disable_interrupts(struct adapter *adap) | ||
939 | { | ||
940 | if (adap->flags & FULL_INIT_DONE) { | ||
941 | t4_intr_disable(adap); | ||
942 | if (adap->flags & USING_MSIX) { | ||
943 | free_msix_queue_irqs(adap); | ||
944 | free_irq(adap->msix_info[0].vec, adap); | ||
945 | } else { | ||
946 | free_irq(adap->pdev->irq, adap); | ||
947 | } | ||
948 | quiesce_rx(adap); | ||
949 | } | ||
950 | } | ||
951 | |||
937 | /* | 952 | /* |
938 | * Enable NAPI scheduling and interrupt generation for all Rx queues. | 953 | * Enable NAPI scheduling and interrupt generation for all Rx queues. |
939 | */ | 954 | */ |
@@ -941,7 +956,7 @@ static void enable_rx(struct adapter *adap) | |||
941 | { | 956 | { |
942 | int i; | 957 | int i; |
943 | 958 | ||
944 | for (i = 0; i < ARRAY_SIZE(adap->sge.ingr_map); i++) { | 959 | for (i = 0; i < adap->sge.ingr_sz; i++) { |
945 | struct sge_rspq *q = adap->sge.ingr_map[i]; | 960 | struct sge_rspq *q = adap->sge.ingr_map[i]; |
946 | 961 | ||
947 | if (!q) | 962 | if (!q) |
@@ -970,8 +985,8 @@ static int setup_sge_queues(struct adapter *adap) | |||
970 | int err, msi_idx, i, j; | 985 | int err, msi_idx, i, j; |
971 | struct sge *s = &adap->sge; | 986 | struct sge *s = &adap->sge; |
972 | 987 | ||
973 | bitmap_zero(s->starving_fl, MAX_EGRQ); | 988 | bitmap_zero(s->starving_fl, s->egr_sz); |
974 | bitmap_zero(s->txq_maperr, MAX_EGRQ); | 989 | bitmap_zero(s->txq_maperr, s->egr_sz); |
975 | 990 | ||
976 | if (adap->flags & USING_MSIX) | 991 | if (adap->flags & USING_MSIX) |
977 | msi_idx = 1; /* vector 0 is for non-queue interrupts */ | 992 | msi_idx = 1; /* vector 0 is for non-queue interrupts */ |
@@ -983,6 +998,19 @@ static int setup_sge_queues(struct adapter *adap) | |||
983 | msi_idx = -((int)s->intrq.abs_id + 1); | 998 | msi_idx = -((int)s->intrq.abs_id + 1); |
984 | } | 999 | } |
985 | 1000 | ||
1001 | /* NOTE: If you add/delete any Ingress/Egress Queue allocations in here, | ||
1002 | * don't forget to update the following which need to be | ||
1003 | * synchronized to and changes here. | ||
1004 | * | ||
1005 | * 1. The calculations of MAX_INGQ in cxgb4.h. | ||
1006 | * | ||
1007 | * 2. Update enable_msix/name_msix_vecs/request_msix_queue_irqs | ||
1008 | * to accommodate any new/deleted Ingress Queues | ||
1009 | * which need MSI-X Vectors. | ||
1010 | * | ||
1011 | * 3. Update sge_qinfo_show() to include information on the | ||
1012 | * new/deleted queues. | ||
1013 | */ | ||
986 | err = t4_sge_alloc_rxq(adap, &s->fw_evtq, true, adap->port[0], | 1014 | err = t4_sge_alloc_rxq(adap, &s->fw_evtq, true, adap->port[0], |
987 | msi_idx, NULL, fwevtq_handler); | 1015 | msi_idx, NULL, fwevtq_handler); |
988 | if (err) { | 1016 | if (err) { |
@@ -4244,19 +4272,12 @@ static int cxgb_up(struct adapter *adap) | |||
4244 | 4272 | ||
4245 | static void cxgb_down(struct adapter *adapter) | 4273 | static void cxgb_down(struct adapter *adapter) |
4246 | { | 4274 | { |
4247 | t4_intr_disable(adapter); | ||
4248 | cancel_work_sync(&adapter->tid_release_task); | 4275 | cancel_work_sync(&adapter->tid_release_task); |
4249 | cancel_work_sync(&adapter->db_full_task); | 4276 | cancel_work_sync(&adapter->db_full_task); |
4250 | cancel_work_sync(&adapter->db_drop_task); | 4277 | cancel_work_sync(&adapter->db_drop_task); |
4251 | adapter->tid_release_task_busy = false; | 4278 | adapter->tid_release_task_busy = false; |
4252 | adapter->tid_release_head = NULL; | 4279 | adapter->tid_release_head = NULL; |
4253 | 4280 | ||
4254 | if (adapter->flags & USING_MSIX) { | ||
4255 | free_msix_queue_irqs(adapter); | ||
4256 | free_irq(adapter->msix_info[0].vec, adapter); | ||
4257 | } else | ||
4258 | free_irq(adapter->pdev->irq, adapter); | ||
4259 | quiesce_rx(adapter); | ||
4260 | t4_sge_stop(adapter); | 4281 | t4_sge_stop(adapter); |
4261 | t4_free_sge_resources(adapter); | 4282 | t4_free_sge_resources(adapter); |
4262 | adapter->flags &= ~FULL_INIT_DONE; | 4283 | adapter->flags &= ~FULL_INIT_DONE; |
@@ -4733,8 +4754,9 @@ static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) | |||
4733 | if (ret < 0) | 4754 | if (ret < 0) |
4734 | return ret; | 4755 | return ret; |
4735 | 4756 | ||
4736 | ret = t4_cfg_pfvf(adap, adap->fn, adap->fn, 0, MAX_EGRQ, 64, MAX_INGQ, | 4757 | ret = t4_cfg_pfvf(adap, adap->fn, adap->fn, 0, adap->sge.egr_sz, 64, |
4737 | 0, 0, 4, 0xf, 0xf, 16, FW_CMD_CAP_PF, FW_CMD_CAP_PF); | 4758 | MAX_INGQ, 0, 0, 4, 0xf, 0xf, 16, FW_CMD_CAP_PF, |
4759 | FW_CMD_CAP_PF); | ||
4738 | if (ret < 0) | 4760 | if (ret < 0) |
4739 | return ret; | 4761 | return ret; |
4740 | 4762 | ||
@@ -5088,10 +5110,15 @@ static int adap_init0(struct adapter *adap) | |||
5088 | enum dev_state state; | 5110 | enum dev_state state; |
5089 | u32 params[7], val[7]; | 5111 | u32 params[7], val[7]; |
5090 | struct fw_caps_config_cmd caps_cmd; | 5112 | struct fw_caps_config_cmd caps_cmd; |
5091 | struct fw_devlog_cmd devlog_cmd; | ||
5092 | u32 devlog_meminfo; | ||
5093 | int reset = 1; | 5113 | int reset = 1; |
5094 | 5114 | ||
5115 | /* Grab Firmware Device Log parameters as early as possible so we have | ||
5116 | * access to it for debugging, etc. | ||
5117 | */ | ||
5118 | ret = t4_init_devlog_params(adap); | ||
5119 | if (ret < 0) | ||
5120 | return ret; | ||
5121 | |||
5095 | /* Contact FW, advertising Master capability */ | 5122 | /* Contact FW, advertising Master capability */ |
5096 | ret = t4_fw_hello(adap, adap->mbox, adap->mbox, MASTER_MAY, &state); | 5123 | ret = t4_fw_hello(adap, adap->mbox, adap->mbox, MASTER_MAY, &state); |
5097 | if (ret < 0) { | 5124 | if (ret < 0) { |
@@ -5169,30 +5196,6 @@ static int adap_init0(struct adapter *adap) | |||
5169 | if (ret < 0) | 5196 | if (ret < 0) |
5170 | goto bye; | 5197 | goto bye; |
5171 | 5198 | ||
5172 | /* Read firmware device log parameters. We really need to find a way | ||
5173 | * to get these parameters initialized with some default values (which | ||
5174 | * are likely to be correct) for the case where we either don't | ||
5175 | * attache to the firmware or it's crashed when we probe the adapter. | ||
5176 | * That way we'll still be able to perform early firmware startup | ||
5177 | * debugging ... If the request to get the Firmware's Device Log | ||
5178 | * parameters fails, we'll live so we don't make that a fatal error. | ||
5179 | */ | ||
5180 | memset(&devlog_cmd, 0, sizeof(devlog_cmd)); | ||
5181 | devlog_cmd.op_to_write = htonl(FW_CMD_OP_V(FW_DEVLOG_CMD) | | ||
5182 | FW_CMD_REQUEST_F | FW_CMD_READ_F); | ||
5183 | devlog_cmd.retval_len16 = htonl(FW_LEN16(devlog_cmd)); | ||
5184 | ret = t4_wr_mbox(adap, adap->mbox, &devlog_cmd, sizeof(devlog_cmd), | ||
5185 | &devlog_cmd); | ||
5186 | if (ret == 0) { | ||
5187 | devlog_meminfo = | ||
5188 | ntohl(devlog_cmd.memtype_devlog_memaddr16_devlog); | ||
5189 | adap->params.devlog.memtype = | ||
5190 | FW_DEVLOG_CMD_MEMTYPE_DEVLOG_G(devlog_meminfo); | ||
5191 | adap->params.devlog.start = | ||
5192 | FW_DEVLOG_CMD_MEMADDR16_DEVLOG_G(devlog_meminfo) << 4; | ||
5193 | adap->params.devlog.size = ntohl(devlog_cmd.memsize_devlog); | ||
5194 | } | ||
5195 | |||
5196 | /* | 5199 | /* |
5197 | * Find out what ports are available to us. Note that we need to do | 5200 | * Find out what ports are available to us. Note that we need to do |
5198 | * this before calling adap_init0_no_config() since it needs nports | 5201 | * this before calling adap_init0_no_config() since it needs nports |
@@ -5293,6 +5296,51 @@ static int adap_init0(struct adapter *adap) | |||
5293 | adap->tids.nftids = val[4] - val[3] + 1; | 5296 | adap->tids.nftids = val[4] - val[3] + 1; |
5294 | adap->sge.ingr_start = val[5]; | 5297 | adap->sge.ingr_start = val[5]; |
5295 | 5298 | ||
5299 | /* qids (ingress/egress) returned from firmware can be anywhere | ||
5300 | * in the range from EQ(IQFLINT)_START to EQ(IQFLINT)_END. | ||
5301 | * Hence driver needs to allocate memory for this range to | ||
5302 | * store the queue info. Get the highest IQFLINT/EQ index returned | ||
5303 | * in FW_EQ_*_CMD.alloc command. | ||
5304 | */ | ||
5305 | params[0] = FW_PARAM_PFVF(EQ_END); | ||
5306 | params[1] = FW_PARAM_PFVF(IQFLINT_END); | ||
5307 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, params, val); | ||
5308 | if (ret < 0) | ||
5309 | goto bye; | ||
5310 | adap->sge.egr_sz = val[0] - adap->sge.egr_start + 1; | ||
5311 | adap->sge.ingr_sz = val[1] - adap->sge.ingr_start + 1; | ||
5312 | |||
5313 | adap->sge.egr_map = kcalloc(adap->sge.egr_sz, | ||
5314 | sizeof(*adap->sge.egr_map), GFP_KERNEL); | ||
5315 | if (!adap->sge.egr_map) { | ||
5316 | ret = -ENOMEM; | ||
5317 | goto bye; | ||
5318 | } | ||
5319 | |||
5320 | adap->sge.ingr_map = kcalloc(adap->sge.ingr_sz, | ||
5321 | sizeof(*adap->sge.ingr_map), GFP_KERNEL); | ||
5322 | if (!adap->sge.ingr_map) { | ||
5323 | ret = -ENOMEM; | ||
5324 | goto bye; | ||
5325 | } | ||
5326 | |||
5327 | /* Allocate the memory for the vaious egress queue bitmaps | ||
5328 | * ie starving_fl and txq_maperr. | ||
5329 | */ | ||
5330 | adap->sge.starving_fl = kcalloc(BITS_TO_LONGS(adap->sge.egr_sz), | ||
5331 | sizeof(long), GFP_KERNEL); | ||
5332 | if (!adap->sge.starving_fl) { | ||
5333 | ret = -ENOMEM; | ||
5334 | goto bye; | ||
5335 | } | ||
5336 | |||
5337 | adap->sge.txq_maperr = kcalloc(BITS_TO_LONGS(adap->sge.egr_sz), | ||
5338 | sizeof(long), GFP_KERNEL); | ||
5339 | if (!adap->sge.txq_maperr) { | ||
5340 | ret = -ENOMEM; | ||
5341 | goto bye; | ||
5342 | } | ||
5343 | |||
5296 | params[0] = FW_PARAM_PFVF(CLIP_START); | 5344 | params[0] = FW_PARAM_PFVF(CLIP_START); |
5297 | params[1] = FW_PARAM_PFVF(CLIP_END); | 5345 | params[1] = FW_PARAM_PFVF(CLIP_END); |
5298 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, params, val); | 5346 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, params, val); |
@@ -5501,6 +5549,10 @@ static int adap_init0(struct adapter *adap) | |||
5501 | * happened to HW/FW, stop issuing commands. | 5549 | * happened to HW/FW, stop issuing commands. |
5502 | */ | 5550 | */ |
5503 | bye: | 5551 | bye: |
5552 | kfree(adap->sge.egr_map); | ||
5553 | kfree(adap->sge.ingr_map); | ||
5554 | kfree(adap->sge.starving_fl); | ||
5555 | kfree(adap->sge.txq_maperr); | ||
5504 | if (ret != -ETIMEDOUT && ret != -EIO) | 5556 | if (ret != -ETIMEDOUT && ret != -EIO) |
5505 | t4_fw_bye(adap, adap->mbox); | 5557 | t4_fw_bye(adap, adap->mbox); |
5506 | return ret; | 5558 | return ret; |
@@ -5528,6 +5580,7 @@ static pci_ers_result_t eeh_err_detected(struct pci_dev *pdev, | |||
5528 | netif_carrier_off(dev); | 5580 | netif_carrier_off(dev); |
5529 | } | 5581 | } |
5530 | spin_unlock(&adap->stats_lock); | 5582 | spin_unlock(&adap->stats_lock); |
5583 | disable_interrupts(adap); | ||
5531 | if (adap->flags & FULL_INIT_DONE) | 5584 | if (adap->flags & FULL_INIT_DONE) |
5532 | cxgb_down(adap); | 5585 | cxgb_down(adap); |
5533 | rtnl_unlock(); | 5586 | rtnl_unlock(); |
@@ -5912,6 +5965,10 @@ static void free_some_resources(struct adapter *adapter) | |||
5912 | 5965 | ||
5913 | t4_free_mem(adapter->l2t); | 5966 | t4_free_mem(adapter->l2t); |
5914 | t4_free_mem(adapter->tids.tid_tab); | 5967 | t4_free_mem(adapter->tids.tid_tab); |
5968 | kfree(adapter->sge.egr_map); | ||
5969 | kfree(adapter->sge.ingr_map); | ||
5970 | kfree(adapter->sge.starving_fl); | ||
5971 | kfree(adapter->sge.txq_maperr); | ||
5915 | disable_msi(adapter); | 5972 | disable_msi(adapter); |
5916 | 5973 | ||
5917 | for_each_port(adapter, i) | 5974 | for_each_port(adapter, i) |
@@ -6237,6 +6294,8 @@ static void remove_one(struct pci_dev *pdev) | |||
6237 | if (is_offload(adapter)) | 6294 | if (is_offload(adapter)) |
6238 | detach_ulds(adapter); | 6295 | detach_ulds(adapter); |
6239 | 6296 | ||
6297 | disable_interrupts(adapter); | ||
6298 | |||
6240 | for_each_port(adapter, i) | 6299 | for_each_port(adapter, i) |
6241 | if (adapter->port[i]->reg_state == NETREG_REGISTERED) | 6300 | if (adapter->port[i]->reg_state == NETREG_REGISTERED) |
6242 | unregister_netdev(adapter->port[i]); | 6301 | unregister_netdev(adapter->port[i]); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index b4b9f6048fe7..b688b32c21fe 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c | |||
@@ -2171,7 +2171,7 @@ static void sge_rx_timer_cb(unsigned long data) | |||
2171 | struct adapter *adap = (struct adapter *)data; | 2171 | struct adapter *adap = (struct adapter *)data; |
2172 | struct sge *s = &adap->sge; | 2172 | struct sge *s = &adap->sge; |
2173 | 2173 | ||
2174 | for (i = 0; i < ARRAY_SIZE(s->starving_fl); i++) | 2174 | for (i = 0; i < BITS_TO_LONGS(s->egr_sz); i++) |
2175 | for (m = s->starving_fl[i]; m; m &= m - 1) { | 2175 | for (m = s->starving_fl[i]; m; m &= m - 1) { |
2176 | struct sge_eth_rxq *rxq; | 2176 | struct sge_eth_rxq *rxq; |
2177 | unsigned int id = __ffs(m) + i * BITS_PER_LONG; | 2177 | unsigned int id = __ffs(m) + i * BITS_PER_LONG; |
@@ -2259,7 +2259,7 @@ static void sge_tx_timer_cb(unsigned long data) | |||
2259 | struct adapter *adap = (struct adapter *)data; | 2259 | struct adapter *adap = (struct adapter *)data; |
2260 | struct sge *s = &adap->sge; | 2260 | struct sge *s = &adap->sge; |
2261 | 2261 | ||
2262 | for (i = 0; i < ARRAY_SIZE(s->txq_maperr); i++) | 2262 | for (i = 0; i < BITS_TO_LONGS(s->egr_sz); i++) |
2263 | for (m = s->txq_maperr[i]; m; m &= m - 1) { | 2263 | for (m = s->txq_maperr[i]; m; m &= m - 1) { |
2264 | unsigned long id = __ffs(m) + i * BITS_PER_LONG; | 2264 | unsigned long id = __ffs(m) + i * BITS_PER_LONG; |
2265 | struct sge_ofld_txq *txq = s->egr_map[id]; | 2265 | struct sge_ofld_txq *txq = s->egr_map[id]; |
@@ -2741,7 +2741,8 @@ void t4_free_sge_resources(struct adapter *adap) | |||
2741 | free_rspq_fl(adap, &adap->sge.intrq, NULL); | 2741 | free_rspq_fl(adap, &adap->sge.intrq, NULL); |
2742 | 2742 | ||
2743 | /* clear the reverse egress queue map */ | 2743 | /* clear the reverse egress queue map */ |
2744 | memset(adap->sge.egr_map, 0, sizeof(adap->sge.egr_map)); | 2744 | memset(adap->sge.egr_map, 0, |
2745 | adap->sge.egr_sz * sizeof(*adap->sge.egr_map)); | ||
2745 | } | 2746 | } |
2746 | 2747 | ||
2747 | void t4_sge_start(struct adapter *adap) | 2748 | void t4_sge_start(struct adapter *adap) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 853c38997c82..ee394dc68303 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -1120,7 +1120,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, | |||
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | /* Installed successfully, update the cached header too. */ | 1122 | /* Installed successfully, update the cached header too. */ |
1123 | memcpy(card_fw, fs_fw, sizeof(*card_fw)); | 1123 | *card_fw = *fs_fw; |
1124 | card_fw_usable = 1; | 1124 | card_fw_usable = 1; |
1125 | *reset = 0; /* already reset as part of load_fw */ | 1125 | *reset = 0; /* already reset as part of load_fw */ |
1126 | } | 1126 | } |
@@ -4459,6 +4459,59 @@ int cxgb4_t4_bar2_sge_qregs(struct adapter *adapter, | |||
4459 | } | 4459 | } |
4460 | 4460 | ||
4461 | /** | 4461 | /** |
4462 | * t4_init_devlog_params - initialize adapter->params.devlog | ||
4463 | * @adap: the adapter | ||
4464 | * | ||
4465 | * Initialize various fields of the adapter's Firmware Device Log | ||
4466 | * Parameters structure. | ||
4467 | */ | ||
4468 | int t4_init_devlog_params(struct adapter *adap) | ||
4469 | { | ||
4470 | struct devlog_params *dparams = &adap->params.devlog; | ||
4471 | u32 pf_dparams; | ||
4472 | unsigned int devlog_meminfo; | ||
4473 | struct fw_devlog_cmd devlog_cmd; | ||
4474 | int ret; | ||
4475 | |||
4476 | /* If we're dealing with newer firmware, the Device Log Paramerters | ||
4477 | * are stored in a designated register which allows us to access the | ||
4478 | * Device Log even if we can't talk to the firmware. | ||
4479 | */ | ||
4480 | pf_dparams = | ||
4481 | t4_read_reg(adap, PCIE_FW_REG(PCIE_FW_PF_A, PCIE_FW_PF_DEVLOG)); | ||
4482 | if (pf_dparams) { | ||
4483 | unsigned int nentries, nentries128; | ||
4484 | |||
4485 | dparams->memtype = PCIE_FW_PF_DEVLOG_MEMTYPE_G(pf_dparams); | ||
4486 | dparams->start = PCIE_FW_PF_DEVLOG_ADDR16_G(pf_dparams) << 4; | ||
4487 | |||
4488 | nentries128 = PCIE_FW_PF_DEVLOG_NENTRIES128_G(pf_dparams); | ||
4489 | nentries = (nentries128 + 1) * 128; | ||
4490 | dparams->size = nentries * sizeof(struct fw_devlog_e); | ||
4491 | |||
4492 | return 0; | ||
4493 | } | ||
4494 | |||
4495 | /* Otherwise, ask the firmware for it's Device Log Parameters. | ||
4496 | */ | ||
4497 | memset(&devlog_cmd, 0, sizeof(devlog_cmd)); | ||
4498 | devlog_cmd.op_to_write = htonl(FW_CMD_OP_V(FW_DEVLOG_CMD) | | ||
4499 | FW_CMD_REQUEST_F | FW_CMD_READ_F); | ||
4500 | devlog_cmd.retval_len16 = htonl(FW_LEN16(devlog_cmd)); | ||
4501 | ret = t4_wr_mbox(adap, adap->mbox, &devlog_cmd, sizeof(devlog_cmd), | ||
4502 | &devlog_cmd); | ||
4503 | if (ret) | ||
4504 | return ret; | ||
4505 | |||
4506 | devlog_meminfo = ntohl(devlog_cmd.memtype_devlog_memaddr16_devlog); | ||
4507 | dparams->memtype = FW_DEVLOG_CMD_MEMTYPE_DEVLOG_G(devlog_meminfo); | ||
4508 | dparams->start = FW_DEVLOG_CMD_MEMADDR16_DEVLOG_G(devlog_meminfo) << 4; | ||
4509 | dparams->size = ntohl(devlog_cmd.memsize_devlog); | ||
4510 | |||
4511 | return 0; | ||
4512 | } | ||
4513 | |||
4514 | /** | ||
4462 | * t4_init_sge_params - initialize adap->params.sge | 4515 | * t4_init_sge_params - initialize adap->params.sge |
4463 | * @adapter: the adapter | 4516 | * @adapter: the adapter |
4464 | * | 4517 | * |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h index 231a725f6d5d..326674b19983 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | |||
@@ -63,6 +63,8 @@ | |||
63 | #define MC_BIST_STATUS_REG(reg_addr, idx) ((reg_addr) + (idx) * 4) | 63 | #define MC_BIST_STATUS_REG(reg_addr, idx) ((reg_addr) + (idx) * 4) |
64 | #define EDC_BIST_STATUS_REG(reg_addr, idx) ((reg_addr) + (idx) * 4) | 64 | #define EDC_BIST_STATUS_REG(reg_addr, idx) ((reg_addr) + (idx) * 4) |
65 | 65 | ||
66 | #define PCIE_FW_REG(reg_addr, idx) ((reg_addr) + (idx) * 4) | ||
67 | |||
66 | #define SGE_PF_KDOORBELL_A 0x0 | 68 | #define SGE_PF_KDOORBELL_A 0x0 |
67 | 69 | ||
68 | #define QID_S 15 | 70 | #define QID_S 15 |
@@ -707,6 +709,7 @@ | |||
707 | #define PFNUM_V(x) ((x) << PFNUM_S) | 709 | #define PFNUM_V(x) ((x) << PFNUM_S) |
708 | 710 | ||
709 | #define PCIE_FW_A 0x30b8 | 711 | #define PCIE_FW_A 0x30b8 |
712 | #define PCIE_FW_PF_A 0x30bc | ||
710 | 713 | ||
711 | #define PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS_A 0x5908 | 714 | #define PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS_A 0x5908 |
712 | 715 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h index 9b353a88cbda..a4a19e0ec7f5 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | |||
@@ -101,7 +101,7 @@ enum fw_wr_opcodes { | |||
101 | FW_RI_BIND_MW_WR = 0x18, | 101 | FW_RI_BIND_MW_WR = 0x18, |
102 | FW_RI_FR_NSMR_WR = 0x19, | 102 | FW_RI_FR_NSMR_WR = 0x19, |
103 | FW_RI_INV_LSTAG_WR = 0x1a, | 103 | FW_RI_INV_LSTAG_WR = 0x1a, |
104 | FW_LASTC2E_WR = 0x40 | 104 | FW_LASTC2E_WR = 0x70 |
105 | }; | 105 | }; |
106 | 106 | ||
107 | struct fw_wr_hdr { | 107 | struct fw_wr_hdr { |
@@ -993,6 +993,7 @@ enum fw_memtype_cf { | |||
993 | FW_MEMTYPE_CF_EXTMEM = 0x2, | 993 | FW_MEMTYPE_CF_EXTMEM = 0x2, |
994 | FW_MEMTYPE_CF_FLASH = 0x4, | 994 | FW_MEMTYPE_CF_FLASH = 0x4, |
995 | FW_MEMTYPE_CF_INTERNAL = 0x5, | 995 | FW_MEMTYPE_CF_INTERNAL = 0x5, |
996 | FW_MEMTYPE_CF_EXTMEM1 = 0x6, | ||
996 | }; | 997 | }; |
997 | 998 | ||
998 | struct fw_caps_config_cmd { | 999 | struct fw_caps_config_cmd { |
@@ -1035,6 +1036,7 @@ enum fw_params_mnem { | |||
1035 | FW_PARAMS_MNEM_PFVF = 2, /* function params */ | 1036 | FW_PARAMS_MNEM_PFVF = 2, /* function params */ |
1036 | FW_PARAMS_MNEM_REG = 3, /* limited register access */ | 1037 | FW_PARAMS_MNEM_REG = 3, /* limited register access */ |
1037 | FW_PARAMS_MNEM_DMAQ = 4, /* dma queue params */ | 1038 | FW_PARAMS_MNEM_DMAQ = 4, /* dma queue params */ |
1039 | FW_PARAMS_MNEM_CHNET = 5, /* chnet params */ | ||
1038 | FW_PARAMS_MNEM_LAST | 1040 | FW_PARAMS_MNEM_LAST |
1039 | }; | 1041 | }; |
1040 | 1042 | ||
@@ -3102,7 +3104,8 @@ enum fw_devlog_facility { | |||
3102 | FW_DEVLOG_FACILITY_FCOE = 0x2E, | 3104 | FW_DEVLOG_FACILITY_FCOE = 0x2E, |
3103 | FW_DEVLOG_FACILITY_FOISCSI = 0x30, | 3105 | FW_DEVLOG_FACILITY_FOISCSI = 0x30, |
3104 | FW_DEVLOG_FACILITY_FOFCOE = 0x32, | 3106 | FW_DEVLOG_FACILITY_FOFCOE = 0x32, |
3105 | FW_DEVLOG_FACILITY_MAX = 0x32, | 3107 | FW_DEVLOG_FACILITY_CHNET = 0x34, |
3108 | FW_DEVLOG_FACILITY_MAX = 0x34, | ||
3106 | }; | 3109 | }; |
3107 | 3110 | ||
3108 | /* log message format */ | 3111 | /* log message format */ |
@@ -3139,4 +3142,36 @@ struct fw_devlog_cmd { | |||
3139 | (((x) >> FW_DEVLOG_CMD_MEMADDR16_DEVLOG_S) & \ | 3142 | (((x) >> FW_DEVLOG_CMD_MEMADDR16_DEVLOG_S) & \ |
3140 | FW_DEVLOG_CMD_MEMADDR16_DEVLOG_M) | 3143 | FW_DEVLOG_CMD_MEMADDR16_DEVLOG_M) |
3141 | 3144 | ||
3145 | /* P C I E F W P F 7 R E G I S T E R */ | ||
3146 | |||
3147 | /* PF7 stores the Firmware Device Log parameters which allows Host Drivers to | ||
3148 | * access the "devlog" which needing to contact firmware. The encoding is | ||
3149 | * mostly the same as that returned by the DEVLOG command except for the size | ||
3150 | * which is encoded as the number of entries in multiples-1 of 128 here rather | ||
3151 | * than the memory size as is done in the DEVLOG command. Thus, 0 means 128 | ||
3152 | * and 15 means 2048. This of course in turn constrains the allowed values | ||
3153 | * for the devlog size ... | ||
3154 | */ | ||
3155 | #define PCIE_FW_PF_DEVLOG 7 | ||
3156 | |||
3157 | #define PCIE_FW_PF_DEVLOG_NENTRIES128_S 28 | ||
3158 | #define PCIE_FW_PF_DEVLOG_NENTRIES128_M 0xf | ||
3159 | #define PCIE_FW_PF_DEVLOG_NENTRIES128_V(x) \ | ||
3160 | ((x) << PCIE_FW_PF_DEVLOG_NENTRIES128_S) | ||
3161 | #define PCIE_FW_PF_DEVLOG_NENTRIES128_G(x) \ | ||
3162 | (((x) >> PCIE_FW_PF_DEVLOG_NENTRIES128_S) & \ | ||
3163 | PCIE_FW_PF_DEVLOG_NENTRIES128_M) | ||
3164 | |||
3165 | #define PCIE_FW_PF_DEVLOG_ADDR16_S 4 | ||
3166 | #define PCIE_FW_PF_DEVLOG_ADDR16_M 0xffffff | ||
3167 | #define PCIE_FW_PF_DEVLOG_ADDR16_V(x) ((x) << PCIE_FW_PF_DEVLOG_ADDR16_S) | ||
3168 | #define PCIE_FW_PF_DEVLOG_ADDR16_G(x) \ | ||
3169 | (((x) >> PCIE_FW_PF_DEVLOG_ADDR16_S) & PCIE_FW_PF_DEVLOG_ADDR16_M) | ||
3170 | |||
3171 | #define PCIE_FW_PF_DEVLOG_MEMTYPE_S 0 | ||
3172 | #define PCIE_FW_PF_DEVLOG_MEMTYPE_M 0xf | ||
3173 | #define PCIE_FW_PF_DEVLOG_MEMTYPE_V(x) ((x) << PCIE_FW_PF_DEVLOG_MEMTYPE_S) | ||
3174 | #define PCIE_FW_PF_DEVLOG_MEMTYPE_G(x) \ | ||
3175 | (((x) >> PCIE_FW_PF_DEVLOG_MEMTYPE_S) & PCIE_FW_PF_DEVLOG_MEMTYPE_M) | ||
3176 | |||
3142 | #endif /* _T4FW_INTERFACE_H_ */ | 3177 | #endif /* _T4FW_INTERFACE_H_ */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h index e2bd3f747858..b9d1cbac0eee 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h | |||
@@ -36,13 +36,13 @@ | |||
36 | #define __T4FW_VERSION_H__ | 36 | #define __T4FW_VERSION_H__ |
37 | 37 | ||
38 | #define T4FW_VERSION_MAJOR 0x01 | 38 | #define T4FW_VERSION_MAJOR 0x01 |
39 | #define T4FW_VERSION_MINOR 0x0C | 39 | #define T4FW_VERSION_MINOR 0x0D |
40 | #define T4FW_VERSION_MICRO 0x19 | 40 | #define T4FW_VERSION_MICRO 0x20 |
41 | #define T4FW_VERSION_BUILD 0x00 | 41 | #define T4FW_VERSION_BUILD 0x00 |
42 | 42 | ||
43 | #define T5FW_VERSION_MAJOR 0x01 | 43 | #define T5FW_VERSION_MAJOR 0x01 |
44 | #define T5FW_VERSION_MINOR 0x0C | 44 | #define T5FW_VERSION_MINOR 0x0D |
45 | #define T5FW_VERSION_MICRO 0x19 | 45 | #define T5FW_VERSION_MICRO 0x20 |
46 | #define T5FW_VERSION_BUILD 0x00 | 46 | #define T5FW_VERSION_BUILD 0x00 |
47 | 47 | ||
48 | #endif | 48 | #endif |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index 0545f0de1c52..e0d711071afb 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c | |||
@@ -1004,7 +1004,7 @@ static inline void ring_tx_db(struct adapter *adapter, struct sge_txq *tq, | |||
1004 | ? (tq->pidx - 1) | 1004 | ? (tq->pidx - 1) |
1005 | : (tq->size - 1)); | 1005 | : (tq->size - 1)); |
1006 | __be64 *src = (__be64 *)&tq->desc[index]; | 1006 | __be64 *src = (__be64 *)&tq->desc[index]; |
1007 | __be64 __iomem *dst = (__be64 *)(tq->bar2_addr + | 1007 | __be64 __iomem *dst = (__be64 __iomem *)(tq->bar2_addr + |
1008 | SGE_UDB_WCDOORBELL); | 1008 | SGE_UDB_WCDOORBELL); |
1009 | unsigned int count = EQ_UNIT / sizeof(__be64); | 1009 | unsigned int count = EQ_UNIT / sizeof(__be64); |
1010 | 1010 | ||
@@ -1018,7 +1018,11 @@ static inline void ring_tx_db(struct adapter *adapter, struct sge_txq *tq, | |||
1018 | * DMA. | 1018 | * DMA. |
1019 | */ | 1019 | */ |
1020 | while (count) { | 1020 | while (count) { |
1021 | writeq(*src, dst); | 1021 | /* the (__force u64) is because the compiler |
1022 | * doesn't understand the endian swizzling | ||
1023 | * going on | ||
1024 | */ | ||
1025 | writeq((__force u64)*src, dst); | ||
1022 | src++; | 1026 | src++; |
1023 | dst++; | 1027 | dst++; |
1024 | count--; | 1028 | count--; |
@@ -1252,8 +1256,8 @@ int t4vf_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1252 | BUG_ON(DIV_ROUND_UP(ETHTXQ_MAX_HDR, TXD_PER_EQ_UNIT) > 1); | 1256 | BUG_ON(DIV_ROUND_UP(ETHTXQ_MAX_HDR, TXD_PER_EQ_UNIT) > 1); |
1253 | wr = (void *)&txq->q.desc[txq->q.pidx]; | 1257 | wr = (void *)&txq->q.desc[txq->q.pidx]; |
1254 | wr->equiq_to_len16 = cpu_to_be32(wr_mid); | 1258 | wr->equiq_to_len16 = cpu_to_be32(wr_mid); |
1255 | wr->r3[0] = cpu_to_be64(0); | 1259 | wr->r3[0] = cpu_to_be32(0); |
1256 | wr->r3[1] = cpu_to_be64(0); | 1260 | wr->r3[1] = cpu_to_be32(0); |
1257 | skb_copy_from_linear_data(skb, (void *)wr->ethmacdst, fw_hdr_copy_len); | 1261 | skb_copy_from_linear_data(skb, (void *)wr->ethmacdst, fw_hdr_copy_len); |
1258 | end = (u64 *)wr + flits; | 1262 | end = (u64 *)wr + flits; |
1259 | 1263 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c index 1b5506df35b1..280b4a215849 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | |||
@@ -210,10 +210,10 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, | |||
210 | 210 | ||
211 | if (rpl) { | 211 | if (rpl) { |
212 | /* request bit in high-order BE word */ | 212 | /* request bit in high-order BE word */ |
213 | WARN_ON((be32_to_cpu(*(const u32 *)cmd) | 213 | WARN_ON((be32_to_cpu(*(const __be32 *)cmd) |
214 | & FW_CMD_REQUEST_F) == 0); | 214 | & FW_CMD_REQUEST_F) == 0); |
215 | get_mbox_rpl(adapter, rpl, size, mbox_data); | 215 | get_mbox_rpl(adapter, rpl, size, mbox_data); |
216 | WARN_ON((be32_to_cpu(*(u32 *)rpl) | 216 | WARN_ON((be32_to_cpu(*(__be32 *)rpl) |
217 | & FW_CMD_REQUEST_F) != 0); | 217 | & FW_CMD_REQUEST_F) != 0); |
218 | } | 218 | } |
219 | t4_write_reg(adapter, mbox_ctl, | 219 | t4_write_reg(adapter, mbox_ctl, |
@@ -484,7 +484,7 @@ int t4_bar2_sge_qregs(struct adapter *adapter, | |||
484 | * o The BAR2 Queue ID. | 484 | * o The BAR2 Queue ID. |
485 | * o The BAR2 Queue ID Offset into the BAR2 page. | 485 | * o The BAR2 Queue ID Offset into the BAR2 page. |
486 | */ | 486 | */ |
487 | bar2_page_offset = ((qid >> qpp_shift) << page_shift); | 487 | bar2_page_offset = ((u64)(qid >> qpp_shift) << page_shift); |
488 | bar2_qid = qid & qpp_mask; | 488 | bar2_qid = qid & qpp_mask; |
489 | bar2_qid_offset = bar2_qid * SGE_UDB_SIZE; | 489 | bar2_qid_offset = bar2_qid * SGE_UDB_SIZE; |
490 | 490 | ||