Date: Wed, 14 Oct 2015 23:44:42 +0000 (UTC) From: "Conrad E. Meyer" <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289340 - in head/sys/dev/ntb: if_ntb ntb_hw Message-ID: <201510142344.t9ENigXn050279@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Wed Oct 14 23:44:42 2015 New Revision: 289340 URL: https://svnweb.freebsd.org/changeset/base/289340 Log: 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 Modified: head/sys/dev/ntb/if_ntb/if_ntb.c head/sys/dev/ntb/ntb_hw/ntb_hw.h Modified: head/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- head/sys/dev/ntb/if_ntb/if_ntb.c Wed Oct 14 23:41:41 2015 (r289339) +++ head/sys/dev/ntb/if_ntb/if_ntb.c Wed Oct 14 23:44:42 2015 (r289340) @@ -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 nt 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_ } 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 */ Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.h ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw.h Wed Oct 14 23:41:41 2015 (r289339) +++ head/sys/dev/ntb/ntb_hw/ntb_hw.h Wed Oct 14 23:44:42 2015 (r289340) @@ -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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510142344.t9ENigXn050279>