macvlan.c (d02e5ee09bd98b8cec9c2e26b486ed4d6d1b7e2a) macvlan.c (1712b2fff8c682d145c7889d2290696647d82dab)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
4 *
5 * The code this is based on carried the following copyright notice:
6 * ---
7 * (C) Copyright 2001-2006
8 * Alex Zeffertt, Cambridge Broadband Ltd, ajz@cambridgebroadband.com

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

254 return hash_32(val, MACVLAN_MC_FILTER_BITS);
255}
256
257static void macvlan_broadcast(struct sk_buff *skb,
258 const struct macvlan_port *port,
259 struct net_device *src,
260 enum macvlan_mode mode)
261{
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
4 *
5 * The code this is based on carried the following copyright notice:
6 * ---
7 * (C) Copyright 2001-2006
8 * Alex Zeffertt, Cambridge Broadband Ltd, ajz@cambridgebroadband.com

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

254 return hash_32(val, MACVLAN_MC_FILTER_BITS);
255}
256
257static void macvlan_broadcast(struct sk_buff *skb,
258 const struct macvlan_port *port,
259 struct net_device *src,
260 enum macvlan_mode mode)
261{
262 const struct ethhdr *eth = skb_eth_hdr(skb);
262 const struct ethhdr *eth = eth_hdr(skb);
263 const struct macvlan_dev *vlan;
264 struct sk_buff *nskb;
265 unsigned int i;
266 int err;
267 unsigned int hash;
268
269 if (skb->protocol == htons(ETH_P_PAUSE))
270 return;

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

508
509static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
510{
511 const struct macvlan_dev *vlan = netdev_priv(dev);
512 const struct macvlan_port *port = vlan->port;
513 const struct macvlan_dev *dest;
514
515 if (vlan->mode == MACVLAN_MODE_BRIDGE) {
263 const struct macvlan_dev *vlan;
264 struct sk_buff *nskb;
265 unsigned int i;
266 int err;
267 unsigned int hash;
268
269 if (skb->protocol == htons(ETH_P_PAUSE))
270 return;

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

508
509static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
510{
511 const struct macvlan_dev *vlan = netdev_priv(dev);
512 const struct macvlan_port *port = vlan->port;
513 const struct macvlan_dev *dest;
514
515 if (vlan->mode == MACVLAN_MODE_BRIDGE) {
516 const struct ethhdr *eth = (void *)skb->data;
516 const struct ethhdr *eth = skb_eth_hdr(skb);
517
518 /* send to other bridge ports directly */
519 if (is_multicast_ether_addr(eth->h_dest)) {
517
518 /* send to other bridge ports directly */
519 if (is_multicast_ether_addr(eth->h_dest)) {
520 skb_reset_mac_header(skb);
520 macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
521 goto xmit_world;
522 }
523
524 dest = macvlan_hash_lookup(port, eth->h_dest);
525 if (dest && dest->mode == MACVLAN_MODE_BRIDGE) {
526 /* send to lowerdev first for its network taps */
527 dev_forward_skb(vlan->lowerdev, skb);

--- 1235 unchanged lines hidden ---
521 macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
522 goto xmit_world;
523 }
524
525 dest = macvlan_hash_lookup(port, eth->h_dest);
526 if (dest && dest->mode == MACVLAN_MODE_BRIDGE) {
527 /* send to lowerdev first for its network taps */
528 dev_forward_skb(vlan->lowerdev, skb);

--- 1235 unchanged lines hidden ---