Skip to content

Commit 3335915

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
ixgbe/fm10k: Only support macvlan offload for types that support destination filtering
Both the ixgbe and fm10k drivers support destination filtering. Instead of adding a ton of complexity to support either source or passthru mode we can instead just avoid offloading them for now. Doing this we avoid leaking packets into interfaces that aren't meant to receive them. Signed-off-by: Alexander Duyck <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 53cd4d8 commit 3335915

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "fm10k.h"
2323
#include <linux/vmalloc.h>
2424
#include <net/udp_tunnel.h>
25+
#include <linux/if_macvlan.h>
2526

2627
/**
2728
* fm10k_setup_tx_resources - allocate Tx resources (Descriptors)
@@ -1449,6 +1450,13 @@ static void *fm10k_dfwd_add_station(struct net_device *dev,
14491450
int size = 0, i;
14501451
u16 glort;
14511452

1453+
/* The hardware supported by fm10k only filters on the destination MAC
1454+
* address. In order to avoid issues we only support offloading modes
1455+
* where the hardware can actually provide the functionality.
1456+
*/
1457+
if (!macvlan_supports_dest_filter(sdev))
1458+
return ERR_PTR(-EMEDIUMTYPE);
1459+
14521460
/* allocate l2 accel structure if it is not available */
14531461
if (!l2_accel) {
14541462
/* verify there is enough free GLORTs to support l2_accel */

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9760,6 +9760,13 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
97609760
unsigned int limit;
97619761
int pool, err;
97629762

9763+
/* The hardware supported by ixgbe only filters on the destination MAC
9764+
* address. In order to avoid issues we only support offloading modes
9765+
* where the hardware can actually provide the functionality.
9766+
*/
9767+
if (!macvlan_supports_dest_filter(vdev))
9768+
return ERR_PTR(-EMEDIUMTYPE);
9769+
97639770
/* Hardware has a limited number of available pools. Each VF, and the
97649771
* PF require a pool. Check to ensure we don't attempt to use more
97659772
* then the available number of pools.

0 commit comments

Comments
 (0)