aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Mason <jon.mason@intel.com>2013-07-29 19:31:18 -0400
committerJon Mason <jon.mason@intel.com>2014-04-07 13:59:19 -0400
commit403c63cb6d7ec2caca2f9222ff843ac89d7d700a (patch)
tree52fc7c3baff78ed964a24f9a98b8b4921b60601e
parent717e8e8bfe5fdb87e849cd46b03d7877b9d77729 (diff)
NTB: client event cleanup
Provide a better event interface between the client and transport Signed-off-by: Jon Mason <jon.mason@intel.com>
-rw-r--r--drivers/net/ntb_netdev.c16
-rw-r--r--drivers/ntb/ntb_hw.h4
-rw-r--r--drivers/ntb/ntb_transport.c1
-rw-r--r--include/linux/ntb.h5
4 files changed, 18 insertions, 8 deletions
diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index 8e6752fd89ac..14570b28d528 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
88static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data, 96static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
diff --git a/drivers/ntb/ntb_hw.h b/drivers/ntb/ntb_hw.h
index bbdb7edca10c..d1960ffb4bbc 100644
--- a/drivers/ntb/ntb_hw.h
+++ b/drivers/ntb/ntb_hw.h
@@ -45,6 +45,7 @@
45 * Contact Information: 45 * Contact Information:
46 * Jon Mason <jon.mason@intel.com> 46 * Jon Mason <jon.mason@intel.com>
47 */ 47 */
48#include <linux/ntb.h>
48 49
49#define PCI_DEVICE_ID_INTEL_NTB_B2B_JSF 0x3725 50#define PCI_DEVICE_ID_INTEL_NTB_B2B_JSF 0x3725
50#define PCI_DEVICE_ID_INTEL_NTB_PS_JSF 0x3726 51#define PCI_DEVICE_ID_INTEL_NTB_PS_JSF 0x3726
@@ -83,9 +84,6 @@ static inline void writeq(u64 val, void __iomem *addr)
83#define NTB_BAR_MASK ((1 << NTB_BAR_MMIO) | (1 << NTB_BAR_23) |\ 84#define NTB_BAR_MASK ((1 << NTB_BAR_MMIO) | (1 << NTB_BAR_23) |\
84 (1 << NTB_BAR_45)) 85 (1 << NTB_BAR_45))
85 86
86#define NTB_LINK_DOWN 0
87#define NTB_LINK_UP 1
88
89#define NTB_HB_TIMEOUT msecs_to_jiffies(1000) 87#define NTB_HB_TIMEOUT msecs_to_jiffies(1000)
90 88
91#define NTB_MAX_NUM_MW 2 89#define NTB_MAX_NUM_MW 2
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 3217f394d45b..042fb3dd354f 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -56,7 +56,6 @@
56#include <linux/pci.h> 56#include <linux/pci.h>
57#include <linux/slab.h> 57#include <linux/slab.h>
58#include <linux/types.h> 58#include <linux/types.h>
59#include <linux/ntb.h>
60#include "ntb_hw.h" 59#include "ntb_hw.h"
61 60
62#define NTB_TRANSPORT_VERSION 3 61#define NTB_TRANSPORT_VERSION 3
diff --git a/include/linux/ntb.h b/include/linux/ntb.h
index f6a15205853b..cbc792cd745e 100644
--- a/include/linux/ntb.h
+++ b/include/linux/ntb.h
@@ -54,6 +54,11 @@ struct ntb_client {
54 void (*remove) (struct pci_dev *pdev); 54 void (*remove) (struct pci_dev *pdev);
55}; 55};
56 56
57enum {
58 NTB_LINK_DOWN = 0,
59 NTB_LINK_UP,
60};
61
57int ntb_register_client(struct ntb_client *drvr); 62int ntb_register_client(struct ntb_client *drvr);
58void ntb_unregister_client(struct ntb_client *drvr); 63void ntb_unregister_client(struct ntb_client *drvr);
59int ntb_register_client_dev(char *device_name); 64int ntb_register_client_dev(char *device_name);