macvlan: Add function to test for destination filtering support
authorAlexander Duyck <alexander.h.duyck@intel.com>
Tue, 3 Apr 2018 21:16:25 +0000 (17:16 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 25 Apr 2018 15:26:19 +0000 (08:26 -0700)
This patch adds a function indicating if a given macvlan can fully supports
destination filtering, especially as it relates to unicast traffic. For
those macvlan interfaces that do not support destination filtering such
passthru or source mode filtering we should not be enabling offload
support.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
include/linux/if_macvlan.h

index 80089d6c5a0a6b1600a57bb6c8bc9e77dba64edb..0221390668a01c49d7386480cdf495aef5f4730e 100644 (file)
@@ -88,4 +88,13 @@ static inline void *macvlan_accel_priv(struct net_device *dev)
 
        return macvlan->accel_priv;
 }
+
+static inline bool macvlan_supports_dest_filter(struct net_device *dev)
+{
+       struct macvlan_dev *macvlan = netdev_priv(dev);
+
+       return macvlan->mode == MACVLAN_MODE_PRIVATE ||
+              macvlan->mode == MACVLAN_MODE_VEPA ||
+              macvlan->mode == MACVLAN_MODE_BRIDGE;
+}
 #endif /* _LINUX_IF_MACVLAN_H */