NTB: MFV 403c63cb: client event cleanup

Provide a better event interface between the client and transport.

Authored by:	Jon Mason
Obtained from:	Linux (Dual BSD/GPL driver)
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Conrad Meyer 2015-10-14 23:44:42 +00:00
parent 66eb134d76
commit 531c7b9969
2 changed files with 23 additions and 6 deletions

View File

@ -137,7 +137,7 @@ struct ntb_transport_qp {
uint64_t rx_max_entry;
uint64_t rx_max_frame;
void (*event_handler) (void *data, int status);
void (*event_handler) (void *data, enum ntb_link_event status);
struct callout link_work;
struct callout queue_full;
struct callout rx_full;
@ -161,7 +161,7 @@ struct ntb_queue_handlers {
void *data, int len);
void (*tx_handler) (struct ntb_transport_qp *qp, void *qp_data,
void *data, int len);
void (*event_handler) (void *data, int status);
void (*event_handler) (void *data, enum ntb_link_event status);
};
@ -234,7 +234,7 @@ static void ntb_net_tx_handler(struct ntb_transport_qp *qp, void *qp_data,
void *data, int len);
static void ntb_net_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
void *data, int len);
static void ntb_net_event_handler(void *data, int status);
static void ntb_net_event_handler(void *data, enum ntb_link_event status);
static int ntb_transport_init(struct ntb_softc *ntb);
static void ntb_transport_free(void *transport);
static void ntb_transport_init_queue(struct ntb_netdev *nt,
@ -465,9 +465,23 @@ ntb_net_rx_handler(struct ntb_transport_qp *qp, void *qp_data, void *data,
}
static void
ntb_net_event_handler(void *data, int status)
ntb_net_event_handler(void *data, enum ntb_link_event status)
{
struct ifnet *ifp;
ifp = data;
(void)ifp;
/* XXX The Linux driver munges with the carrier status here. */
switch (status) {
case NTB_LINK_DOWN:
break;
case NTB_LINK_UP:
break;
default:
panic("Bogus ntb_link_event %u\n", status);
}
}
/* Transport Init and teardown */

View File

@ -32,8 +32,11 @@
struct ntb_softc;
#define NTB_NUM_MW 2
#define NTB_LINK_DOWN 0
#define NTB_LINK_UP 1
enum ntb_link_event {
NTB_LINK_DOWN = 0,
NTB_LINK_UP,
};
enum ntb_hw_event {
NTB_EVENT_SW_EVENT0 = 0,