diff options
Diffstat (limited to 'drivers/usb/gadget/u_ether.h')
-rw-r--r-- | drivers/usb/gadget/u_ether.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/drivers/usb/gadget/u_ether.h b/drivers/usb/gadget/u_ether.h index 02f58acdd5e9..d74b8f7214a4 100644 --- a/drivers/usb/gadget/u_ether.h +++ b/drivers/usb/gadget/u_ether.h | |||
@@ -115,6 +115,129 @@ static inline struct eth_dev *gether_setup(struct usb_gadget *g, | |||
115 | return gether_setup_name(g, dev_addr, host_addr, ethaddr, qmult, "usb"); | 115 | return gether_setup_name(g, dev_addr, host_addr, ethaddr, qmult, "usb"); |
116 | } | 116 | } |
117 | 117 | ||
118 | /* | ||
119 | * variant of gether_setup_default that allows customizing | ||
120 | * network device name | ||
121 | */ | ||
122 | struct net_device *gether_setup_name_default(const char *netname); | ||
123 | |||
124 | /* | ||
125 | * gether_register_netdev - register the net device | ||
126 | * @net: net device to register | ||
127 | * | ||
128 | * Registers the net device associated with this ethernet-over-usb link | ||
129 | * | ||
130 | */ | ||
131 | int gether_register_netdev(struct net_device *net); | ||
132 | |||
133 | /* gether_setup_default - initialize one ethernet-over-usb link | ||
134 | * Context: may sleep | ||
135 | * | ||
136 | * This sets up the single network link that may be exported by a | ||
137 | * gadget driver using this framework. The link layer addresses | ||
138 | * are set to random values. | ||
139 | * | ||
140 | * Returns negative errno, or zero on success | ||
141 | */ | ||
142 | static inline struct net_device *gether_setup_default(void) | ||
143 | { | ||
144 | return gether_setup_name_default("usb"); | ||
145 | } | ||
146 | |||
147 | /** | ||
148 | * gether_set_gadget - initialize one ethernet-over-usb link with a gadget | ||
149 | * @net: device representing this link | ||
150 | * @g: the gadget to initialize with | ||
151 | * | ||
152 | * This associates one ethernet-over-usb link with a gadget. | ||
153 | */ | ||
154 | void gether_set_gadget(struct net_device *net, struct usb_gadget *g); | ||
155 | |||
156 | /** | ||
157 | * gether_set_dev_addr - initialize an ethernet-over-usb link with eth address | ||
158 | * @net: device representing this link | ||
159 | * @dev_addr: eth address of this device | ||
160 | * | ||
161 | * This sets the device-side Ethernet address of this ethernet-over-usb link | ||
162 | * if dev_addr is correct. | ||
163 | * Returns negative errno if the new address is incorrect. | ||
164 | */ | ||
165 | int gether_set_dev_addr(struct net_device *net, const char *dev_addr); | ||
166 | |||
167 | /** | ||
168 | * gether_get_dev_addr - get an ethernet-over-usb link eth address | ||
169 | * @net: device representing this link | ||
170 | * @dev_addr: place to store device's eth address | ||
171 | * @len: length of the @dev_addr buffer | ||
172 | * | ||
173 | * This gets the device-side Ethernet address of this ethernet-over-usb link. | ||
174 | * Returns zero on success, else negative errno. | ||
175 | */ | ||
176 | int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len); | ||
177 | |||
178 | /** | ||
179 | * gether_set_host_addr - initialize an ethernet-over-usb link with host address | ||
180 | * @net: device representing this link | ||
181 | * @host_addr: eth address of the host | ||
182 | * | ||
183 | * This sets the host-side Ethernet address of this ethernet-over-usb link | ||
184 | * if host_addr is correct. | ||
185 | * Returns negative errno if the new address is incorrect. | ||
186 | */ | ||
187 | int gether_set_host_addr(struct net_device *net, const char *host_addr); | ||
188 | |||
189 | /** | ||
190 | * gether_get_host_addr - get an ethernet-over-usb link host address | ||
191 | * @net: device representing this link | ||
192 | * @host_addr: place to store eth address of the host | ||
193 | * @len: length of the @host_addr buffer | ||
194 | * | ||
195 | * This gets the host-side Ethernet address of this ethernet-over-usb link. | ||
196 | * Returns zero on success, else negative errno. | ||
197 | */ | ||
198 | int gether_get_host_addr(struct net_device *net, char *host_addr, int len); | ||
199 | |||
200 | /** | ||
201 | * gether_get_host_addr_cdc - get an ethernet-over-usb link host address | ||
202 | * @net: device representing this link | ||
203 | * @host_addr: place to store eth address of the host | ||
204 | * @len: length of the @host_addr buffer | ||
205 | * | ||
206 | * This gets the CDC formatted host-side Ethernet address of this | ||
207 | * ethernet-over-usb link. | ||
208 | * Returns zero on success, else negative errno. | ||
209 | */ | ||
210 | int gether_get_host_addr_cdc(struct net_device *net, char *host_addr, int len); | ||
211 | |||
212 | /** | ||
213 | * gether_set_qmult - initialize an ethernet-over-usb link with a multiplier | ||
214 | * @net: device representing this link | ||
215 | * @qmult: queue multiplier | ||
216 | * | ||
217 | * This sets the queue length multiplier of this ethernet-over-usb link. | ||
218 | * For higher speeds use longer queues. | ||
219 | */ | ||
220 | void gether_set_qmult(struct net_device *net, unsigned qmult); | ||
221 | |||
222 | /** | ||
223 | * gether_get_qmult - get an ethernet-over-usb link multiplier | ||
224 | * @net: device representing this link | ||
225 | * | ||
226 | * This gets the queue length multiplier of this ethernet-over-usb link. | ||
227 | */ | ||
228 | unsigned gether_get_qmult(struct net_device *net); | ||
229 | |||
230 | /** | ||
231 | * gether_get_ifname - get an ethernet-over-usb link interface name | ||
232 | * @net: device representing this link | ||
233 | * @name: place to store the interface name | ||
234 | * @len: length of the @name buffer | ||
235 | * | ||
236 | * This gets the interface name of this ethernet-over-usb link. | ||
237 | * Returns zero on success, else negative errno. | ||
238 | */ | ||
239 | int gether_get_ifname(struct net_device *net, char *name, int len); | ||
240 | |||
118 | void gether_cleanup(struct eth_dev *dev); | 241 | void gether_cleanup(struct eth_dev *dev); |
119 | 242 | ||
120 | /* connect/disconnect is handled by individual functions */ | 243 | /* connect/disconnect is handled by individual functions */ |