diff options
author | Klaus-Dieter Wacker <kdwacker@de.ibm.com> | 2009-08-25 22:01:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-26 20:34:18 -0400 |
commit | ce73e10ee0cb6cde1c5075a2803da0f0eb5b2324 (patch) | |
tree | 1152542d22e94fb892f03e6de52bfc538c47e7a3 /drivers/s390/net/qeth_l3_main.c | |
parent | e806904057253e4f7651a8594456e68857c24e1b (diff) |
qeth: Cleanup for cast-type determination.
Clear separation of cast-type determination (send path) for layer-2
resp. layer-3. Allowing to have inline functions for qeth layer-
discipline.
Signed-off-by: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
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.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 77e04b7fad1d..d9fabe30c0da 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -2525,6 +2525,51 @@ static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
2525 | return rc; | 2525 | return rc; |
2526 | } | 2526 | } |
2527 | 2527 | ||
2528 | int inline qeth_l3_get_cast_type(struct qeth_card *card, struct sk_buff *skb) | ||
2529 | { | ||
2530 | int cast_type = RTN_UNSPEC; | ||
2531 | |||
2532 | if (skb_dst(skb) && skb_dst(skb)->neighbour) { | ||
2533 | cast_type = skb_dst(skb)->neighbour->type; | ||
2534 | if ((cast_type == RTN_BROADCAST) || | ||
2535 | (cast_type == RTN_MULTICAST) || | ||
2536 | (cast_type == RTN_ANYCAST)) | ||
2537 | return cast_type; | ||
2538 | else | ||
2539 | return RTN_UNSPEC; | ||
2540 | } | ||
2541 | /* try something else */ | ||
2542 | if (skb->protocol == ETH_P_IPV6) | ||
2543 | return (skb_network_header(skb)[24] == 0xff) ? | ||
2544 | RTN_MULTICAST : 0; | ||
2545 | else if (skb->protocol == ETH_P_IP) | ||
2546 | return ((skb_network_header(skb)[16] & 0xf0) == 0xe0) ? | ||
2547 | RTN_MULTICAST : 0; | ||
2548 | /* ... */ | ||
2549 | if (!memcmp(skb->data, skb->dev->broadcast, 6)) | ||
2550 | return RTN_BROADCAST; | ||
2551 | else { | ||
2552 | u16 hdr_mac; | ||
2553 | |||
2554 | hdr_mac = *((u16 *)skb->data); | ||
2555 | /* tr multicast? */ | ||
2556 | switch (card->info.link_type) { | ||
2557 | case QETH_LINK_TYPE_HSTR: | ||
2558 | case QETH_LINK_TYPE_LANE_TR: | ||
2559 | if ((hdr_mac == QETH_TR_MAC_NC) || | ||
2560 | (hdr_mac == QETH_TR_MAC_C)) | ||
2561 | return RTN_MULTICAST; | ||
2562 | break; | ||
2563 | /* eth or so multicast? */ | ||
2564 | default: | ||
2565 | if ((hdr_mac == QETH_ETH_MAC_V4) || | ||
2566 | (hdr_mac == QETH_ETH_MAC_V6)) | ||
2567 | return RTN_MULTICAST; | ||
2568 | } | ||
2569 | } | ||
2570 | return cast_type; | ||
2571 | } | ||
2572 | |||
2528 | static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, | 2573 | static void qeth_l3_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, |
2529 | struct sk_buff *skb, int ipv, int cast_type) | 2574 | struct sk_buff *skb, int ipv, int cast_type) |
2530 | { | 2575 | { |
@@ -2650,7 +2695,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2650 | struct qeth_card *card = dev->ml_priv; | 2695 | struct qeth_card *card = dev->ml_priv; |
2651 | struct sk_buff *new_skb = NULL; | 2696 | struct sk_buff *new_skb = NULL; |
2652 | int ipv = qeth_get_ip_version(skb); | 2697 | int ipv = qeth_get_ip_version(skb); |
2653 | int cast_type = qeth_get_cast_type(card, skb); | 2698 | int cast_type = qeth_l3_get_cast_type(card, skb); |
2654 | struct qeth_qdio_out_q *queue = card->qdio.out_qs | 2699 | struct qeth_qdio_out_q *queue = card->qdio.out_qs |
2655 | [qeth_get_priority_queue(card, skb, ipv, cast_type)]; | 2700 | [qeth_get_priority_queue(card, skb, ipv, cast_type)]; |
2656 | int tx_bytes = skb->len; | 2701 | int tx_bytes = skb->len; |