summaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorMichael Brown2015-09-14 23:45:56 +0200
committerMichael Brown2015-09-14 23:45:56 +0200
commit79443785cd2ff6f458dddb6536db4cab8275b875 (patch)
tree6fb972a8963998a4571049287d3c109af8d7bf92 /src/drivers
parent[efi] Expose unused USB devices via EFI_USB_IO_PROTOCOL (diff)
downloadipxe-79443785cd2ff6f458dddb6536db4cab8275b875.tar.gz
ipxe-79443785cd2ff6f458dddb6536db4cab8275b875.tar.xz
ipxe-79443785cd2ff6f458dddb6536db4cab8275b875.zip
[ncm] Support setting MAC address
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/net/ncm.c9
-rw-r--r--src/drivers/net/ncm.h5
2 files changed, 14 insertions, 0 deletions
diff --git a/src/drivers/net/ncm.c b/src/drivers/net/ncm.c
index afa794ea3..fed77a00f 100644
--- a/src/drivers/net/ncm.c
+++ b/src/drivers/net/ncm.c
@@ -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",
diff --git a/src/drivers/net/ncm.h b/src/drivers/net/ncm.h
index a9565a56b..6b0d21cdb 100644
--- a/src/drivers/net/ncm.h
+++ b/src/drivers/net/ncm.h
@@ -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 | \