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