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