xref: /linux/drivers/usb/gadget/function/u_ncm.h (revision aea7c84f28f1117653f7443806905d7aeef13ba8)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * u_ncm.h
4  *
5  * Utility definitions for the ncm function
6  *
7  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
8  *		http://www.samsung.com
9  *
10  * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
11  */
12 
13 #ifndef U_NCM_H
14 #define U_NCM_H
15 
16 #include <linux/usb/composite.h>
17 
18 /**
19  * struct f_ncm_opts - NCM function options
20  * @func_inst: USB function instance.
21  * @net: The net_device associated with the NCM function.
22  * @bind_count: Tracks the number of configurations the NCM function is
23  *              bound to, preventing double-registration of the @net device.
24  * @ncm_interf_group: ConfigFS group for NCM interface.
25  * @ncm_os_desc: USB OS descriptor for NCM.
26  * @ncm_ext_compat_id: Extended compatibility ID.
27  * @lock: Protects the data from concurrent access by configfs read/write
28  *        and create symlink/remove symlink operations.
29  * @refcnt: Reference counter for the function instance.
30  * @max_segment_size: Maximum segment size.
31  */
32 struct f_ncm_opts {
33 	struct usb_function_instance	func_inst;
34 	struct net_device		*net;
35 	int				bind_count;
36 
37 	struct config_group		*ncm_interf_group;
38 	struct usb_os_desc		ncm_os_desc;
39 	char				ncm_ext_compat_id[16];
40 
41 	struct mutex			lock;
42 	int				refcnt;
43 
44 	u16				max_segment_size;
45 };
46 
47 #endif /* U_NCM_H */
48