diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-12 19:16:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-12 19:16:39 -0400 |
commit | 07f5fef981bd89e92d67a69370c6487679cf66e4 (patch) | |
tree | 172a3f5862ae54d5a4b24a5e9173be8fad44f1c0 /drivers/net | |
parent | 96c57ade7e9ba2d1deba635a5989cc111f185dca (diff) | |
parent | f220baad08963a75c78c80cdc1c9e9492ca0eb2a (diff) |
Merge tag 'ntb-3.15' of git://github.com/jonmason/ntb
Pull PCIe non-transparent bridge fixes and features from Jon Mason:
"NTB driver bug fixes to address issues in list traversal, skb leak in
ntb_netdev, a typo, and a leak of msix entries in the error path.
Clean ups of the event handling logic, as well as a overall style
cleanup. Finally, the driver was converted to use the new
pci_enable_msix_range logic (and the refactoring to go along with it)"
* tag 'ntb-3.15' of git://github.com/jonmason/ntb:
ntb: Use pci_enable_msix_range() instead of pci_enable_msix()
ntb: Split ntb_setup_msix() into separate BWD/SNB routines
ntb: Use pci_msix_vec_count() to obtain number of MSI-Xs
NTB: Code Style Clean-up
NTB: client event cleanup
ntb: Fix leakage of ntb_device::msix_entries[] array
NTB: Fix typo in setting one translation register
ntb_netdev: Fix skb free issue in open
ntb_netdev: Fix list_for_each_entry exit issue
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ntb_netdev.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c index f3cdf64997d6..63aa9d9e34c5 100644 --- a/drivers/net/ntb_netdev.c +++ b/drivers/net/ntb_netdev.c | |||
@@ -78,11 +78,19 @@ static void ntb_netdev_event_handler(void *data, int status) | |||
78 | netdev_dbg(ndev, "Event %x, Link %x\n", status, | 78 | netdev_dbg(ndev, "Event %x, Link %x\n", status, |
79 | ntb_transport_link_query(dev->qp)); | 79 | ntb_transport_link_query(dev->qp)); |
80 | 80 | ||
81 | /* Currently, only link status event is supported */ | 81 | switch (status) { |
82 | if (status) | 82 | case NTB_LINK_DOWN: |
83 | netif_carrier_on(ndev); | ||
84 | else | ||
85 | netif_carrier_off(ndev); | 83 | netif_carrier_off(ndev); |
84 | break; | ||
85 | case NTB_LINK_UP: | ||
86 | if (!ntb_transport_link_query(dev->qp)) | ||
87 | return; | ||
88 | |||
89 | netif_carrier_on(ndev); | ||
90 | break; | ||
91 | default: | ||
92 | netdev_warn(ndev, "Unsupported event type %d\n", status); | ||
93 | } | ||
86 | } | 94 | } |
87 | 95 | ||
88 | static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data, | 96 | static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data, |
@@ -182,8 +190,10 @@ static int ntb_netdev_open(struct net_device *ndev) | |||
182 | 190 | ||
183 | rc = ntb_transport_rx_enqueue(dev->qp, skb, skb->data, | 191 | rc = ntb_transport_rx_enqueue(dev->qp, skb, skb->data, |
184 | ndev->mtu + ETH_HLEN); | 192 | ndev->mtu + ETH_HLEN); |
185 | if (rc == -EINVAL) | 193 | if (rc == -EINVAL) { |
194 | dev_kfree_skb(skb); | ||
186 | goto err; | 195 | goto err; |
196 | } | ||
187 | } | 197 | } |
188 | 198 | ||
189 | netif_carrier_off(ndev); | 199 | netif_carrier_off(ndev); |
@@ -367,12 +377,15 @@ static void ntb_netdev_remove(struct pci_dev *pdev) | |||
367 | { | 377 | { |
368 | struct net_device *ndev; | 378 | struct net_device *ndev; |
369 | struct ntb_netdev *dev; | 379 | struct ntb_netdev *dev; |
380 | bool found = false; | ||
370 | 381 | ||
371 | list_for_each_entry(dev, &dev_list, list) { | 382 | list_for_each_entry(dev, &dev_list, list) { |
372 | if (dev->pdev == pdev) | 383 | if (dev->pdev == pdev) { |
384 | found = true; | ||
373 | break; | 385 | break; |
386 | } | ||
374 | } | 387 | } |
375 | if (dev == NULL) | 388 | if (!found) |
376 | return; | 389 | return; |
377 | 390 | ||
378 | list_del(&dev->list); | 391 | list_del(&dev->list); |