Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c261344d authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller
Browse files

usbnet: use eth%d name for known ethernet devices



The documentation for the USB ethernet devices suggests that
only some devices are supposed to use usb0 as the network interface
name instead of eth0. The logic used there, and documented in
Kconfig for CDC is that eth0 will be used when the mac address
is a globally assigned one, but usb0 is used for the locally
managed range that is typically used on point-to-point links.

Unfortunately, this has caused a lot of pain on the smsc95xx
device that is used on the popular pandaboard without an
EEPROM to store the MAC address, which causes the driver to
call random_ether_address().

Obviously, there should be a proper MAC addressed assigned to
the device, and discussions are ongoing about how to solve
this, but this patch at least makes sure that the default
interface naming gets a little saner and matches what the
user can expect based on the documentation, including for
new devices.

The approach taken here is to flag whether a device might be a
point-to-point link with the new FLAG_POINTTOPOINT setting in
the usbnet driver_info. A driver can set both FLAG_POINTTOPOINT
and FLAG_ETHER if it is not sure (e.g. cdc_ether), or just one
of the two.  The usbnet framework only looks at the MAC address
for device naming if both flags are set, otherwise it trusts the
flag.

Signed-off-by: default avatarArnd Bergmann <arnd.bergmann@linaro.org>
Tested-by: default avatarAndy Green <andy.green@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1591cb60
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -340,7 +340,7 @@ next:

static const struct driver_info eem_info = {
	.description =	"CDC EEM Device",
	.flags =	FLAG_ETHER,
	.flags =	FLAG_ETHER | FLAG_POINTTOPOINT,
	.bind =		eem_bind,
	.rx_fixup =	eem_rx_fixup,
	.tx_fixup =	eem_tx_fixup,
+1 −1
Original line number Diff line number Diff line
@@ -452,7 +452,7 @@ static int cdc_manage_power(struct usbnet *dev, int on)

static const struct driver_info	cdc_info = {
	.description =	"CDC Ethernet Device",
	.flags =	FLAG_ETHER,
	.flags =	FLAG_ETHER | FLAG_POINTTOPOINT,
	// .check_connect = cdc_check_connect,
	.bind =		usbnet_cdc_bind,
	.unbind =	usbnet_cdc_unbind,
+1 −1
Original line number Diff line number Diff line
@@ -1237,7 +1237,7 @@ static int cdc_ncm_manage_power(struct usbnet *dev, int status)

static const struct driver_info cdc_ncm_info = {
	.description = "CDC NCM",
	.flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET,
	.flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET,
	.bind = cdc_ncm_bind,
	.unbind = cdc_ncm_unbind,
	.check_connect = cdc_ncm_check_connect,
+8 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ static int always_connected (struct usbnet *dev)

static const struct driver_info	ali_m5632_info = {
	.description =	"ALi M5632",
	.flags       = FLAG_POINTTOPOINT,
};

#endif
@@ -110,6 +111,7 @@ static const struct driver_info ali_m5632_info = {

static const struct driver_info	an2720_info = {
	.description =	"AnchorChips/Cypress 2720",
	.flags       = FLAG_POINTTOPOINT,
	// no reset available!
	// no check_connect available!

@@ -132,6 +134,7 @@ static const struct driver_info an2720_info = {

static const struct driver_info	belkin_info = {
	.description =	"Belkin, eTEK, or compatible",
	.flags       = FLAG_POINTTOPOINT,
};

#endif	/* CONFIG_USB_BELKIN */
@@ -157,6 +160,7 @@ static const struct driver_info belkin_info = {
static const struct driver_info	epson2888_info = {
	.description =	"Epson USB Device",
	.check_connect = always_connected,
	.flags = FLAG_POINTTOPOINT,

	.in = 4, .out = 3,
};
@@ -173,6 +177,7 @@ static const struct driver_info epson2888_info = {
#define HAVE_HARDWARE
static const struct driver_info kc2190_info = {
	.description =  "KC Technology KC-190",
	.flags = FLAG_POINTTOPOINT,
};
#endif /* CONFIG_USB_KC2190 */

@@ -200,16 +205,19 @@ static const struct driver_info kc2190_info = {
static const struct driver_info	linuxdev_info = {
	.description =	"Linux Device",
	.check_connect = always_connected,
	.flags = FLAG_POINTTOPOINT,
};

static const struct driver_info	yopy_info = {
	.description =	"Yopy",
	.check_connect = always_connected,
	.flags = FLAG_POINTTOPOINT,
};

static const struct driver_info	blob_info = {
	.description =	"Boot Loader OBject",
	.check_connect = always_connected,
	.flags = FLAG_POINTTOPOINT,
};

#endif	/* CONFIG_USB_ARMLINUX */
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ static int genelink_bind(struct usbnet *dev, struct usb_interface *intf)

static const struct driver_info	genelink_info = {
	.description =	"Genesys GeneLink",
	.flags =	FLAG_FRAMING_GL | FLAG_NO_SETINT,
	.flags =	FLAG_POINTTOPOINT | FLAG_FRAMING_GL | FLAG_NO_SETINT,
	.bind =		genelink_bind,
	.rx_fixup =	genelink_rx_fixup,
	.tx_fixup =	genelink_tx_fixup,
Loading