aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-11-07 19:11:58 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-07 19:11:58 -0500
commit3cdcf1334cd76bbcabd0f273ee9a13e4cc7816bc (patch)
tree03664d96b9f9020411e9772ed21d3825a5ff69ef /include
parent1ec4864b10171b0691ee196d7006ae56d2c153f2 (diff)
parent2a47fa45d4dfbc54659d28de311a1f764b296a3c (diff)
Merge branch 'macvlan_hwaccel'
John Fastabend says: ==================== l2 hardware accelerated macvlans This patch adds support to offload macvlan net_devices to the hardware. With these patches packets are pushed to the macvlan net_device directly and do not pass through the lower dev. The patches here have made it through multiple iterations each with a slightly different focus. First I tried to push these as a new link type called "VMDQ". The patches shown here, http://comments.gmane.org/gmane.linux.network/237617 Following this implementation I renamed the link type "VSI" and addressed various comments. Finally Neil Horman picked up the patches and integrated the offload into the macvlan code. Here, http://permalink.gmane.org/gmane.linux.network/285658 The attached series is clean-up of his patches, with a few fixes. If folks find this series acceptable there are a few items we can work on next. First broadcast and multicast will use the hardware even for local traffic with this series. It would be best (I think) to use the software path for macvlan to macvlan traffic and save the PCIe bus. This depends on how much you value CPU time vs PCIE bandwidth. This will need another patch series to flush out. Also this series only allows for layer 2 mac forwarding where some hardware supports more interesting forwarding capabilities. Integrating with OVS may be useful here. As always any comments/feedback welcome. My basic I/O test is here but I've also done some link testing, SRIOV/DCB with macvlans and others, Changelog: v2: two fixes to ixgbe when all features DCB, FCoE, SR-IOV are enabled with macvlans. A VMDQ_P() reference should have been accel->pool and do not set the offset of the ring index from dfwd add call. The offset is used by SR-IOV so clearing it can cause SR-IOV quue index's to go sideways. With these fixes testing macvlan's with SRIOV enabled was successful. v3: addressed Neil's comments in ixgbe fixed error path on dfwd_add_station() in ixgbe fixed ixgbe to allow SRIOV and accelerated macvlans to coexist. v4: Dave caught some strange indentation, fixed it here ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/if_macvlan.h1
-rw-r--r--include/linux/netdev_features.h2
-rw-r--r--include/linux/netdevice.h36
-rw-r--r--include/uapi/linux/if.h1
4 files changed, 39 insertions, 1 deletions
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index ddd33fd5904d..c2702856295e 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -61,6 +61,7 @@ struct macvlan_dev {
61 struct hlist_node hlist; 61 struct hlist_node hlist;
62 struct macvlan_port *port; 62 struct macvlan_port *port;
63 struct net_device *lowerdev; 63 struct net_device *lowerdev;
64 void *fwd_priv;
64 struct macvlan_pcpu_stats __percpu *pcpu_stats; 65 struct macvlan_pcpu_stats __percpu *pcpu_stats;
65 66
66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); 67 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index b05a4b501ab5..1005ebf17575 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -62,6 +62,7 @@ enum {
62 NETIF_F_HW_VLAN_STAG_TX_BIT, /* Transmit VLAN STAG HW acceleration */ 62 NETIF_F_HW_VLAN_STAG_TX_BIT, /* Transmit VLAN STAG HW acceleration */
63 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */ 63 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */
64 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */ 64 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
65 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */
65 66
66 /* 67 /*
67 * Add your fresh new feature above and remember to update 68 * Add your fresh new feature above and remember to update
@@ -116,6 +117,7 @@ enum {
116#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 117#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
117#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 118#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
118#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 119#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
120#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD)
119 121
120/* Features valid for ethtool to change */ 122/* Features valid for ethtool to change */
121/* = all defined minus driver/device-class-related */ 123/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b6f6efbcfc74..15fa01c9a3bf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -962,6 +962,25 @@ struct netdev_phys_port_id {
962 * Called by vxlan to notify the driver about a UDP port and socket 962 * Called by vxlan to notify the driver about a UDP port and socket
963 * address family that vxlan is not listening to anymore. The operation 963 * address family that vxlan is not listening to anymore. The operation
964 * is protected by the vxlan_net->sock_lock. 964 * is protected by the vxlan_net->sock_lock.
965 *
966 * void* (*ndo_dfwd_add_station)(struct net_device *pdev,
967 * struct net_device *dev)
968 * Called by upper layer devices to accelerate switching or other
969 * station functionality into hardware. 'pdev is the lowerdev
970 * to use for the offload and 'dev' is the net device that will
971 * back the offload. Returns a pointer to the private structure
972 * the upper layer will maintain.
973 * void (*ndo_dfwd_del_station)(struct net_device *pdev, void *priv)
974 * Called by upper layer device to delete the station created
975 * by 'ndo_dfwd_add_station'. 'pdev' is the net device backing
976 * the station and priv is the structure returned by the add
977 * operation.
978 * netdev_tx_t (*ndo_dfwd_start_xmit)(struct sk_buff *skb,
979 * struct net_device *dev,
980 * void *priv);
981 * Callback to use for xmit over the accelerated station. This
982 * is used in place of ndo_start_xmit on accelerated net
983 * devices.
965 */ 984 */
966struct net_device_ops { 985struct net_device_ops {
967 int (*ndo_init)(struct net_device *dev); 986 int (*ndo_init)(struct net_device *dev);
@@ -1098,6 +1117,15 @@ struct net_device_ops {
1098 void (*ndo_del_vxlan_port)(struct net_device *dev, 1117 void (*ndo_del_vxlan_port)(struct net_device *dev,
1099 sa_family_t sa_family, 1118 sa_family_t sa_family,
1100 __be16 port); 1119 __be16 port);
1120
1121 void* (*ndo_dfwd_add_station)(struct net_device *pdev,
1122 struct net_device *dev);
1123 void (*ndo_dfwd_del_station)(struct net_device *pdev,
1124 void *priv);
1125
1126 netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb,
1127 struct net_device *dev,
1128 void *priv);
1101}; 1129};
1102 1130
1103/* 1131/*
@@ -1195,6 +1223,7 @@ struct net_device {
1195 /* Management operations */ 1223 /* Management operations */
1196 const struct net_device_ops *netdev_ops; 1224 const struct net_device_ops *netdev_ops;
1197 const struct ethtool_ops *ethtool_ops; 1225 const struct ethtool_ops *ethtool_ops;
1226 const struct forwarding_accel_ops *fwd_ops;
1198 1227
1199 /* Hardware header description */ 1228 /* Hardware header description */
1200 const struct header_ops *header_ops; 1229 const struct header_ops *header_ops;
@@ -2388,7 +2417,7 @@ int dev_change_carrier(struct net_device *, bool new_carrier);
2388int dev_get_phys_port_id(struct net_device *dev, 2417int dev_get_phys_port_id(struct net_device *dev,
2389 struct netdev_phys_port_id *ppid); 2418 struct netdev_phys_port_id *ppid);
2390int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2419int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2391 struct netdev_queue *txq); 2420 struct netdev_queue *txq, void *accel_priv);
2392int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2421int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2393 2422
2394extern int netdev_budget; 2423extern int netdev_budget;
@@ -2967,6 +2996,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2967 dev->gso_max_size = size; 2996 dev->gso_max_size = size;
2968} 2997}
2969 2998
2999static inline bool netif_is_macvlan(struct net_device *dev)
3000{
3001 return dev->priv_flags & IFF_MACVLAN;
3002}
3003
2970static inline bool netif_is_bond_master(struct net_device *dev) 3004static inline bool netif_is_bond_master(struct net_device *dev)
2971{ 3005{
2972 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; 3006 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index 1ec407b01e46..d758163b0e43 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -83,6 +83,7 @@
83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */ 83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */
84#define IFF_LIVE_ADDR_CHANGE 0x100000 /* device supports hardware address 84#define IFF_LIVE_ADDR_CHANGE 0x100000 /* device supports hardware address
85 * change when it's running */ 85 * change when it's running */
86#define IFF_MACVLAN 0x200000 /* Macvlan device */
86 87
87 88
88#define IF_GET_IFACE 0x0001 /* for querying only */ 89#define IF_GET_IFACE 0x0001 /* for querying only */