Commit cbbd14a9 authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Felipe Balbi

usb: gadget: rndis: convert into module

In order to convert to configfs the usb functions need to be converted
to a new interface and compiled as modules. This patch creates an rndis
module which will be used by the new functions. After all users of
f_rndis are converted to the new interface, this module can be
merged with f_rndis module.
Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent f1a1823f
...@@ -502,6 +502,9 @@ config USB_U_SERIAL ...@@ -502,6 +502,9 @@ config USB_U_SERIAL
config USB_U_ETHER config USB_U_ETHER
tristate tristate
config USB_U_RNDIS
tristate
config USB_F_SERIAL config USB_F_SERIAL
tristate tristate
...@@ -599,6 +602,7 @@ config USB_ETH ...@@ -599,6 +602,7 @@ config USB_ETH
depends on NET depends on NET
select USB_LIBCOMPOSITE select USB_LIBCOMPOSITE
select USB_U_ETHER select USB_U_ETHER
select USB_U_RNDIS
select CRC32 select CRC32
help help
This driver implements Ethernet style communication, in one of This driver implements Ethernet style communication, in one of
...@@ -724,6 +728,7 @@ config USB_FUNCTIONFS_RNDIS ...@@ -724,6 +728,7 @@ config USB_FUNCTIONFS_RNDIS
bool "Include configuration with RNDIS (Ethernet)" bool "Include configuration with RNDIS (Ethernet)"
depends on USB_FUNCTIONFS && NET depends on USB_FUNCTIONFS && NET
select USB_U_ETHER select USB_U_ETHER
select USB_U_RNDIS
help help
Include a configuration with RNDIS function (Ethernet) and the Filesystem. Include a configuration with RNDIS function (Ethernet) and the Filesystem.
...@@ -871,6 +876,7 @@ config USB_G_MULTI ...@@ -871,6 +876,7 @@ config USB_G_MULTI
select USB_LIBCOMPOSITE select USB_LIBCOMPOSITE
select USB_U_SERIAL select USB_U_SERIAL
select USB_U_ETHER select USB_U_ETHER
select USB_U_RNDIS
select USB_F_ACM select USB_F_ACM
help help
The Multifunction Composite Gadget provides Ethernet (RNDIS The Multifunction Composite Gadget provides Ethernet (RNDIS
......
...@@ -46,6 +46,8 @@ obj-$(CONFIG_USB_F_SERIAL) += usb_f_serial.o ...@@ -46,6 +46,8 @@ obj-$(CONFIG_USB_F_SERIAL) += usb_f_serial.o
usb_f_obex-y := f_obex.o usb_f_obex-y := f_obex.o
obj-$(CONFIG_USB_F_OBEX) += usb_f_obex.o obj-$(CONFIG_USB_F_OBEX) += usb_f_obex.o
obj-$(CONFIG_USB_U_ETHER) += u_ether.o obj-$(CONFIG_USB_U_ETHER) += u_ether.o
u_rndis-y := rndis.o
obj-$(CONFIG_USB_U_RNDIS) += u_rndis.o
# #
# USB gadget drivers # USB gadget drivers
......
...@@ -91,6 +91,8 @@ static inline bool has_rndis(void) ...@@ -91,6 +91,8 @@ static inline bool has_rndis(void)
#endif #endif
} }
#include <linux/module.h>
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* /*
...@@ -104,7 +106,7 @@ static inline bool has_rndis(void) ...@@ -104,7 +106,7 @@ static inline bool has_rndis(void)
#include "f_subset.c" #include "f_subset.c"
#ifdef USB_ETH_RNDIS #ifdef USB_ETH_RNDIS
#include "f_rndis.c" #include "f_rndis.c"
#include "rndis.c" #include "rndis.h"
#endif #endif
#include "f_eem.c" #include "f_eem.c"
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
# include "f_subset.c" # include "f_subset.c"
# ifdef USB_ETH_RNDIS # ifdef USB_ETH_RNDIS
# include "f_rndis.c" # include "f_rndis.c"
# include "rndis.c" # include "rndis.h"
# endif # endif
# include "u_ether.h" # include "u_ether.h"
......
...@@ -47,7 +47,7 @@ MODULE_LICENSE("GPL"); ...@@ -47,7 +47,7 @@ MODULE_LICENSE("GPL");
#include "f_subset.c" #include "f_subset.c"
#ifdef USB_ETH_RNDIS #ifdef USB_ETH_RNDIS
# include "f_rndis.c" # include "f_rndis.c"
# include "rndis.c" # include "rndis.h"
#endif #endif
#include "u_ether.h" #include "u_ether.h"
......
...@@ -761,6 +761,7 @@ int rndis_signal_connect(int configNr) ...@@ -761,6 +761,7 @@ int rndis_signal_connect(int configNr)
return rndis_indicate_status_msg(configNr, return rndis_indicate_status_msg(configNr,
RNDIS_STATUS_MEDIA_CONNECT); RNDIS_STATUS_MEDIA_CONNECT);
} }
EXPORT_SYMBOL(rndis_signal_connect);
int rndis_signal_disconnect(int configNr) int rndis_signal_disconnect(int configNr)
{ {
...@@ -769,6 +770,7 @@ int rndis_signal_disconnect(int configNr) ...@@ -769,6 +770,7 @@ int rndis_signal_disconnect(int configNr)
return rndis_indicate_status_msg(configNr, return rndis_indicate_status_msg(configNr,
RNDIS_STATUS_MEDIA_DISCONNECT); RNDIS_STATUS_MEDIA_DISCONNECT);
} }
EXPORT_SYMBOL(rndis_signal_disconnect);
void rndis_uninit(int configNr) void rndis_uninit(int configNr)
{ {
...@@ -783,11 +785,13 @@ void rndis_uninit(int configNr) ...@@ -783,11 +785,13 @@ void rndis_uninit(int configNr)
while ((buf = rndis_get_next_response(configNr, &length))) while ((buf = rndis_get_next_response(configNr, &length)))
rndis_free_response(configNr, buf); rndis_free_response(configNr, buf);
} }
EXPORT_SYMBOL(rndis_uninit);
void rndis_set_host_mac(int configNr, const u8 *addr) void rndis_set_host_mac(int configNr, const u8 *addr)
{ {
rndis_per_dev_params[configNr].host_mac = addr; rndis_per_dev_params[configNr].host_mac = addr;
} }
EXPORT_SYMBOL(rndis_set_host_mac);
/* /*
* Message Parser * Message Parser
...@@ -870,6 +874,7 @@ int rndis_msg_parser(u8 configNr, u8 *buf) ...@@ -870,6 +874,7 @@ int rndis_msg_parser(u8 configNr, u8 *buf)
return -ENOTSUPP; return -ENOTSUPP;
} }
EXPORT_SYMBOL(rndis_msg_parser);
int rndis_register(void (*resp_avail)(void *v), void *v) int rndis_register(void (*resp_avail)(void *v), void *v)
{ {
...@@ -891,6 +896,7 @@ int rndis_register(void (*resp_avail)(void *v), void *v) ...@@ -891,6 +896,7 @@ int rndis_register(void (*resp_avail)(void *v), void *v)
return -ENODEV; return -ENODEV;
} }
EXPORT_SYMBOL(rndis_register);
void rndis_deregister(int configNr) void rndis_deregister(int configNr)
{ {
...@@ -899,6 +905,7 @@ void rndis_deregister(int configNr) ...@@ -899,6 +905,7 @@ void rndis_deregister(int configNr)
if (configNr >= RNDIS_MAX_CONFIGS) return; if (configNr >= RNDIS_MAX_CONFIGS) return;
rndis_per_dev_params[configNr].used = 0; rndis_per_dev_params[configNr].used = 0;
} }
EXPORT_SYMBOL(rndis_deregister);
int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter) int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter)
{ {
...@@ -912,6 +919,7 @@ int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter) ...@@ -912,6 +919,7 @@ int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter)
return 0; return 0;
} }
EXPORT_SYMBOL(rndis_set_param_dev);
int rndis_set_param_vendor(u8 configNr, u32 vendorID, const char *vendorDescr) int rndis_set_param_vendor(u8 configNr, u32 vendorID, const char *vendorDescr)
{ {
...@@ -924,6 +932,7 @@ int rndis_set_param_vendor(u8 configNr, u32 vendorID, const char *vendorDescr) ...@@ -924,6 +932,7 @@ int rndis_set_param_vendor(u8 configNr, u32 vendorID, const char *vendorDescr)
return 0; return 0;
} }
EXPORT_SYMBOL(rndis_set_param_vendor);
int rndis_set_param_medium(u8 configNr, u32 medium, u32 speed) int rndis_set_param_medium(u8 configNr, u32 medium, u32 speed)
{ {
...@@ -935,6 +944,7 @@ int rndis_set_param_medium(u8 configNr, u32 medium, u32 speed) ...@@ -935,6 +944,7 @@ int rndis_set_param_medium(u8 configNr, u32 medium, u32 speed)
return 0; return 0;
} }
EXPORT_SYMBOL(rndis_set_param_medium);
void rndis_add_hdr(struct sk_buff *skb) void rndis_add_hdr(struct sk_buff *skb)
{ {
...@@ -949,6 +959,7 @@ void rndis_add_hdr(struct sk_buff *skb) ...@@ -949,6 +959,7 @@ void rndis_add_hdr(struct sk_buff *skb)
header->DataOffset = cpu_to_le32(36); header->DataOffset = cpu_to_le32(36);
header->DataLength = cpu_to_le32(skb->len - sizeof(*header)); header->DataLength = cpu_to_le32(skb->len - sizeof(*header));
} }
EXPORT_SYMBOL(rndis_add_hdr);
void rndis_free_response(int configNr, u8 *buf) void rndis_free_response(int configNr, u8 *buf)
{ {
...@@ -965,6 +976,7 @@ void rndis_free_response(int configNr, u8 *buf) ...@@ -965,6 +976,7 @@ void rndis_free_response(int configNr, u8 *buf)
} }
} }
} }
EXPORT_SYMBOL(rndis_free_response);
u8 *rndis_get_next_response(int configNr, u32 *length) u8 *rndis_get_next_response(int configNr, u32 *length)
{ {
...@@ -986,6 +998,7 @@ u8 *rndis_get_next_response(int configNr, u32 *length) ...@@ -986,6 +998,7 @@ u8 *rndis_get_next_response(int configNr, u32 *length)
return NULL; return NULL;
} }
EXPORT_SYMBOL(rndis_get_next_response);
static rndis_resp_t *rndis_add_response(int configNr, u32 length) static rndis_resp_t *rndis_add_response(int configNr, u32 length)
{ {
...@@ -1029,6 +1042,7 @@ int rndis_rm_hdr(struct gether *port, ...@@ -1029,6 +1042,7 @@ int rndis_rm_hdr(struct gether *port,
skb_queue_tail(list, skb); skb_queue_tail(list, skb);
return 0; return 0;
} }
EXPORT_SYMBOL(rndis_rm_hdr);
#ifdef CONFIG_USB_GADGET_DEBUG_FILES #ifdef CONFIG_USB_GADGET_DEBUG_FILES
...@@ -1160,6 +1174,7 @@ int rndis_init(void) ...@@ -1160,6 +1174,7 @@ int rndis_init(void)
return 0; return 0;
} }
EXPORT_SYMBOL(rndis_init);
void rndis_exit(void) void rndis_exit(void)
{ {
...@@ -1173,3 +1188,6 @@ void rndis_exit(void) ...@@ -1173,3 +1188,6 @@ void rndis_exit(void)
} }
#endif #endif
} }
EXPORT_SYMBOL(rndis_exit);
MODULE_LICENSE("GPL");
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define _LINUX_RNDIS_H #define _LINUX_RNDIS_H
#include <linux/rndis.h> #include <linux/rndis.h>
#include "u_ether.h"
#include "ndis.h" #include "ndis.h"
#define RNDIS_MAXIMUM_FRAME_SIZE 1518 #define RNDIS_MAXIMUM_FRAME_SIZE 1518
......
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