fm10k: introduce a message queue for MAC/VLAN messages
Subsystems (2)
PATCH v2 1/1 fm10k: introduce a message queue for MAC/VLAN messages
Under some circumstances, when dealing with a large number of MAC address or VLAN updates at once, the fm10k driver, particularly the VFs can overload the mailbox with too many messages at once.
This results in a mailbox timeout, which causes the driver to initiate a reset. During the reset, we re-send all the same messages that originally caused the timeout. This results in a cycle of resets each triggering a future reset.
To fix or avoid this, we introduce a workqueue item which monitors a queue of MAC and VLAN requests. These requests are queued to the end of the list, and we process as a FIFO periodically.
Initially we only handle requests for the netdev, but we do handle unicast MAC addresses, multicast MAC addresses, and update VLAN requests.
A future patch will add support to use this queue for handling MAC update requests from the VF<->PF mailbox.
The MAC/VLAN work item will keep checking to make sure that each request does not overflow the mailbox and cause a timeout. If it might, then the work item will reschedule itself a short time later. This avoids any reset cycle, since we never send the message if the mailbox is not ready.
As an alternative, we tried increasing the mailbox message FIFO, but this just delays the problem and results in needless memory waste on the system. Our new message queue is dynamically allocated so only uses as much memory as it needs. Additionally, it need not be contiguous like the Tx and Rx FIFOs.
Note that this patch chose to only create a queue for MAC and VLAN messages, since these are the only messages sent in a large enough volume to cause the reset loop. Other messages are very unlikely to overflow the mailbox Tx fifo so easily.
---
- v2
* Fix a bug due to how we use __FM10K_RESETTING in fm10k_set_ringparam()
drivers/net/ethernet/intel/fm10k/fm10k.h | 39 +++++ drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 199 ++++++++++++++++++----- drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 201 ++++++++++++++++++++++++ 3 files changed, 397 insertions(+), 42 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k.h +39 -0
@@ -248,6 +248,29 @@ struct fm10k_udp_port {__be16 port; }; +enum fm10k_macvlan_request_type { +FM10K_UC_MAC_REQUEST , +FM10K_MC_MAC_REQUEST , +FM10K_VLAN_REQUEST +}; + +struct fm10k_macvlan_request { +enum fm10k_macvlan_request_type type; +struct list_head list; +union { +struct fm10k_mac_request { +u8 addr[ETH_ALEN ]; +u16 glort; +u16 vid; + } mac; +struct fm10k_vlan_request { +u32 vid; +u8 vsi; + } vlan; + }; +bool set; +}; +/* one work queue for entire driver */ extern struct workqueue_struct *fm10k_workqueue;
@@ -274,6 +297,9 @@ enum fm10k_state_t { __FM10K_SERVICE_SCHED, __FM10K_SERVICE_REQUEST, __FM10K_SERVICE_DISABLE, + __FM10K_MACVLAN_SCHED, + __FM10K_MACVLAN_REQUEST, + __FM10K_MACVLAN_DISABLE, __FM10K_LINK_DOWN, __FM10K_UPDATING_STATS, /* This value must be last and determines the BITMAP size */
@@ -366,6 +392,12 @@ struct fm10k_intfc {struct list_head vxlan_port;struct list_head geneve_port; +/* MAC/VLAN update queue */ +struct list_head macvlan_requests; +struct delayed_work macvlan_task; +/* MAC/VLAN update queue lock */ +spinlock_t macvlan_lock; +#ifdef CONFIG_DEBUG_FS struct dentry *dbg_intfc;#endif /* CONFIG_DEBUG_FS */
@@ -485,6 +517,7 @@ void fm10k_up(struct fm10k_intfc *interface);void fm10k_down (struct fm10k_intfc *interface);void fm10k_update_stats (struct fm10k_intfc *interface);void fm10k_service_event_schedule (struct fm10k_intfc *interface); +void fm10k_macvlan_schedule (struct fm10k_intfc *interface);void fm10k_update_rx_drop_en (struct fm10k_intfc *interface);#ifdef CONFIG_NET_POLL_CONTROLLER void fm10k_netpoll (struct net_device *netdev);
@@ -505,6 +538,12 @@ void fm10k_reset_rx_state(struct fm10k_intfc *);int fm10k_setup_tc (struct net_device *dev,u8 tc);int fm10k_open (struct net_device *netdev);int fm10k_close (struct net_device *netdev); +int fm10k_queue_vlan_request (struct fm10k_intfc *interface,u32 vid, +u8 vsi,bool set); +int fm10k_queue_mac_request (struct fm10k_intfc *interface,u16 glort, +const unsigned char *addr,u16 vid,bool set); +void fm10k_clear_macvlan_queue (struct fm10k_intfc *interface, +u16 glort,bool vlans);/* Ethtool */ void fm10k_set_ethtool_ops (struct net_device *dev);
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +157 -42
307 lines not on this page · raw message
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +201 -0
260 lines not on this page · raw message
Signature · 1 line
2.13.0.615.gb09ed6e59a40