> On 13 Sep 2016, at 19:37, Martin Pieuchot <m...@openbsd.org> wrote:
> 
> Doing...
>       
>       # ifconfig axen0 lladdr bla
>       
> is currently broken because we don't update the MAC address in the
> driver, which makes the chip drop all the packets unless in promisc
> mode.
> 
> Diff below fixes that, ok?

ok

> 
> Index: if_axen.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/if_axen.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 if_axen.c
> --- if_axen.c 13 Apr 2016 11:03:37 -0000      1.22
> +++ if_axen.c 13 Sep 2016 09:35:14 -0000
> @@ -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, struc
>        */
>       /* 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.
>        */
> @@ -678,6 +681,8 @@ axen_attach(struct device *parent, struc
>       printf(", address %s\n", ether_sprintf(eaddr));
> 
>       bcopy(eaddr, (char *)&sc->arpcom.ac_enaddr, ETHER_ADDR_LEN);
> +
> +     axen_ax88179_init(sc);
> 
>       /* Initialize interface info. */
>       ifp = &sc->arpcom.ac_if;
> Index: if_axenreg.h
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/if_axenreg.h,v
> retrieving revision 1.5
> diff -u -p -r1.5 if_axenreg.h
> --- if_axenreg.h      16 Jul 2015 00:17:40 -0000      1.5
> +++ if_axenreg.h      13 Sep 2016 09:28:17 -0000
> @@ -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   */ 
> 

Reply via email to