macvlan.c (6b16f5d12202a23d875915349cc031c07fe1b3ec) macvlan.c (eadec877ce9ca46a94e9036b5a44e7941d4fc501)
1/*
2 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
8 *

--- 500 unchanged lines hidden (view full) ---

509 return handle_res;
510}
511
512static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
513{
514 const struct macvlan_dev *vlan = netdev_priv(dev);
515 const struct macvlan_port *port = vlan->port;
516 const struct macvlan_dev *dest;
1/*
2 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
8 *

--- 500 unchanged lines hidden (view full) ---

509 return handle_res;
510}
511
512static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
513{
514 const struct macvlan_dev *vlan = netdev_priv(dev);
515 const struct macvlan_port *port = vlan->port;
516 const struct macvlan_dev *dest;
517 void *accel_priv = NULL;
518
519 if (vlan->mode == MACVLAN_MODE_BRIDGE) {
520 const struct ethhdr *eth = (void *)skb->data;
521
522 /* send to other bridge ports directly */
523 if (is_multicast_ether_addr(eth->h_dest)) {
524 macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
525 goto xmit_world;
526 }
527
528 dest = macvlan_hash_lookup(port, eth->h_dest);
529 if (dest && dest->mode == MACVLAN_MODE_BRIDGE) {
530 /* send to lowerdev first for its network taps */
531 dev_forward_skb(vlan->lowerdev, skb);
532
533 return NET_XMIT_SUCCESS;
534 }
535 }
517
518 if (vlan->mode == MACVLAN_MODE_BRIDGE) {
519 const struct ethhdr *eth = (void *)skb->data;
520
521 /* send to other bridge ports directly */
522 if (is_multicast_ether_addr(eth->h_dest)) {
523 macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
524 goto xmit_world;
525 }
526
527 dest = macvlan_hash_lookup(port, eth->h_dest);
528 if (dest && dest->mode == MACVLAN_MODE_BRIDGE) {
529 /* send to lowerdev first for its network taps */
530 dev_forward_skb(vlan->lowerdev, skb);
531
532 return NET_XMIT_SUCCESS;
533 }
534 }
536
537 /* For packets that are non-multicast and not bridged we will pass
538 * the necessary information so that the lowerdev can distinguish
539 * the source of the packets via the accel_priv value.
540 */
541 accel_priv = vlan->accel_priv;
542xmit_world:
543 skb->dev = vlan->lowerdev;
535xmit_world:
536 skb->dev = vlan->lowerdev;
544 return dev_queue_xmit_accel(skb, accel_priv);
537 return dev_queue_xmit_accel(skb,
538 netdev_get_sb_channel(dev) ? dev : NULL);
545}
546
547static inline netdev_tx_t macvlan_netpoll_send_skb(struct macvlan_dev *vlan, struct sk_buff *skb)
548{
549#ifdef CONFIG_NET_POLL_CONTROLLER
550 if (vlan->netpoll)
551 netpoll_send_skb(vlan->netpoll, skb);
552#else

--- 1183 unchanged lines hidden ---
539}
540
541static inline netdev_tx_t macvlan_netpoll_send_skb(struct macvlan_dev *vlan, struct sk_buff *skb)
542{
543#ifdef CONFIG_NET_POLL_CONTROLLER
544 if (vlan->netpoll)
545 netpoll_send_skb(vlan->netpoll, skb);
546#else

--- 1183 unchanged lines hidden ---