]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[ncm] Support setting MAC address
authorMichael Brown <mcb30@ipxe.org>
Mon, 14 Sep 2015 21:45:56 +0000 (22:45 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 14 Sep 2015 21:45:56 +0000 (22:45 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/ncm.c
src/drivers/net/ncm.h

index afa794ea352cccabecf03a45e2162deeaf9e3162..fed77a00f4f4e950c54ab7745bcbe5fb00fb9329 100644 (file)
@@ -453,6 +453,15 @@ static int ncm_open ( struct net_device *netdev ) {
                goto err_set_ntb_input_size;
        }
 
+       /* Set MAC address */
+       if ( ( rc = usb_control ( usb, NCM_SET_NET_ADDRESS, 0,
+                                 ncm->usbnet.comms, netdev->ll_addr,
+                                 netdev->ll_protocol->ll_addr_len ) ) != 0 ) {
+               DBGC ( ncm, "NCM %p could not set MAC address: %s\n",
+                      ncm, strerror ( rc ) );
+               /* Ignore error and continue */
+       }
+
        /* Open USB network device */
        if ( ( rc = usbnet_open ( &ncm->usbnet ) ) != 0 ) {
                DBGC ( ncm, "NCM %p could not open: %s\n",
index a9565a56b5a7e6ea745f29e543a3410b63182d16..6b0d21cdbc1e0398e41953a9fd47098f34887646 100644 (file)
@@ -51,6 +51,11 @@ struct ncm_ntb_parameters {
        uint16_t max;
 } __attribute__ (( packed ));
 
+/** Set MAC address */
+#define NCM_SET_NET_ADDRESS                                            \
+       ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE |          \
+         USB_REQUEST_TYPE ( 0x82 ) )
+
 /** Set NTB input size */
 #define NCM_SET_NTB_INPUT_SIZE                                         \
        ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE |          \