summaryrefslogtreecommitdiff
path: root/Documentation/devicetree/bindings/usb/usb-device.txt
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2021-01-14 08:42:22 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-15 16:08:53 +0100
commit63d152149b2d0860ccf8c4e6596b6175b2b7ace6 (patch)
treeeee79cb5ac0a7495f1a4443a04d737e8c8b41b25 /Documentation/devicetree/bindings/usb/usb-device.txt
parentf08fc2c30e7806443143db16ac1457145d39b7dd (diff)
usb: gadget: u_ether: support configuring interface names.
This patch allows the administrator to configure the interface name of a function using u_ether (e.g., eem, ncm, rndis). Currently, all such interfaces, regardless of function type, are always called usb0, usb1, etc. This makes it very cumbersome to use more than one such type at a time, because userspace cannnot easily tell the interfaces apart and apply the right configuration to each one. Interface renaming in userspace based on driver doesn't help, because the interfaces all have the same driver. Without this patch, doing this require hacks/workarounds such as setting fixed MAC addresses on the functions, and then renaming by MAC address, or scraping configfs after each interface is created to find out what it is. Setting the interface name is done by writing to the same "ifname" configfs attribute that reports the interface name after the function is bound. The write must contain an interface pattern such as "usb%d" (which will cause the net core to pick the next available interface name starting with "usb"). This patch does not allow writing an exact interface name (as opposed to a pattern) because if the interface already exists at bind time, the bind will fail and the whole gadget will fail to activate. This could be allowed in a future patch. For compatibility with current userspace, when reading an ifname that has not currently been set, the result is still "(unnamed net_device)". Once a write to ifname happens, then reading ifname will return whatever was last written. Tested by configuring an rndis function and an ncm function on the same gadget, and writing "rndis%d" to ifname on the rndis function and "ncm%d" to ifname on the ncm function. When the gadget was bound, the rndis interface was rndis0 and the ncm interface was ncm0. Signed-off-by: Lorenzo Colitti <lorenzo@google.com> Link: https://lore.kernel.org/r/20210113234222.3272933-1-lorenzo@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation/devicetree/bindings/usb/usb-device.txt')
0 files changed, 0 insertions, 0 deletions