net: Abstract dst->neighbour accesses behind helpers.
[deliverable/linux.git] / net / decnet / dn_neigh.c
index 602dade7e9a3576905ae6f1d1dc927df7c8f8b63..0dc3fe61085bd796e202291e85237885636324e1 100644 (file)
@@ -51,9 +51,9 @@
 static int dn_neigh_construct(struct neighbour *);
 static void dn_long_error_report(struct neighbour *, struct sk_buff *);
 static void dn_short_error_report(struct neighbour *, struct sk_buff *);
-static int dn_long_output(struct sk_buff *);
-static int dn_short_output(struct sk_buff *);
-static int dn_phase3_output(struct sk_buff *);
+static int dn_long_output(struct neighbour *, struct sk_buff *);
+static int dn_short_output(struct neighbour *, struct sk_buff *);
+static int dn_phase3_output(struct neighbour *, struct sk_buff *);
 
 
 /*
@@ -64,8 +64,6 @@ static const struct neigh_ops dn_long_ops = {
        .error_report =         dn_long_error_report,
        .output =               dn_long_output,
        .connected_output =     dn_long_output,
-       .hh_output =            dev_queue_xmit,
-       .queue_xmit =           dev_queue_xmit,
 };
 
 /*
@@ -76,8 +74,6 @@ static const struct neigh_ops dn_short_ops = {
        .error_report =         dn_short_error_report,
        .output =               dn_short_output,
        .connected_output =     dn_short_output,
-       .hh_output =            dev_queue_xmit,
-       .queue_xmit =           dev_queue_xmit,
 };
 
 /*
@@ -88,8 +84,6 @@ static const struct neigh_ops dn_phase3_ops = {
        .error_report =         dn_short_error_report, /* Can use short version here */
        .output =               dn_phase3_output,
        .connected_output =     dn_phase3_output,
-       .hh_output =            dev_queue_xmit,
-       .queue_xmit =           dev_queue_xmit
 };
 
 static u32 dn_neigh_hash(const void *pkey,
@@ -208,14 +202,14 @@ static int dn_neigh_output_packet(struct sk_buff *skb)
 {
        struct dst_entry *dst = skb_dst(skb);
        struct dn_route *rt = (struct dn_route *)dst;
-       struct neighbour *neigh = dst->neighbour;
+       struct neighbour *neigh = dst_get_neighbour(dst);
        struct net_device *dev = neigh->dev;
        char mac_addr[ETH_ALEN];
 
        dn_dn2eth(mac_addr, rt->rt_local_src);
        if (dev_hard_header(skb, dev, ntohs(skb->protocol), neigh->ha,
                            mac_addr, skb->len) >= 0)
-               return neigh->ops->queue_xmit(skb);
+               return dev_queue_xmit(skb);
 
        if (net_ratelimit())
                printk(KERN_DEBUG "dn_neigh_output_packet: oops, can't send packet\n");
@@ -224,10 +218,8 @@ static int dn_neigh_output_packet(struct sk_buff *skb)
        return -EINVAL;
 }
 
-static int dn_long_output(struct sk_buff *skb)
+static int dn_long_output(struct neighbour *neigh, struct sk_buff *skb)
 {
-       struct dst_entry *dst = skb_dst(skb);
-       struct neighbour *neigh = dst->neighbour;
        struct net_device *dev = neigh->dev;
        int headroom = dev->hard_header_len + sizeof(struct dn_long_packet) + 3;
        unsigned char *data;
@@ -271,10 +263,8 @@ static int dn_long_output(struct sk_buff *skb)
                       neigh->dev, dn_neigh_output_packet);
 }
 
-static int dn_short_output(struct sk_buff *skb)
+static int dn_short_output(struct neighbour *neigh, struct sk_buff *skb)
 {
-       struct dst_entry *dst = skb_dst(skb);
-       struct neighbour *neigh = dst->neighbour;
        struct net_device *dev = neigh->dev;
        int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
        struct dn_short_packet *sp;
@@ -315,10 +305,8 @@ static int dn_short_output(struct sk_buff *skb)
  * Phase 3 output is the same is short output, execpt that
  * it clears the area bits before transmission.
  */
-static int dn_phase3_output(struct sk_buff *skb)
+static int dn_phase3_output(struct neighbour *neigh, struct sk_buff *skb)
 {
-       struct dst_entry *dst = skb_dst(skb);
-       struct neighbour *neigh = dst->neighbour;
        struct net_device *dev = neigh->dev;
        int headroom = dev->hard_header_len + sizeof(struct dn_short_packet) + 2;
        struct dn_short_packet *sp;
@@ -404,13 +392,13 @@ int dn_neigh_router_hello(struct sk_buff *skb)
 
                        dn->flags &= ~DN_NDFLAG_P3;
 
-                       switch(msg->iinfo & DN_RT_INFO_TYPE) {
-                               case DN_RT_INFO_L1RT:
-                                       dn->flags &=~DN_NDFLAG_R2;
-                                       dn->flags |= DN_NDFLAG_R1;
-                                       break;
-                               case DN_RT_INFO_L2RT:
-                                       dn->flags |= DN_NDFLAG_R2;
+                       switch (msg->iinfo & DN_RT_INFO_TYPE) {
+                       case DN_RT_INFO_L1RT:
+                               dn->flags &=~DN_NDFLAG_R2;
+                               dn->flags |= DN_NDFLAG_R1;
+                               break;
+                       case DN_RT_INFO_L2RT:
+                               dn->flags |= DN_NDFLAG_R2;
                        }
                }
 
This page took 0.028006 seconds and 5 git commands to generate.