version 1.46.2.1, 2011/06/06 09:07:11 |
version 1.47, 2011/03/30 00:17:04 |
Line 224 static void xennet_free_rx_buffer(struct |
|
Line 224 static void xennet_free_rx_buffer(struct |
|
static void xennet_tx_complete(struct xennet_xenbus_softc *); |
static void xennet_tx_complete(struct xennet_xenbus_softc *); |
static void xennet_rx_mbuf_free(struct mbuf *, void *, size_t, void *); |
static void xennet_rx_mbuf_free(struct mbuf *, void *, size_t, void *); |
static int xennet_handler(void *); |
static int xennet_handler(void *); |
static int xennet_talk_to_backend(struct xennet_xenbus_softc *); |
|
#ifdef XENNET_DEBUG_DUMP |
#ifdef XENNET_DEBUG_DUMP |
static void xennet_hex_dump(const unsigned char *, size_t, const char *, int); |
static void xennet_hex_dump(const unsigned char *, size_t, const char *, int); |
#endif |
#endif |
Line 373 xennet_xenbus_attach(device_t parent, de |
|
Line 372 xennet_xenbus_attach(device_t parent, de |
|
rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), |
rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), |
RND_TYPE_NET, 0); |
RND_TYPE_NET, 0); |
#endif |
#endif |
|
|
/* resume shared structures and tell backend that we are ready */ |
|
xennet_xenbus_resume(sc); |
|
} |
} |
|
|
static int |
static int |
|
|
xennet_xenbus_resume(void *p) |
xennet_xenbus_resume(void *p) |
{ |
{ |
struct xennet_xenbus_softc *sc = p; |
struct xennet_xenbus_softc *sc = p; |
|
struct xenbus_transaction *xbt; |
|
unsigned long rx_copy; |
int error; |
int error; |
netif_tx_sring_t *tx_ring; |
netif_tx_sring_t *tx_ring; |
netif_rx_sring_t *rx_ring; |
netif_rx_sring_t *rx_ring; |
paddr_t ma; |
paddr_t ma; |
|
const char *errmsg; |
|
|
sc->sc_tx_ring_gntref = GRANT_INVALID_REF; |
sc->sc_tx_ring_gntref = GRANT_INVALID_REF; |
sc->sc_rx_ring_gntref = GRANT_INVALID_REF; |
sc->sc_rx_ring_gntref = GRANT_INVALID_REF; |
Line 473 xennet_xenbus_resume(void *p) |
|
Line 472 xennet_xenbus_resume(void *p) |
|
event_set_handler(sc->sc_evtchn, &xennet_handler, sc, |
event_set_handler(sc->sc_evtchn, &xennet_handler, sc, |
IPL_NET, device_xname(sc->sc_dev)); |
IPL_NET, device_xname(sc->sc_dev)); |
|
|
return 0; |
|
} |
|
|
|
static int |
|
xennet_talk_to_backend(struct xennet_xenbus_softc *sc) |
|
{ |
|
int error; |
|
unsigned long rx_copy; |
|
struct xenbus_transaction *xbt; |
|
const char *errmsg; |
|
|
|
error = xenbus_read_ul(NULL, sc->sc_xbusd->xbusd_otherend, |
error = xenbus_read_ul(NULL, sc->sc_xbusd->xbusd_otherend, |
"feature-rx-copy", &rx_copy, 10); |
"feature-rx-copy", &rx_copy, 10); |
if (error) |
if (error) |
|
|
if (xbt == NULL) |
if (xbt == NULL) |
return ENOMEM; |
return ENOMEM; |
error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, |
error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, |
"vifname", "%s", device_xname(sc->sc_dev)); |
"vifname", device_xname(sc->sc_dev)); |
if (error) { |
if (error) { |
errmsg = "vifname"; |
errmsg = "vifname"; |
goto abort_transaction; |
goto abort_transaction; |
Line 570 static void xennet_backend_changed(void |
|
Line 558 static void xennet_backend_changed(void |
|
xenbus_switch_state(sc->sc_xbusd, NULL, XenbusStateClosed); |
xenbus_switch_state(sc->sc_xbusd, NULL, XenbusStateClosed); |
break; |
break; |
case XenbusStateInitWait: |
case XenbusStateInitWait: |
if (sc->sc_backend_status == BEST_CONNECTED) |
if (xennet_xenbus_resume(sc) == 0) |
break; |
|
if (xennet_talk_to_backend(sc) == 0) |
|
xenbus_switch_state(sc->sc_xbusd, NULL, |
xenbus_switch_state(sc->sc_xbusd, NULL, |
XenbusStateConnected); |
XenbusStateConnected); |
break; |
break; |
|
|
} |
} |
MGETHDR(m, M_DONTWAIT, MT_DATA); |
MGETHDR(m, M_DONTWAIT, MT_DATA); |
if (__predict_false(m == NULL)) { |
if (__predict_false(m == NULL)) { |
printf("%s: rx no mbuf\n", ifp->if_xname); |
aprint_error_ifnet(ifp, "rx no mbuf\n"); |
ifp->if_ierrors++; |
ifp->if_ierrors++; |
xennet_rx_mbuf_free(NULL, (void *)va, PAGE_SIZE, req); |
xennet_rx_mbuf_free(NULL, (void *)va, PAGE_SIZE, req); |
continue; |
continue; |