summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-09-14 12:41:09 +0000
committermpi <mpi@openbsd.org>2016-09-14 12:41:09 +0000
commit37962954086cf35e1c9f727ea1698b2b4e9073fd (patch)
tree439eba762511c36da13d3822015296755fcb8e56
parenttidy running those commands (diff)
downloadwireguard-openbsd-37962954086cf35e1c9f727ea1698b2b4e9073fd.tar.xz
wireguard-openbsd-37962954086cf35e1c9f727ea1698b2b4e9073fd.zip
Always set the MAC address when initializing the chip.
Make "# ifconfig axen0 lladdr" work. ok stsp@, dlg@
-rw-r--r--sys/dev/usb/if_axen.c13
-rw-r--r--sys/dev/usb/if_axenreg.h3
2 files changed, 11 insertions, 5 deletions
diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c
index 9267f2e4128..fbb41717166 100644
--- a/sys/dev/usb/if_axen.c
+++ b/sys/dev/usb/if_axen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_axen.c,v 1.22 2016/04/13 11:03:37 mpi Exp $ */
+/* $OpenBSD: if_axen.c,v 1.23 2016/09/14 12:41:09 mpi Exp $ */
/*
* Copyright (c) 2013 Yojiro UO <yuo@openbsd.org>
@@ -499,6 +499,10 @@ axen_ax88179_init(struct axen_softc *sc)
}
axen_cmd(sc, AXEN_CMD_MAC_SET_RXSR, 5, AXEN_RX_BULKIN_QCTRL, &qctrl);
+ /* Set MAC address. */
+ axen_cmd(sc, AXEN_CMD_MAC_WRITE_ETHER, ETHER_ADDR_LEN,
+ AXEN_CMD_MAC_NODE_ID, &sc->arpcom.ac_enaddr);
+
/*
* set buffer high/low watermark to pause/resume.
* write 2byte will set high/log simultaneous with AXEN_PAUSE_HIGH.
@@ -662,11 +666,10 @@ axen_attach(struct device *parent, struct device *self, void *aux)
*/
/* use MAC command */
axen_lock_mii(sc);
- axen_cmd(sc, AXEN_CMD_MAC_READ_ETHER, 6, AXEN_CMD_MAC_NODE_ID, &eaddr);
+ axen_cmd(sc, AXEN_CMD_MAC_READ_ETHER, ETHER_ADDR_LEN,
+ AXEN_CMD_MAC_NODE_ID, &eaddr);
axen_unlock_mii(sc);
- axen_ax88179_init(sc);
-
/*
* An ASIX chip was detected. Inform the world.
*/
@@ -679,6 +682,8 @@ axen_attach(struct device *parent, struct device *self, void *aux)
bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
+ axen_ax88179_init(sc);
+
/* Initialize interface info. */
ifp = &sc->arpcom.ac_if;
ifp->if_softc = sc;
diff --git a/sys/dev/usb/if_axenreg.h b/sys/dev/usb/if_axenreg.h
index 13c9f2ec540..8de2c6d5097 100644
--- a/sys/dev/usb/if_axenreg.h
+++ b/sys/dev/usb/if_axenreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_axenreg.h,v 1.5 2015/07/16 00:17:40 yuo Exp $ */
+/* $OpenBSD: if_axenreg.h,v 1.6 2016/09/14 12:41:09 mpi Exp $ */
/*
* Copyright (c) 2013 Yojiro UO <yuo@openbsd.org>. All right reserved.
@@ -182,6 +182,7 @@
/* 6byte cmd */
#define AXEN_CMD_MAC_READ_ETHER 0x6001
+#define AXEN_CMD_MAC_WRITE_ETHER 0x6101
#define AXEN_CMD_MAC_NODE_ID 0x10
/* 8byte cmd */