blob: 152beaafae1d1ff3092374e8de17775c9b0736b8 [file] [log] [blame]
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +00001/*
Sven Eckelmann64afe352011-01-27 10:38:15 +01002 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +00003 *
4 * Marek Lindner, Simon Wunderlich
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA
19 *
20 */
21
22#include "main.h"
23#include "soft-interface.h"
24#include "hard-interface.h"
25#include "routing.h"
26#include "send.h"
27#include "bat_debugfs.h"
28#include "translation-table.h"
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +000029#include "hash.h"
30#include "gateway_common.h"
31#include "gateway_client.h"
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +000032#include "bat_sysfs.h"
33#include <linux/slab.h>
34#include <linux/ethtool.h>
35#include <linux/etherdevice.h>
36#include <linux/if_vlan.h>
37#include "unicast.h"
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +000038
39
40static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
41static void bat_get_drvinfo(struct net_device *dev,
42 struct ethtool_drvinfo *info);
43static u32 bat_get_msglevel(struct net_device *dev);
44static void bat_set_msglevel(struct net_device *dev, u32 value);
45static u32 bat_get_link(struct net_device *dev);
46static u32 bat_get_rx_csum(struct net_device *dev);
47static int bat_set_rx_csum(struct net_device *dev, u32 data);
48
49static const struct ethtool_ops bat_ethtool_ops = {
50 .get_settings = bat_get_settings,
51 .get_drvinfo = bat_get_drvinfo,
52 .get_msglevel = bat_get_msglevel,
53 .set_msglevel = bat_set_msglevel,
54 .get_link = bat_get_link,
55 .get_rx_csum = bat_get_rx_csum,
56 .set_rx_csum = bat_set_rx_csum
57};
58
59int my_skb_head_push(struct sk_buff *skb, unsigned int len)
60{
61 int result;
62
63 /**
64 * TODO: We must check if we can release all references to non-payload
65 * data using skb_header_release in our skbs to allow skb_cow_header to
66 * work optimally. This means that those skbs are not allowed to read
67 * or write any data which is before the current position of skb->data
68 * after that call and thus allow other skbs with the same data buffer
69 * to write freely in that area.
70 */
71 result = skb_cow_head(skb, len);
72 if (result < 0)
73 return result;
74
75 skb_push(skb, len);
76 return 0;
77}
78
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +000079static void softif_neigh_free_rcu(struct rcu_head *rcu)
80{
81 struct softif_neigh *softif_neigh;
82
83 softif_neigh = container_of(rcu, struct softif_neigh, rcu);
Marek Lindner7d2b5542011-02-10 14:33:50 +000084 kfree(softif_neigh);
85}
86
87static void softif_neigh_free_ref(struct softif_neigh *softif_neigh)
88{
89 if (atomic_dec_and_test(&softif_neigh->refcount))
90 call_rcu(&softif_neigh->rcu, softif_neigh_free_rcu);
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +000091}
92
93void softif_neigh_purge(struct bat_priv *bat_priv)
94{
95 struct softif_neigh *softif_neigh, *softif_neigh_tmp;
96 struct hlist_node *node, *node_tmp;
97
98 spin_lock_bh(&bat_priv->softif_neigh_lock);
99
100 hlist_for_each_entry_safe(softif_neigh, node, node_tmp,
101 &bat_priv->softif_neigh_list, list) {
102
103 if ((!time_after(jiffies, softif_neigh->last_seen +
104 msecs_to_jiffies(SOFTIF_NEIGH_TIMEOUT))) &&
105 (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE))
106 continue;
107
108 hlist_del_rcu(&softif_neigh->list);
109
110 if (bat_priv->softif_neigh == softif_neigh) {
111 bat_dbg(DBG_ROUTES, bat_priv,
112 "Current mesh exit point '%pM' vanished "
113 "(vid: %d).\n",
114 softif_neigh->addr, softif_neigh->vid);
115 softif_neigh_tmp = bat_priv->softif_neigh;
116 bat_priv->softif_neigh = NULL;
Marek Lindner7d2b5542011-02-10 14:33:50 +0000117 softif_neigh_free_ref(softif_neigh_tmp);
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +0000118 }
119
Marek Lindner7d2b5542011-02-10 14:33:50 +0000120 softif_neigh_free_ref(softif_neigh);
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +0000121 }
122
123 spin_unlock_bh(&bat_priv->softif_neigh_lock);
124}
125
126static struct softif_neigh *softif_neigh_get(struct bat_priv *bat_priv,
127 uint8_t *addr, short vid)
128{
129 struct softif_neigh *softif_neigh;
130 struct hlist_node *node;
131
132 rcu_read_lock();
133 hlist_for_each_entry_rcu(softif_neigh, node,
134 &bat_priv->softif_neigh_list, list) {
135 if (memcmp(softif_neigh->addr, addr, ETH_ALEN) != 0)
136 continue;
137
138 if (softif_neigh->vid != vid)
139 continue;
140
Marek Lindner7d2b5542011-02-10 14:33:50 +0000141 if (!atomic_inc_not_zero(&softif_neigh->refcount))
142 continue;
143
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +0000144 softif_neigh->last_seen = jiffies;
Marek Lindner7d2b5542011-02-10 14:33:50 +0000145 goto out;
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +0000146 }
147
148 softif_neigh = kzalloc(sizeof(struct softif_neigh), GFP_ATOMIC);
149 if (!softif_neigh)
150 goto out;
151
152 memcpy(softif_neigh->addr, addr, ETH_ALEN);
153 softif_neigh->vid = vid;
154 softif_neigh->last_seen = jiffies;
Marek Lindner7d2b5542011-02-10 14:33:50 +0000155 /* initialize with 2 - caller decrements counter by one */
156 atomic_set(&softif_neigh->refcount, 2);
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +0000157
158 INIT_HLIST_NODE(&softif_neigh->list);
159 spin_lock_bh(&bat_priv->softif_neigh_lock);
160 hlist_add_head_rcu(&softif_neigh->list, &bat_priv->softif_neigh_list);
161 spin_unlock_bh(&bat_priv->softif_neigh_lock);
162
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +0000163out:
164 rcu_read_unlock();
165 return softif_neigh;
166}
167
168int softif_neigh_seq_print_text(struct seq_file *seq, void *offset)
169{
170 struct net_device *net_dev = (struct net_device *)seq->private;
171 struct bat_priv *bat_priv = netdev_priv(net_dev);
172 struct softif_neigh *softif_neigh;
173 struct hlist_node *node;
174 size_t buf_size, pos;
175 char *buff;
176
177 if (!bat_priv->primary_if) {
178 return seq_printf(seq, "BATMAN mesh %s disabled - "
179 "please specify interfaces to enable it\n",
180 net_dev->name);
181 }
182
183 seq_printf(seq, "Softif neighbor list (%s)\n", net_dev->name);
184
185 buf_size = 1;
186 /* Estimate length for: " xx:xx:xx:xx:xx:xx\n" */
187 rcu_read_lock();
188 hlist_for_each_entry_rcu(softif_neigh, node,
189 &bat_priv->softif_neigh_list, list)
190 buf_size += 30;
191 rcu_read_unlock();
192
193 buff = kmalloc(buf_size, GFP_ATOMIC);
194 if (!buff)
195 return -ENOMEM;
196
197 buff[0] = '\0';
198 pos = 0;
199
200 rcu_read_lock();
201 hlist_for_each_entry_rcu(softif_neigh, node,
202 &bat_priv->softif_neigh_list, list) {
203 pos += snprintf(buff + pos, 31, "%s %pM (vid: %d)\n",
204 bat_priv->softif_neigh == softif_neigh
205 ? "=>" : " ", softif_neigh->addr,
206 softif_neigh->vid);
207 }
208 rcu_read_unlock();
209
210 seq_printf(seq, "%s", buff);
211 kfree(buff);
212 return 0;
213}
214
215static void softif_batman_recv(struct sk_buff *skb, struct net_device *dev,
216 short vid)
217{
218 struct bat_priv *bat_priv = netdev_priv(dev);
219 struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
220 struct batman_packet *batman_packet;
221 struct softif_neigh *softif_neigh, *softif_neigh_tmp;
222
223 if (ntohs(ethhdr->h_proto) == ETH_P_8021Q)
224 batman_packet = (struct batman_packet *)
225 (skb->data + ETH_HLEN + VLAN_HLEN);
226 else
227 batman_packet = (struct batman_packet *)(skb->data + ETH_HLEN);
228
229 if (batman_packet->version != COMPAT_VERSION)
230 goto err;
231
232 if (batman_packet->packet_type != BAT_PACKET)
233 goto err;
234
235 if (!(batman_packet->flags & PRIMARIES_FIRST_HOP))
236 goto err;
237
238 if (is_my_mac(batman_packet->orig))
239 goto err;
240
241 softif_neigh = softif_neigh_get(bat_priv, batman_packet->orig, vid);
242
243 if (!softif_neigh)
244 goto err;
245
246 if (bat_priv->softif_neigh == softif_neigh)
247 goto out;
248
249 /* we got a neighbor but its mac is 'bigger' than ours */
250 if (memcmp(bat_priv->primary_if->net_dev->dev_addr,
251 softif_neigh->addr, ETH_ALEN) < 0)
252 goto out;
253
254 /* switch to new 'smallest neighbor' */
255 if ((bat_priv->softif_neigh) &&
256 (memcmp(softif_neigh->addr, bat_priv->softif_neigh->addr,
257 ETH_ALEN) < 0)) {
258 bat_dbg(DBG_ROUTES, bat_priv,
259 "Changing mesh exit point from %pM (vid: %d) "
260 "to %pM (vid: %d).\n",
261 bat_priv->softif_neigh->addr,
262 bat_priv->softif_neigh->vid,
263 softif_neigh->addr, softif_neigh->vid);
264 softif_neigh_tmp = bat_priv->softif_neigh;
265 bat_priv->softif_neigh = softif_neigh;
Marek Lindner7d2b5542011-02-10 14:33:50 +0000266 softif_neigh_free_ref(softif_neigh_tmp);
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +0000267 /* we need to hold the additional reference */
268 goto err;
269 }
270
271 /* close own batX device and use softif_neigh as exit node */
272 if ((!bat_priv->softif_neigh) &&
273 (memcmp(softif_neigh->addr,
274 bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN) < 0)) {
275 bat_dbg(DBG_ROUTES, bat_priv,
276 "Setting mesh exit point to %pM (vid: %d).\n",
277 softif_neigh->addr, softif_neigh->vid);
278 bat_priv->softif_neigh = softif_neigh;
279 /* we need to hold the additional reference */
280 goto err;
281 }
282
283out:
Marek Lindner7d2b5542011-02-10 14:33:50 +0000284 softif_neigh_free_ref(softif_neigh);
Sven Eckelmannc6c8fea2010-12-13 11:19:28 +0000285err:
286 kfree_skb(skb);
287 return;
288}
289
290static int interface_open(struct net_device *dev)
291{
292 netif_start_queue(dev);
293 return 0;
294}
295
296static int interface_release(struct net_device *dev)
297{
298 netif_stop_queue(dev);
299 return 0;
300}
301
302static struct net_device_stats *interface_stats(struct net_device *dev)
303{
304 struct bat_priv *bat_priv = netdev_priv(dev);
305 return &bat_priv->stats;
306}
307
308static int interface_set_mac_addr(struct net_device *dev, void *p)
309{
310 struct bat_priv *bat_priv = netdev_priv(dev);
311 struct sockaddr *addr = p;
312
313 if (!is_valid_ether_addr(addr->sa_data))
314 return -EADDRNOTAVAIL;
315
316 /* only modify hna-table if it has been initialised before */
317 if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) {
318 hna_local_remove(bat_priv, dev->dev_addr,
319 "mac address changed");
320 hna_local_add(dev, addr->sa_data);
321 }
322
323 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
324 return 0;
325}
326
327static int interface_change_mtu(struct net_device *dev, int new_mtu)
328{
329 /* check ranges */
330 if ((new_mtu < 68) || (new_mtu > hardif_min_mtu(dev)))
331 return -EINVAL;
332
333 dev->mtu = new_mtu;
334
335 return 0;
336}
337
338int interface_tx(struct sk_buff *skb, struct net_device *soft_iface)
339{
340 struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
341 struct bat_priv *bat_priv = netdev_priv(soft_iface);
342 struct bcast_packet *bcast_packet;
343 struct vlan_ethhdr *vhdr;
344 int data_len = skb->len, ret;
345 short vid = -1;
346 bool do_bcast = false;
347
348 if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
349 goto dropped;
350
351 soft_iface->trans_start = jiffies;
352
353 switch (ntohs(ethhdr->h_proto)) {
354 case ETH_P_8021Q:
355 vhdr = (struct vlan_ethhdr *)skb->data;
356 vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
357
358 if (ntohs(vhdr->h_vlan_encapsulated_proto) != ETH_P_BATMAN)
359 break;
360
361 /* fall through */
362 case ETH_P_BATMAN:
363 softif_batman_recv(skb, soft_iface, vid);
364 goto end;
365 }
366
367 /**
368 * if we have a another chosen mesh exit node in range
369 * it will transport the packets to the mesh
370 */
371 if ((bat_priv->softif_neigh) && (bat_priv->softif_neigh->vid == vid))
372 goto dropped;
373
374 /* TODO: check this for locks */
375 hna_local_add(soft_iface, ethhdr->h_source);
376
377 if (is_multicast_ether_addr(ethhdr->h_dest)) {
378 ret = gw_is_target(bat_priv, skb);
379
380 if (ret < 0)
381 goto dropped;
382
383 if (ret == 0)
384 do_bcast = true;
385 }
386
387 /* ethernet packet should be broadcasted */
388 if (do_bcast) {
389 if (!bat_priv->primary_if)
390 goto dropped;
391
392 if (my_skb_head_push(skb, sizeof(struct bcast_packet)) < 0)
393 goto dropped;
394
395 bcast_packet = (struct bcast_packet *)skb->data;
396 bcast_packet->version = COMPAT_VERSION;
397 bcast_packet->ttl = TTL;
398
399 /* batman packet type: broadcast */
400 bcast_packet->packet_type = BAT_BCAST;
401
402 /* hw address of first interface is the orig mac because only
403 * this mac is known throughout the mesh */
404 memcpy(bcast_packet->orig,
405 bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN);
406
407 /* set broadcast sequence number */
408 bcast_packet->seqno =
409 htonl(atomic_inc_return(&bat_priv->bcast_seqno));
410
411 add_bcast_packet_to_list(bat_priv, skb);
412
413 /* a copy is stored in the bcast list, therefore removing
414 * the original skb. */
415 kfree_skb(skb);
416
417 /* unicast packet */
418 } else {
419 ret = unicast_send_skb(skb, bat_priv);
420 if (ret != 0)
421 goto dropped_freed;
422 }
423
424 bat_priv->stats.tx_packets++;
425 bat_priv->stats.tx_bytes += data_len;
426 goto end;
427
428dropped:
429 kfree_skb(skb);
430dropped_freed:
431 bat_priv->stats.tx_dropped++;
432end:
433 return NETDEV_TX_OK;
434}
435
436void interface_rx(struct net_device *soft_iface,
437 struct sk_buff *skb, struct batman_if *recv_if,
438 int hdr_size)
439{
440 struct bat_priv *bat_priv = netdev_priv(soft_iface);
441 struct unicast_packet *unicast_packet;
442 struct ethhdr *ethhdr;
443 struct vlan_ethhdr *vhdr;
444 short vid = -1;
445 int ret;
446
447 /* check if enough space is available for pulling, and pull */
448 if (!pskb_may_pull(skb, hdr_size))
449 goto dropped;
450
451 skb_pull_rcsum(skb, hdr_size);
452 skb_reset_mac_header(skb);
453
454 ethhdr = (struct ethhdr *)skb_mac_header(skb);
455
456 switch (ntohs(ethhdr->h_proto)) {
457 case ETH_P_8021Q:
458 vhdr = (struct vlan_ethhdr *)skb->data;
459 vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
460
461 if (ntohs(vhdr->h_vlan_encapsulated_proto) != ETH_P_BATMAN)
462 break;
463
464 /* fall through */
465 case ETH_P_BATMAN:
466 goto dropped;
467 }
468
469 /**
470 * if we have a another chosen mesh exit node in range
471 * it will transport the packets to the non-mesh network
472 */
473 if ((bat_priv->softif_neigh) && (bat_priv->softif_neigh->vid == vid)) {
474 skb_push(skb, hdr_size);
475 unicast_packet = (struct unicast_packet *)skb->data;
476
477 if ((unicast_packet->packet_type != BAT_UNICAST) &&
478 (unicast_packet->packet_type != BAT_UNICAST_FRAG))
479 goto dropped;
480
481 skb_reset_mac_header(skb);
482
483 memcpy(unicast_packet->dest,
484 bat_priv->softif_neigh->addr, ETH_ALEN);
485 ret = route_unicast_packet(skb, recv_if, hdr_size);
486 if (ret == NET_RX_DROP)
487 goto dropped;
488
489 goto out;
490 }
491
492 /* skb->dev & skb->pkt_type are set here */
493 if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
494 goto dropped;
495 skb->protocol = eth_type_trans(skb, soft_iface);
496
497 /* should not be neccesary anymore as we use skb_pull_rcsum()
498 * TODO: please verify this and remove this TODO
499 * -- Dec 21st 2009, Simon Wunderlich */
500
501/* skb->ip_summed = CHECKSUM_UNNECESSARY;*/
502
503 bat_priv->stats.rx_packets++;
504 bat_priv->stats.rx_bytes += skb->len + sizeof(struct ethhdr);
505
506 soft_iface->last_rx = jiffies;
507
508 netif_rx(skb);
509 return;
510
511dropped:
512 kfree_skb(skb);
513out:
514 return;
515}
516
517#ifdef HAVE_NET_DEVICE_OPS
518static const struct net_device_ops bat_netdev_ops = {
519 .ndo_open = interface_open,
520 .ndo_stop = interface_release,
521 .ndo_get_stats = interface_stats,
522 .ndo_set_mac_address = interface_set_mac_addr,
523 .ndo_change_mtu = interface_change_mtu,
524 .ndo_start_xmit = interface_tx,
525 .ndo_validate_addr = eth_validate_addr
526};
527#endif
528
529static void interface_setup(struct net_device *dev)
530{
531 struct bat_priv *priv = netdev_priv(dev);
532 char dev_addr[ETH_ALEN];
533
534 ether_setup(dev);
535
536#ifdef HAVE_NET_DEVICE_OPS
537 dev->netdev_ops = &bat_netdev_ops;
538#else
539 dev->open = interface_open;
540 dev->stop = interface_release;
541 dev->get_stats = interface_stats;
542 dev->set_mac_address = interface_set_mac_addr;
543 dev->change_mtu = interface_change_mtu;
544 dev->hard_start_xmit = interface_tx;
545#endif
546 dev->destructor = free_netdev;
547
548 /**
549 * can't call min_mtu, because the needed variables
550 * have not been initialized yet
551 */
552 dev->mtu = ETH_DATA_LEN;
553 dev->hard_header_len = BAT_HEADER_LEN; /* reserve more space in the
554 * skbuff for our header */
555
556 /* generate random address */
557 random_ether_addr(dev_addr);
558 memcpy(dev->dev_addr, dev_addr, ETH_ALEN);
559
560 SET_ETHTOOL_OPS(dev, &bat_ethtool_ops);
561
562 memset(priv, 0, sizeof(struct bat_priv));
563}
564
565struct net_device *softif_create(char *name)
566{
567 struct net_device *soft_iface;
568 struct bat_priv *bat_priv;
569 int ret;
570
571 soft_iface = alloc_netdev(sizeof(struct bat_priv) , name,
572 interface_setup);
573
574 if (!soft_iface) {
575 pr_err("Unable to allocate the batman interface: %s\n", name);
576 goto out;
577 }
578
579 ret = register_netdev(soft_iface);
580 if (ret < 0) {
581 pr_err("Unable to register the batman interface '%s': %i\n",
582 name, ret);
583 goto free_soft_iface;
584 }
585
586 bat_priv = netdev_priv(soft_iface);
587
588 atomic_set(&bat_priv->aggregated_ogms, 1);
589 atomic_set(&bat_priv->bonding, 0);
590 atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE);
591 atomic_set(&bat_priv->gw_mode, GW_MODE_OFF);
592 atomic_set(&bat_priv->gw_sel_class, 20);
593 atomic_set(&bat_priv->gw_bandwidth, 41);
594 atomic_set(&bat_priv->orig_interval, 1000);
595 atomic_set(&bat_priv->hop_penalty, 10);
596 atomic_set(&bat_priv->log_level, 0);
597 atomic_set(&bat_priv->fragmentation, 1);
598 atomic_set(&bat_priv->bcast_queue_left, BCAST_QUEUE_LEN);
599 atomic_set(&bat_priv->batman_queue_left, BATMAN_QUEUE_LEN);
600
601 atomic_set(&bat_priv->mesh_state, MESH_INACTIVE);
602 atomic_set(&bat_priv->bcast_seqno, 1);
603 atomic_set(&bat_priv->hna_local_changed, 0);
604
605 bat_priv->primary_if = NULL;
606 bat_priv->num_ifaces = 0;
607 bat_priv->softif_neigh = NULL;
608
609 ret = sysfs_add_meshif(soft_iface);
610 if (ret < 0)
611 goto unreg_soft_iface;
612
613 ret = debugfs_add_meshif(soft_iface);
614 if (ret < 0)
615 goto unreg_sysfs;
616
617 ret = mesh_init(soft_iface);
618 if (ret < 0)
619 goto unreg_debugfs;
620
621 return soft_iface;
622
623unreg_debugfs:
624 debugfs_del_meshif(soft_iface);
625unreg_sysfs:
626 sysfs_del_meshif(soft_iface);
627unreg_soft_iface:
628 unregister_netdev(soft_iface);
629 return NULL;
630
631free_soft_iface:
632 free_netdev(soft_iface);
633out:
634 return NULL;
635}
636
637void softif_destroy(struct net_device *soft_iface)
638{
639 debugfs_del_meshif(soft_iface);
640 sysfs_del_meshif(soft_iface);
641 mesh_free(soft_iface);
642 unregister_netdevice(soft_iface);
643}
644
645/* ethtool */
646static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
647{
648 cmd->supported = 0;
649 cmd->advertising = 0;
650 cmd->speed = SPEED_10;
651 cmd->duplex = DUPLEX_FULL;
652 cmd->port = PORT_TP;
653 cmd->phy_address = 0;
654 cmd->transceiver = XCVR_INTERNAL;
655 cmd->autoneg = AUTONEG_DISABLE;
656 cmd->maxtxpkt = 0;
657 cmd->maxrxpkt = 0;
658
659 return 0;
660}
661
662static void bat_get_drvinfo(struct net_device *dev,
663 struct ethtool_drvinfo *info)
664{
665 strcpy(info->driver, "B.A.T.M.A.N. advanced");
666 strcpy(info->version, SOURCE_VERSION);
667 strcpy(info->fw_version, "N/A");
668 strcpy(info->bus_info, "batman");
669}
670
671static u32 bat_get_msglevel(struct net_device *dev)
672{
673 return -EOPNOTSUPP;
674}
675
676static void bat_set_msglevel(struct net_device *dev, u32 value)
677{
678}
679
680static u32 bat_get_link(struct net_device *dev)
681{
682 return 1;
683}
684
685static u32 bat_get_rx_csum(struct net_device *dev)
686{
687 return 0;
688}
689
690static int bat_set_rx_csum(struct net_device *dev, u32 data)
691{
692 return -EOPNOTSUPP;
693}