]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/802/tr.c
x86: cpa: remove unnecessary masking of address
[linux-2.6-omap-h63xx.git] / net / 802 / tr.c
index aa3c2e936abc97bad75fc2ec8371ee72777238c8..3f16b1720554ffc147ff634b7f1564d871ab10fb 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/init.h>
+#include <linux/sysctl.h>
 #include <net/arp.h>
 #include <net/net_namespace.h>
 
@@ -100,7 +101,7 @@ static inline unsigned long rif_hash(const unsigned char *addr)
 
 static int tr_header(struct sk_buff *skb, struct net_device *dev,
                     unsigned short type,
-                    void *daddr, void *saddr, unsigned len)
+                    const void *daddr, const void *saddr, unsigned len)
 {
        struct trh_hdr *trh;
        int hdr_len;
@@ -142,7 +143,7 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev,
        if(daddr)
        {
                memcpy(trh->daddr,daddr,dev->addr_len);
-               tr_source_route(skb,trh,dev);
+               tr_source_route(skb, trh, dev);
                return(hdr_len);
        }
 
@@ -247,7 +248,8 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
  *     We try to do source routing...
  */
 
-void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev)
+void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,
+                    struct net_device *dev)
 {
        int slack;
        unsigned int hash;
@@ -592,14 +594,18 @@ static const struct file_operations rif_seq_fops = {
 
 #endif
 
+static const struct header_ops tr_header_ops = {
+       .create = tr_header,
+       .rebuild= tr_rebuild_header,
+};
+
 static void tr_setup(struct net_device *dev)
 {
        /*
         *      Configure and register
         */
 
-       dev->hard_header        = tr_header;
-       dev->rebuild_header     = tr_rebuild_header;
+       dev->header_ops = &tr_header_ops;
 
        dev->type               = ARPHRD_IEEE802_TR;
        dev->hard_header_len    = TR_HLEN;
@@ -629,6 +635,26 @@ struct net_device *alloc_trdev(int sizeof_priv)
        return alloc_netdev(sizeof_priv, "tr%d", tr_setup);
 }
 
+#ifdef CONFIG_SYSCTL
+static struct ctl_table tr_table[] = {
+       {
+               .ctl_name       = NET_TR_RIF_TIMEOUT,
+               .procname       = "rif_timeout",
+               .data           = &sysctl_tr_rif_timeout,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec
+       },
+       { 0 },
+};
+
+static __initdata struct ctl_path tr_path[] = {
+       { .procname = "net", .ctl_name = CTL_NET, },
+       { .procname = "token-ring", .ctl_name = NET_TR, },
+       { }
+};
+#endif
+
 /*
  *     Called during bootup.  We don't actually have to initialise
  *     too much for this.
@@ -636,12 +662,12 @@ struct net_device *alloc_trdev(int sizeof_priv)
 
 static int __init rif_init(void)
 {
-       init_timer(&rif_timer);
-       rif_timer.expires  = sysctl_tr_rif_timeout;
-       rif_timer.data     = 0L;
-       rif_timer.function = rif_check_expire;
+       rif_timer.expires  = jiffies + sysctl_tr_rif_timeout;
+       setup_timer(&rif_timer, rif_check_expire, 0);
        add_timer(&rif_timer);
-
+#ifdef CONFIG_SYSCTL
+       register_sysctl_paths(tr_path, tr_table);
+#endif
        proc_net_fops_create(&init_net, "tr_rif", S_IRUGO, &rif_seq_fops);
        return 0;
 }