217
218
VMXNET_COMMAND_ADDR);
222
vxn_check_link(vxn_softc_t *sc)
227
status = bus_space_read_4(sc->vxn_iobtag, sc->vxn_iobhandle, VMXNET_STATUS_ADDR);
228
ok = (status & VMXNET_STATUS_CONNECTED) != 0;
233
*-----------------------------------------------------------------------------
235
* vxn_media_status --
237
* This routine is called when the user quries the status of interface
238
* using ifconfig. Checks link state and updates media state accorgingly.
246
*-----------------------------------------------------------------------------
250
vxn_media_status(struct ifnet * ifp, struct ifmediareq * ifmr)
252
vxn_softc_t *sc = ifp->if_softc;
255
VXN_LOCK((vxn_softc_t *)ifp->if_softc);
256
connected = vxn_check_link(sc);
258
ifmr->ifm_status = IFM_AVALID;
259
ifmr->ifm_active = IFM_ETHER;
262
ifmr->ifm_status &= ~IFM_ACTIVE;
263
VXN_UNLOCK((vxn_softc_t *)ifp->if_softc);
267
ifmr->ifm_status |= IFM_ACTIVE;
269
VXN_UNLOCK((vxn_softc_t *)ifp->if_softc);
275
*-----------------------------------------------------------------------------
277
* vxn_media_change --
279
* This routine is called when the user changes speed/duplex using
280
* media/mediopt option with ifconfig.
283
* Returns 0 for success, error code otherwise.
288
*-----------------------------------------------------------------------------
292
vxn_media_change(struct ifnet * ifp)
294
vxn_softc_t *sc = ifp->if_softc;
295
struct ifmedia *ifm = &sc->media;
297
if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
300
if (IFM_SUBTYPE(ifm->ifm_media) != IFM_AUTO)
301
printf("Media subtype is not AUTO, it is : %d.\n",
302
IFM_SUBTYPE(ifm->ifm_media));
221
309
*-----------------------------------------------------------------------------
393
481
* read the MAC address from the device
395
483
for (i = 0; i < 6; i++) {
396
mac[i] = bus_space_read_1(sc->vxn_iobtag, sc->vxn_iobhandle, VMXNET_MAC_ADDR + i);
484
mac[i] = bus_space_read_1(sc->vxn_iobtag, sc->vxn_iobhandle, VMXNET_MAC_ADDR
399
488
#ifdef VXN_NEEDARPCOM
414
503
sc->vxn_num_tx_bufs, (int)sizeof(Vmxnet2_TxRingEntry),
507
* Specify the media types supported by this adapter and register
508
* callbacks to update media and link information
510
ifmedia_init(&sc->media, IFM_IMASK, vxn_media_change,
512
ifmedia_add(&sc->media, IFM_ETHER | IFM_FDX, 0, NULL);
513
ifmedia_add(&sc->media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL);
514
ifmedia_add(&sc->media, IFM_ETHER | IFM_1000_T, 0, NULL);
515
ifmedia_add(&sc->media, IFM_ETHER | IFM_AUTO, 0, NULL);
516
ifmedia_set(&sc->media, IFM_ETHER | IFM_AUTO);
421
523
if (sc->vxn_intrhand != NULL) {
422
524
bus_teardown_intr(dev, sc->vxn_irq, sc->vxn_intrhand);
807
/* Get MAC address from interface and set it in hardware */
808
#if __FreeBSD_version >= 700000
809
printf("addrlen : %d. \n", ifp->if_addrlen);
810
bcopy(LLADDR((struct sockaddr_dl *)ifp->if_addr->ifa_addr), mac_addr,
811
ifp->if_addrlen > 6 ? 6 : ifp->if_addrlen);
813
if (!ifaddr_byindex(ifp->if_index)) {
814
printf("vxn:%d Invalid link address, interface index :%d.\n",
815
VXN_IF_UNIT(ifp), ifp->if_index);
817
bcopy(LLADDR((struct sockaddr_dl *)ifaddr_byindex(ifp->if_index)->ifa_addr),
818
mac_addr, ifp->if_addrlen);
821
printf("vxn%d: MAC Address : %02x:%02x:%02x:%02x:%02x:%02x \n",
822
VXN_IF_UNIT(ifp), mac_addr[0], mac_addr[1], mac_addr[2],
823
mac_addr[3], mac_addr[4], mac_addr[5]);
824
for (i = 0; i < 6; i++) {
825
bus_space_write_1(sc->vxn_iobtag, sc->vxn_iobhandle, VMXNET_MAC_ADDR +