Commit 1fbfeff9 authored by Benoit Goby's avatar Benoit Goby Committed by Greg Kroah-Hartman

usb: gadget: f_rndis: Set rndis vendor parameters

Add a variant of rndis_bind_config to let gadget drivers change
rndis vendorID and manufacturer parameters.
Signed-off-by: default avatarBenoit Goby <benoit@android.com>
	[make rndis_bind_config a static inline function]
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 80134da9
...@@ -71,6 +71,8 @@ struct f_rndis { ...@@ -71,6 +71,8 @@ struct f_rndis {
struct gether port; struct gether port;
u8 ctrl_id, data_id; u8 ctrl_id, data_id;
u8 ethaddr[ETH_ALEN]; u8 ethaddr[ETH_ALEN];
u32 vendorID;
const char *manufacturer;
int config; int config;
struct usb_ep *notify; struct usb_ep *notify;
...@@ -768,12 +770,10 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -768,12 +770,10 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
rndis_set_param_medium(rndis->config, NDIS_MEDIUM_802_3, 0); rndis_set_param_medium(rndis->config, NDIS_MEDIUM_802_3, 0);
rndis_set_host_mac(rndis->config, rndis->ethaddr); rndis_set_host_mac(rndis->config, rndis->ethaddr);
#if 0 if (rndis->manufacturer && rndis->vendorID &&
// FIXME rndis_set_param_vendor(rndis->config, rndis->vendorID,
if (rndis_set_param_vendor(rndis->config, vendorID, rndis->manufacturer))
manufacturer)) goto fail;
goto fail0;
#endif
/* NOTE: all that is done without knowing or caring about /* NOTE: all that is done without knowing or caring about
* the network link ... which is unavailable to this code * the network link ... which is unavailable to this code
...@@ -841,20 +841,9 @@ static inline bool can_support_rndis(struct usb_configuration *c) ...@@ -841,20 +841,9 @@ static inline bool can_support_rndis(struct usb_configuration *c)
return true; return true;
} }
/**
* rndis_bind_config - add RNDIS network link to a configuration
* @c: the configuration to support the network link
* @ethaddr: a buffer in which the ethernet address of the host side
* side of the link was recorded
* Context: single threaded during gadget setup
*
* Returns zero on success, else negative errno.
*
* Caller must have called @gether_setup(). Caller is also responsible
* for calling @gether_cleanup() before module unload.
*/
int int
rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) rndis_bind_config_vendor(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
u32 vendorID, const char *manufacturer)
{ {
struct f_rndis *rndis; struct f_rndis *rndis;
int status; int status;
...@@ -899,6 +888,8 @@ rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) ...@@ -899,6 +888,8 @@ rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN])
goto fail; goto fail;
memcpy(rndis->ethaddr, ethaddr, ETH_ALEN); memcpy(rndis->ethaddr, ethaddr, ETH_ALEN);
rndis->vendorID = vendorID;
rndis->manufacturer = manufacturer;
/* RNDIS activates when the host changes this filter */ /* RNDIS activates when the host changes this filter */
rndis->port.cdc_filter = 0; rndis->port.cdc_filter = 0;
......
...@@ -118,16 +118,37 @@ int eem_bind_config(struct usb_configuration *c); ...@@ -118,16 +118,37 @@ int eem_bind_config(struct usb_configuration *c);
#ifdef USB_ETH_RNDIS #ifdef USB_ETH_RNDIS
int rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); int rndis_bind_config_vendor(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
u32 vendorID, const char *manufacturer);
#else #else
static inline int static inline int
rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) rndis_bind_config_vendor(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
u32 vendorID, const char *manufacturer)
{ {
return 0; return 0;
} }
#endif #endif
/**
* rndis_bind_config - add RNDIS network link to a configuration
* @c: the configuration to support the network link
* @ethaddr: a buffer in which the ethernet address of the host side
* side of the link was recorded
* Context: single threaded during gadget setup
*
* Returns zero on success, else negative errno.
*
* Caller must have called @gether_setup(). Caller is also responsible
* for calling @gether_cleanup() before module unload.
*/
static inline int rndis_bind_config(struct usb_configuration *c,
u8 ethaddr[ETH_ALEN])
{
return rndis_bind_config_vendor(c, ethaddr, 0, NULL);
}
#endif /* __U_ETHER_H */ #endif /* __U_ETHER_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment