Browse Source

[ncm] Support setting MAC address

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
79443785cd
2 changed files with 14 additions and 0 deletions
  1. 9
    0
      src/drivers/net/ncm.c
  2. 5
    0
      src/drivers/net/ncm.h

+ 9
- 0
src/drivers/net/ncm.c View File

@@ -453,6 +453,15 @@ static int ncm_open ( struct net_device *netdev ) {
453 453
 		goto err_set_ntb_input_size;
454 454
 	}
455 455
 
456
+	/* Set MAC address */
457
+	if ( ( rc = usb_control ( usb, NCM_SET_NET_ADDRESS, 0,
458
+				  ncm->usbnet.comms, netdev->ll_addr,
459
+				  netdev->ll_protocol->ll_addr_len ) ) != 0 ) {
460
+		DBGC ( ncm, "NCM %p could not set MAC address: %s\n",
461
+		       ncm, strerror ( rc ) );
462
+		/* Ignore error and continue */
463
+	}
464
+
456 465
 	/* Open USB network device */
457 466
 	if ( ( rc = usbnet_open ( &ncm->usbnet ) ) != 0 ) {
458 467
 		DBGC ( ncm, "NCM %p could not open: %s\n",

+ 5
- 0
src/drivers/net/ncm.h View File

@@ -51,6 +51,11 @@ struct ncm_ntb_parameters {
51 51
 	uint16_t max;
52 52
 } __attribute__ (( packed ));
53 53
 
54
+/** Set MAC address */
55
+#define NCM_SET_NET_ADDRESS						\
56
+	( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE |		\
57
+	  USB_REQUEST_TYPE ( 0x82 ) )
58
+
54 59
 /** Set NTB input size */
55 60
 #define NCM_SET_NTB_INPUT_SIZE						\
56 61
 	( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE |		\

Loading…
Cancel
Save