aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxge/vxge-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/vxge/vxge-main.c')
-rw-r--r--drivers/net/vxge/vxge-main.c100
1 files changed, 54 insertions, 46 deletions
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index 6034497536a4..7b5402b50d0a 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -374,10 +374,10 @@ vxge_rx_complete(struct vxge_ring *ring, struct sk_buff *skb, u16 vlan,
374 if (ring->vlgrp && ext_info->vlan && 374 if (ring->vlgrp && ext_info->vlan &&
375 (ring->vlan_tag_strip == 375 (ring->vlan_tag_strip ==
376 VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE)) 376 VXGE_HW_VPATH_RPA_STRIP_VLAN_TAG_ENABLE))
377 vlan_gro_receive(&ring->napi, ring->vlgrp, 377 vlan_gro_receive(ring->napi_p, ring->vlgrp,
378 ext_info->vlan, skb); 378 ext_info->vlan, skb);
379 else 379 else
380 napi_gro_receive(&ring->napi, skb); 380 napi_gro_receive(ring->napi_p, skb);
381 } else { 381 } else {
382 if (ring->vlgrp && vlan && 382 if (ring->vlgrp && vlan &&
383 (ring->vlan_tag_strip == 383 (ring->vlan_tag_strip ==
@@ -454,6 +454,8 @@ vxge_rx_1b_compl(struct __vxge_hw_ring *ringh, void *dtr,
454 vxge_hw_ring_rxd_1b_get(ringh, dtr, &dma_sizes); 454 vxge_hw_ring_rxd_1b_get(ringh, dtr, &dma_sizes);
455 pkt_length = dma_sizes; 455 pkt_length = dma_sizes;
456 456
457 pkt_length -= ETH_FCS_LEN;
458
457 vxge_debug_rx(VXGE_TRACE, 459 vxge_debug_rx(VXGE_TRACE,
458 "%s: %s:%d Packet Length = %d", 460 "%s: %s:%d Packet Length = %d",
459 ring->ndev->name, __func__, __LINE__, pkt_length); 461 ring->ndev->name, __func__, __LINE__, pkt_length);
@@ -817,7 +819,6 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev)
817 u64 dma_pointer; 819 u64 dma_pointer;
818 struct vxge_tx_priv *txdl_priv = NULL; 820 struct vxge_tx_priv *txdl_priv = NULL;
819 struct __vxge_hw_fifo *fifo_hw; 821 struct __vxge_hw_fifo *fifo_hw;
820 u32 max_mss = 0x0;
821 int offload_type; 822 int offload_type;
822 unsigned long flags = 0; 823 unsigned long flags = 0;
823 int vpath_no = 0; 824 int vpath_no = 0;
@@ -969,10 +970,6 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev)
969 970
970 int mss = vxge_tcp_mss(skb); 971 int mss = vxge_tcp_mss(skb);
971 if (mss) { 972 if (mss) {
972 max_mss = dev->mtu + ETH_HLEN -
973 VXGE_HW_TCPIP_HEADER_MAX_SIZE;
974 if (mss > max_mss)
975 mss = max_mss;
976 vxge_debug_tx(VXGE_TRACE, 973 vxge_debug_tx(VXGE_TRACE,
977 "%s: %s:%d mss = %d", 974 "%s: %s:%d mss = %d",
978 dev->name, __func__, __LINE__, mss); 975 dev->name, __func__, __LINE__, mss);
@@ -1000,7 +997,7 @@ vxge_xmit(struct sk_buff *skb, struct net_device *dev)
1000 VXGE_COMPLETE_VPATH_TX(fifo); 997 VXGE_COMPLETE_VPATH_TX(fifo);
1001 vxge_debug_entryexit(VXGE_TRACE, "%s: %s:%d Exiting...", 998 vxge_debug_entryexit(VXGE_TRACE, "%s: %s:%d Exiting...",
1002 dev->name, __func__, __LINE__); 999 dev->name, __func__, __LINE__);
1003 return 0; 1000 return NETDEV_TX_OK;
1004 1001
1005_exit0: 1002_exit0:
1006 vxge_debug_tx(VXGE_TRACE, "%s: pci_map_page failed", dev->name); 1003 vxge_debug_tx(VXGE_TRACE, "%s: pci_map_page failed", dev->name);
@@ -1024,7 +1021,7 @@ _exit2:
1024 spin_unlock_irqrestore(&fifo->tx_lock, flags); 1021 spin_unlock_irqrestore(&fifo->tx_lock, flags);
1025 VXGE_COMPLETE_VPATH_TX(fifo); 1022 VXGE_COMPLETE_VPATH_TX(fifo);
1026 1023
1027 return 0; 1024 return NETDEV_TX_OK;
1028} 1025}
1029 1026
1030/* 1027/*
@@ -2137,16 +2134,16 @@ int vxge_open_vpaths(struct vxgedev *vdev)
2137 */ 2134 */
2138static irqreturn_t vxge_isr_napi(int irq, void *dev_id) 2135static irqreturn_t vxge_isr_napi(int irq, void *dev_id)
2139{ 2136{
2140 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)dev_id;
2141 struct vxgedev *vdev;
2142 struct net_device *dev; 2137 struct net_device *dev;
2138 struct __vxge_hw_device *hldev;
2143 u64 reason; 2139 u64 reason;
2144 enum vxge_hw_status status; 2140 enum vxge_hw_status status;
2141 struct vxgedev *vdev = (struct vxgedev *) dev_id;;
2145 2142
2146 vxge_debug_intr(VXGE_TRACE, "%s:%d", __func__, __LINE__); 2143 vxge_debug_intr(VXGE_TRACE, "%s:%d", __func__, __LINE__);
2147 2144
2148 dev = hldev->ndev; 2145 dev = vdev->ndev;
2149 vdev = netdev_priv(dev); 2146 hldev = (struct __vxge_hw_device *)pci_get_drvdata(vdev->pdev);
2150 2147
2151 if (pci_channel_offline(vdev->pdev)) 2148 if (pci_channel_offline(vdev->pdev))
2152 return IRQ_NONE; 2149 return IRQ_NONE;
@@ -2417,15 +2414,13 @@ static void vxge_rem_isr(struct vxgedev *vdev)
2417#endif 2414#endif
2418 if (vdev->config.intr_type == INTA) { 2415 if (vdev->config.intr_type == INTA) {
2419 synchronize_irq(vdev->pdev->irq); 2416 synchronize_irq(vdev->pdev->irq);
2420 free_irq(vdev->pdev->irq, hldev); 2417 free_irq(vdev->pdev->irq, vdev);
2421 } 2418 }
2422} 2419}
2423 2420
2424static int vxge_add_isr(struct vxgedev *vdev) 2421static int vxge_add_isr(struct vxgedev *vdev)
2425{ 2422{
2426 int ret = 0; 2423 int ret = 0;
2427 struct __vxge_hw_device *hldev =
2428 (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev);
2429#ifdef CONFIG_PCI_MSI 2424#ifdef CONFIG_PCI_MSI
2430 int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0; 2425 int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0;
2431 u64 function_mode = vdev->config.device_hw_info.function_mode; 2426 u64 function_mode = vdev->config.device_hw_info.function_mode;
@@ -2579,7 +2574,7 @@ INTA_MODE:
2579 if (vdev->config.intr_type == INTA) { 2574 if (vdev->config.intr_type == INTA) {
2580 ret = request_irq((int) vdev->pdev->irq, 2575 ret = request_irq((int) vdev->pdev->irq,
2581 vxge_isr_napi, 2576 vxge_isr_napi,
2582 IRQF_SHARED, vdev->desc[0], hldev); 2577 IRQF_SHARED, vdev->desc[0], vdev);
2583 if (ret) { 2578 if (ret) {
2584 vxge_debug_init(VXGE_ERR, 2579 vxge_debug_init(VXGE_ERR,
2585 "%s %s-%d: ISR registration failed", 2580 "%s %s-%d: ISR registration failed",
@@ -2712,11 +2707,15 @@ vxge_open(struct net_device *dev)
2712 netif_napi_add(dev, &vdev->napi, vxge_poll_inta, 2707 netif_napi_add(dev, &vdev->napi, vxge_poll_inta,
2713 vdev->config.napi_weight); 2708 vdev->config.napi_weight);
2714 napi_enable(&vdev->napi); 2709 napi_enable(&vdev->napi);
2710 for (i = 0; i < vdev->no_of_vpath; i++)
2711 vdev->vpaths[i].ring.napi_p = &vdev->napi;
2715 } else { 2712 } else {
2716 for (i = 0; i < vdev->no_of_vpath; i++) { 2713 for (i = 0; i < vdev->no_of_vpath; i++) {
2717 netif_napi_add(dev, &vdev->vpaths[i].ring.napi, 2714 netif_napi_add(dev, &vdev->vpaths[i].ring.napi,
2718 vxge_poll_msix, vdev->config.napi_weight); 2715 vxge_poll_msix, vdev->config.napi_weight);
2719 napi_enable(&vdev->vpaths[i].ring.napi); 2716 napi_enable(&vdev->vpaths[i].ring.napi);
2717 vdev->vpaths[i].ring.napi_p =
2718 &vdev->vpaths[i].ring.napi;
2720 } 2719 }
2721 } 2720 }
2722 2721
@@ -2890,6 +2889,9 @@ int do_vxge_close(struct net_device *dev, int do_io)
2890 vdev = (struct vxgedev *)netdev_priv(dev); 2889 vdev = (struct vxgedev *)netdev_priv(dev);
2891 hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev); 2890 hldev = (struct __vxge_hw_device *) pci_get_drvdata(vdev->pdev);
2892 2891
2892 if (unlikely(!is_vxge_card_up(vdev)))
2893 return 0;
2894
2893 /* If vxge_handle_crit_err task is executing, 2895 /* If vxge_handle_crit_err task is executing,
2894 * wait till it completes. */ 2896 * wait till it completes. */
2895 while (test_and_set_bit(__VXGE_STATE_RESET_CARD, &vdev->state)) 2897 while (test_and_set_bit(__VXGE_STATE_RESET_CARD, &vdev->state))
@@ -4152,18 +4154,6 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4152 attr.bar0, 4154 attr.bar0,
4153 (unsigned long long)pci_resource_start(pdev, 0)); 4155 (unsigned long long)pci_resource_start(pdev, 0));
4154 4156
4155 attr.bar1 = pci_ioremap_bar(pdev, 2);
4156 if (!attr.bar1) {
4157 vxge_debug_init(VXGE_ERR,
4158 "%s : cannot remap io memory bar2", __func__);
4159 ret = -ENODEV;
4160 goto _exit3;
4161 }
4162 vxge_debug_ll_config(VXGE_TRACE,
4163 "pci ioremap bar1: %p:0x%llx",
4164 attr.bar1,
4165 (unsigned long long)pci_resource_start(pdev, 2));
4166
4167 status = vxge_hw_device_hw_info_get(attr.bar0, 4157 status = vxge_hw_device_hw_info_get(attr.bar0,
4168 &ll_config.device_hw_info); 4158 &ll_config.device_hw_info);
4169 if (status != VXGE_HW_OK) { 4159 if (status != VXGE_HW_OK) {
@@ -4171,17 +4161,17 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4171 "%s: Reading of hardware info failed." 4161 "%s: Reading of hardware info failed."
4172 "Please try upgrading the firmware.", VXGE_DRIVER_NAME); 4162 "Please try upgrading the firmware.", VXGE_DRIVER_NAME);
4173 ret = -EINVAL; 4163 ret = -EINVAL;
4174 goto _exit4; 4164 goto _exit3;
4175 } 4165 }
4176 4166
4177 if (ll_config.device_hw_info.fw_version.major != 4167 if (ll_config.device_hw_info.fw_version.major !=
4178 VXGE_DRIVER_VERSION_MAJOR) { 4168 VXGE_DRIVER_FW_VERSION_MAJOR) {
4179 vxge_debug_init(VXGE_ERR, 4169 vxge_debug_init(VXGE_ERR,
4180 "FW Ver.(maj): %d not driver's expected version: %d", 4170 "%s: Incorrect firmware version."
4181 ll_config.device_hw_info.fw_version.major, 4171 "Please upgrade the firmware to version 1.x.x",
4182 VXGE_DRIVER_VERSION_MAJOR); 4172 VXGE_DRIVER_NAME);
4183 ret = -EINVAL; 4173 ret = -EINVAL;
4184 goto _exit4; 4174 goto _exit3;
4185 } 4175 }
4186 4176
4187 vpath_mask = ll_config.device_hw_info.vpath_mask; 4177 vpath_mask = ll_config.device_hw_info.vpath_mask;
@@ -4189,7 +4179,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4189 vxge_debug_ll_config(VXGE_TRACE, 4179 vxge_debug_ll_config(VXGE_TRACE,
4190 "%s: No vpaths available in device", VXGE_DRIVER_NAME); 4180 "%s: No vpaths available in device", VXGE_DRIVER_NAME);
4191 ret = -EINVAL; 4181 ret = -EINVAL;
4192 goto _exit4; 4182 goto _exit3;
4193 } 4183 }
4194 4184
4195 vxge_debug_ll_config(VXGE_TRACE, 4185 vxge_debug_ll_config(VXGE_TRACE,
@@ -4222,7 +4212,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4222 vxge_debug_ll_config(VXGE_ERR, 4212 vxge_debug_ll_config(VXGE_ERR,
4223 "%s: No more vpaths to configure", VXGE_DRIVER_NAME); 4213 "%s: No more vpaths to configure", VXGE_DRIVER_NAME);
4224 ret = 0; 4214 ret = 0;
4225 goto _exit4; 4215 goto _exit3;
4226 } 4216 }
4227 4217
4228 /* Setting driver callbacks */ 4218 /* Setting driver callbacks */
@@ -4235,7 +4225,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4235 vxge_debug_init(VXGE_ERR, 4225 vxge_debug_init(VXGE_ERR,
4236 "Failed to initialize device (%d)", status); 4226 "Failed to initialize device (%d)", status);
4237 ret = -EINVAL; 4227 ret = -EINVAL;
4238 goto _exit4; 4228 goto _exit3;
4239 } 4229 }
4240 4230
4241 vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_LL); 4231 vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_LL);
@@ -4260,7 +4250,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4260 if (vxge_device_register(hldev, &ll_config, high_dma, no_of_vpath, 4250 if (vxge_device_register(hldev, &ll_config, high_dma, no_of_vpath,
4261 &vdev)) { 4251 &vdev)) {
4262 ret = -EINVAL; 4252 ret = -EINVAL;
4263 goto _exit5; 4253 goto _exit4;
4264 } 4254 }
4265 4255
4266 vxge_hw_device_debug_set(hldev, VXGE_TRACE, VXGE_COMPONENT_LL); 4256 vxge_hw_device_debug_set(hldev, VXGE_TRACE, VXGE_COMPONENT_LL);
@@ -4271,7 +4261,6 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4271 hldev->ndev = vdev->ndev; 4261 hldev->ndev = vdev->ndev;
4272 vdev->mtu = VXGE_HW_DEFAULT_MTU; 4262 vdev->mtu = VXGE_HW_DEFAULT_MTU;
4273 vdev->bar0 = attr.bar0; 4263 vdev->bar0 = attr.bar0;
4274 vdev->bar1 = attr.bar1;
4275 vdev->max_vpath_supported = max_vpath_supported; 4264 vdev->max_vpath_supported = max_vpath_supported;
4276 vdev->no_of_vpath = no_of_vpath; 4265 vdev->no_of_vpath = no_of_vpath;
4277 4266
@@ -4336,6 +4325,27 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4336 ll_config.device_hw_info.fw_version.version, 4325 ll_config.device_hw_info.fw_version.version,
4337 ll_config.device_hw_info.fw_date.date); 4326 ll_config.device_hw_info.fw_date.date);
4338 4327
4328 if (new_device) {
4329 switch (ll_config.device_hw_info.function_mode) {
4330 case VXGE_HW_FUNCTION_MODE_SINGLE_FUNCTION:
4331 vxge_debug_init(VXGE_TRACE,
4332 "%s: Single Function Mode Enabled", vdev->ndev->name);
4333 break;
4334 case VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION:
4335 vxge_debug_init(VXGE_TRACE,
4336 "%s: Multi Function Mode Enabled", vdev->ndev->name);
4337 break;
4338 case VXGE_HW_FUNCTION_MODE_SRIOV:
4339 vxge_debug_init(VXGE_TRACE,
4340 "%s: Single Root IOV Mode Enabled", vdev->ndev->name);
4341 break;
4342 case VXGE_HW_FUNCTION_MODE_MRIOV:
4343 vxge_debug_init(VXGE_TRACE,
4344 "%s: Multi Root IOV Mode Enabled", vdev->ndev->name);
4345 break;
4346 }
4347 }
4348
4339 vxge_print_parm(vdev, vpath_mask); 4349 vxge_print_parm(vdev, vpath_mask);
4340 4350
4341 /* Store the fw version for ethttool option */ 4351 /* Store the fw version for ethttool option */
@@ -4353,7 +4363,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4353 "%s: mac_addr_list : memory allocation failed", 4363 "%s: mac_addr_list : memory allocation failed",
4354 vdev->ndev->name); 4364 vdev->ndev->name);
4355 ret = -EPERM; 4365 ret = -EPERM;
4356 goto _exit6; 4366 goto _exit5;
4357 } 4367 }
4358 macaddr = (u8 *)&entry->macaddr; 4368 macaddr = (u8 *)&entry->macaddr;
4359 memcpy(macaddr, vdev->ndev->dev_addr, ETH_ALEN); 4369 memcpy(macaddr, vdev->ndev->dev_addr, ETH_ALEN);
@@ -4361,6 +4371,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4361 vdev->vpaths[i].mac_addr_cnt = 1; 4371 vdev->vpaths[i].mac_addr_cnt = 1;
4362 } 4372 }
4363 4373
4374 kfree(device_config);
4364 vxge_debug_entryexit(VXGE_TRACE, "%s: %s:%d Exiting...", 4375 vxge_debug_entryexit(VXGE_TRACE, "%s: %s:%d Exiting...",
4365 vdev->ndev->name, __func__, __LINE__); 4376 vdev->ndev->name, __func__, __LINE__);
4366 4377
@@ -4370,16 +4381,14 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4370 4381
4371 return 0; 4382 return 0;
4372 4383
4373_exit6: 4384_exit5:
4374 for (i = 0; i < vdev->no_of_vpath; i++) 4385 for (i = 0; i < vdev->no_of_vpath; i++)
4375 vxge_free_mac_add_list(&vdev->vpaths[i]); 4386 vxge_free_mac_add_list(&vdev->vpaths[i]);
4376 4387
4377 vxge_device_unregister(hldev); 4388 vxge_device_unregister(hldev);
4378_exit5: 4389_exit4:
4379 pci_disable_sriov(pdev); 4390 pci_disable_sriov(pdev);
4380 vxge_hw_device_terminate(hldev); 4391 vxge_hw_device_terminate(hldev);
4381_exit4:
4382 iounmap(attr.bar1);
4383_exit3: 4392_exit3:
4384 iounmap(attr.bar0); 4393 iounmap(attr.bar0);
4385_exit2: 4394_exit2:
@@ -4438,7 +4447,6 @@ vxge_remove(struct pci_dev *pdev)
4438 kfree(vdev->vpaths); 4447 kfree(vdev->vpaths);
4439 4448
4440 iounmap(vdev->bar0); 4449 iounmap(vdev->bar0);
4441 iounmap(vdev->bar1);
4442 4450
4443 pci_disable_sriov(pdev); 4451 pci_disable_sriov(pdev);
4444 4452