Skip to content

Commit b717241

Browse files
Sathya Perladavem330
authored andcommitted
be2net: replace polling with sleeping in the FW completion path
The ndo_set_rx_mode() and ndo_add/del_vxlan_port() calls may be called with BHs disabled. The driver currently issues the required cmds to the FW in these contexts and polls on completions from the FW, while BHs remain disabled. This can cause either packet loss or packet reception to be delayed on that CPU. This patch defers processing of the above cmds to a separate workqueue. With this change, FW cmds are now issued only in process context. Now that the FW cmds are issued only in process context, they can sleep waiting for a completion instead of polling. All the spin_lock_bh(mcc_lock) calls are now replaced with mutex calls. Also a new rx_filter_lock is now needed to protect the RX filtering fields like vids[] between be_vlan_add/rem_vid() and __be_set_rx_mode() contexts. Signed-off-by: Sathya Perla <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 92fbb1d commit b717241

File tree

3 files changed

+327
-158
lines changed

3 files changed

+327
-158
lines changed

drivers/net/ethernet/emulex/benet/be.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ struct be_wrb_params {
508508
u16 lso_mss; /* MSS for LSO */
509509
};
510510

511+
struct be_eth_addr {
512+
unsigned char mac[ETH_ALEN];
513+
};
514+
511515
struct be_adapter {
512516
struct pci_dev *pdev;
513517
struct net_device *netdev;
@@ -523,7 +527,7 @@ struct be_adapter {
523527
struct be_dma_mem mbox_mem_alloced;
524528

525529
struct be_mcc_obj mcc_obj;
526-
spinlock_t mcc_lock; /* For serializing mcc cmds to BE card */
530+
struct mutex mcc_lock; /* For serializing mcc cmds to BE card */
527531
spinlock_t mcc_cq_lock;
528532

529533
u16 cfg_num_rx_irqs; /* configured via set-channels */
@@ -570,11 +574,15 @@ struct be_adapter {
570574
int if_handle; /* Used to configure filtering */
571575
u32 if_flags; /* Interface filtering flags */
572576
u32 *pmac_id; /* MAC addr handle used by BE card */
577+
struct be_eth_addr *uc_list;/* list of uc-addrs programmed (not perm) */
573578
u32 uc_macs; /* Count of secondary UC MAC programmed */
579+
struct be_eth_addr *mc_list;/* list of mcast addrs programmed */
580+
u32 mc_count;
574581
unsigned long vids[BITS_TO_LONGS(VLAN_N_VID)];
575582
u16 vlans_added;
576583
bool update_uc_list;
577584
bool update_mc_list;
585+
struct mutex rx_filter_lock;/* For protecting vids[] & mc/uc_list[] */
578586

579587
u32 beacon_state; /* for set_phys_id */
580588

@@ -628,6 +636,15 @@ struct be_adapter {
628636
u8 phy_state; /* state of sfp optics (functional, faulted, etc.,) */
629637
};
630638

639+
/* Used for defered FW config cmds. Add fields to this struct as reqd */
640+
struct be_cmd_work {
641+
struct work_struct work;
642+
struct be_adapter *adapter;
643+
union {
644+
__be16 vxlan_port;
645+
} info;
646+
};
647+
631648
#define be_physfn(adapter) (!adapter->virtfn)
632649
#define be_virtfn(adapter) (adapter->virtfn)
633650
#define sriov_enabled(adapter) (adapter->flags & \

0 commit comments

Comments
 (0)