aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-11-04 11:12:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-11-04 11:12:44 -0500
commit04578e8441c5420259a71eff9fede535858bfc6a (patch)
treedddc3123bffdd48c872ed05af5cbad80368b4029 /drivers/net
parent71e56028173bc84f01456a5679d8be9d681b49f1 (diff)
parenta662315d8ad9e687fe648b6eea9bd35017f565dd (diff)
Merge tag 'ntb-4.20' of git://github.com/jonmason/ntb
Pull NTB updates from Jon Mason: "Fairly minor changes and bug fixes: NTB IDT thermal changes and hook into hwmon, ntb_netdev clean-up of private struct, and a few bug fixes" * tag 'ntb-4.20' of git://github.com/jonmason/ntb: ntb: idt: Alter the driver info comments ntb: idt: Discard temperature sensor IRQ handler ntb: idt: Add basic hwmon sysfs interface ntb: idt: Alter temperature read method ntb_netdev: Simplify remove with client device drvdata NTB: transport: Try harder to alloc an aligned MW buffer ntb: ntb_transport: Mark expected switch fall-throughs ntb: idt: Set PCIe bus address to BARLIMITx NTB: ntb_hw_idt: replace IS_ERR_OR_NULL with regular NULL checks ntb: intel: fix return value for ndev_vec_mask() ntb_netdev: fix sleep time mismatch
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ntb_netdev.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index b12023bc2cab..a5bab614ff84 100644
--- a/drivers/net/ntb_netdev.c
+++ b/drivers/net/ntb_netdev.c
@@ -71,7 +71,6 @@ static unsigned int tx_start = 10;
71static unsigned int tx_stop = 5; 71static unsigned int tx_stop = 5;
72 72
73struct ntb_netdev { 73struct ntb_netdev {
74 struct list_head list;
75 struct pci_dev *pdev; 74 struct pci_dev *pdev;
76 struct net_device *ndev; 75 struct net_device *ndev;
77 struct ntb_transport_qp *qp; 76 struct ntb_transport_qp *qp;
@@ -81,8 +80,6 @@ struct ntb_netdev {
81#define NTB_TX_TIMEOUT_MS 1000 80#define NTB_TX_TIMEOUT_MS 1000
82#define NTB_RXQ_SIZE 100 81#define NTB_RXQ_SIZE 100
83 82
84static LIST_HEAD(dev_list);
85
86static void ntb_netdev_event_handler(void *data, int link_is_up) 83static void ntb_netdev_event_handler(void *data, int link_is_up)
87{ 84{
88 struct net_device *ndev = data; 85 struct net_device *ndev = data;
@@ -236,7 +233,7 @@ static void ntb_netdev_tx_timer(struct timer_list *t)
236 struct net_device *ndev = dev->ndev; 233 struct net_device *ndev = dev->ndev;
237 234
238 if (ntb_transport_tx_free_entry(dev->qp) < tx_stop) { 235 if (ntb_transport_tx_free_entry(dev->qp) < tx_stop) {
239 mod_timer(&dev->tx_timer, jiffies + msecs_to_jiffies(tx_time)); 236 mod_timer(&dev->tx_timer, jiffies + usecs_to_jiffies(tx_time));
240 } else { 237 } else {
241 /* Make sure anybody stopping the queue after this sees the new 238 /* Make sure anybody stopping the queue after this sees the new
242 * value of ntb_transport_tx_free_entry() 239 * value of ntb_transport_tx_free_entry()
@@ -452,7 +449,7 @@ static int ntb_netdev_probe(struct device *client_dev)
452 if (rc) 449 if (rc)
453 goto err1; 450 goto err1;
454 451
455 list_add(&dev->list, &dev_list); 452 dev_set_drvdata(client_dev, ndev);
456 dev_info(&pdev->dev, "%s created\n", ndev->name); 453 dev_info(&pdev->dev, "%s created\n", ndev->name);
457 return 0; 454 return 0;
458 455
@@ -465,27 +462,8 @@ err:
465 462
466static void ntb_netdev_remove(struct device *client_dev) 463static void ntb_netdev_remove(struct device *client_dev)
467{ 464{
468 struct ntb_dev *ntb; 465 struct net_device *ndev = dev_get_drvdata(client_dev);
469 struct net_device *ndev; 466 struct ntb_netdev *dev = netdev_priv(ndev);
470 struct pci_dev *pdev;
471 struct ntb_netdev *dev;
472 bool found = false;
473
474 ntb = dev_ntb(client_dev->parent);
475 pdev = ntb->pdev;
476
477 list_for_each_entry(dev, &dev_list, list) {
478 if (dev->pdev == pdev) {
479 found = true;
480 break;
481 }
482 }
483 if (!found)
484 return;
485
486 list_del(&dev->list);
487
488 ndev = dev->ndev;
489 467
490 unregister_netdev(ndev); 468 unregister_netdev(ndev);
491 ntb_transport_free_queue(dev->qp); 469 ntb_transport_free_queue(dev->qp);