aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/qeth_l3_main.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-07-18 02:09:49 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-18 02:11:35 -0400
commit69cce1d1404968f78b177a0314f5822d5afdbbfb (patch)
tree26223264fd69ea8078d0013fd5a76eb7aeb04c12 /drivers/s390/net/qeth_l3_main.c
parent9cbb7ecbcff85077bb12301aaf4c9b5a56c5993d (diff)
net: Abstract dst->neighbour accesses behind helpers.
dst_{get,set}_neighbour() Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390/net/qeth_l3_main.c')
-rw-r--r--drivers/s390/net/qeth_l3_main.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index fd69da3fa6b4..e2c9ac5fcb36 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2742,9 +2742,14 @@ static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2742int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb) 2742int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb)
2743{ 2743{
2744 int cast_type = RTN_UNSPEC; 2744 int cast_type = RTN_UNSPEC;
2745 2745 struct neighbour *n = NULL;
2746 if (skb_dst(skb) && skb_dst(skb)->neighbour) { 2746 struct dst_entry *dst;
2747 cast_type = skb_dst(skb)->neighbour->type; 2747
2748 dst = skb_dst(skb);
2749 if (dst)
2750 n = dst_get_neighbour(dst);
2751 if (n) {
2752 cast_type = n->type;
2748 if ((cast_type == RTN_BROADCAST) || 2753 if ((cast_type == RTN_BROADCAST) ||
2749 (cast_type == RTN_MULTICAST) || 2754 (cast_type == RTN_MULTICAST) ||
2750 (cast_type == RTN_ANYCAST)) 2755 (cast_type == RTN_ANYCAST))
@@ -2787,6 +2792,9 @@ int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb)
2787static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, 2792static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
2788 struct sk_buff *skb, int ipv, int cast_type) 2793 struct sk_buff *skb, int ipv, int cast_type)
2789{ 2794{
2795 struct neighbour *n = NULL;
2796 struct dst_entry *dst;
2797
2790 memset(hdr, 0, sizeof(struct qeth_hdr)); 2798 memset(hdr, 0, sizeof(struct qeth_hdr));
2791 hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3; 2799 hdr->hdr.l3.id = QETH_HEADER_TYPE_LAYER3;
2792 hdr->hdr.l3.ext_flags = 0; 2800 hdr->hdr.l3.ext_flags = 0;
@@ -2804,13 +2812,16 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
2804 } 2812 }
2805 2813
2806 hdr->hdr.l3.length = skb->len - sizeof(struct qeth_hdr); 2814 hdr->hdr.l3.length = skb->len - sizeof(struct qeth_hdr);
2815 dst = skb_dst(skb);
2816 if (dst)
2817 n = dst_get_neighbour(dst);
2807 if (ipv == 4) { 2818 if (ipv == 4) {
2808 /* IPv4 */ 2819 /* IPv4 */
2809 hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type); 2820 hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags4(cast_type);
2810 memset(hdr->hdr.l3.dest_addr, 0, 12); 2821 memset(hdr->hdr.l3.dest_addr, 0, 12);
2811 if ((skb_dst(skb)) && (skb_dst(skb)->neighbour)) { 2822 if (n) {
2812 *((u32 *) (&hdr->hdr.l3.dest_addr[12])) = 2823 *((u32 *) (&hdr->hdr.l3.dest_addr[12])) =
2813 *((u32 *) skb_dst(skb)->neighbour->primary_key); 2824 *((u32 *) n->primary_key);
2814 } else { 2825 } else {
2815 /* fill in destination address used in ip header */ 2826 /* fill in destination address used in ip header */
2816 *((u32 *) (&hdr->hdr.l3.dest_addr[12])) = 2827 *((u32 *) (&hdr->hdr.l3.dest_addr[12])) =
@@ -2821,9 +2832,9 @@ static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
2821 hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type); 2832 hdr->hdr.l3.flags = qeth_l3_get_qeth_hdr_flags6(cast_type);
2822 if (card->info.type == QETH_CARD_TYPE_IQD) 2833 if (card->info.type == QETH_CARD_TYPE_IQD)
2823 hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU; 2834 hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU;
2824 if ((skb_dst(skb)) && (skb_dst(skb)->neighbour)) { 2835 if (n) {
2825 memcpy(hdr->hdr.l3.dest_addr, 2836 memcpy(hdr->hdr.l3.dest_addr,
2826 skb_dst(skb)->neighbour->primary_key, 16); 2837 n->primary_key, 16);
2827 } else { 2838 } else {
2828 /* fill in destination address used in ip header */ 2839 /* fill in destination address used in ip header */
2829 memcpy(hdr->hdr.l3.dest_addr, 2840 memcpy(hdr->hdr.l3.dest_addr,