Commit 7b1b843a authored by David S. Miller's avatar David S. Miller
Browse files


Jeff Kirsher says:

====================
1GbE Intel Wired LAN Driver Updates 2020-05-21

This series contains updates to igc and e1000.

Andre cleans up code that was left over from the igb driver that handled
MAC address filters based on the source address, which is not currently
supported.  Simplifies the MAC address filtering code and prepare the
igc driver for future source address support.  Updated the MAC address
filter internal APIs to support filters based on source address.  Added
support for Network Flow Classification (NFC) rules based on source MAC
address.  Cleaned up the 'cookie' field which is not used anywhere in
the code and cleaned up a wrapper function that was not needed.
Simplified the filtering code for readability and aligned the ethtool
functions, so that function names were consistent.

Alex provides a fix for e1000 to resolve a deadlock issue when NAPI is
being disabled.

Sasha does additional cleanup of the igc driver of dead code that is not
used or needed.

v2: Fix the function header comment in patch 3 of the series, based on
    the feedback from Jakub Kicinski.
====================

Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2a330b53 c983e327
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -542,8 +542,13 @@ void e1000_reinit_locked(struct e1000_adapter *adapter)
	WARN_ON(in_interrupt());
	while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
		msleep(1);

	/* only run the task if not already down */
	if (!test_bit(__E1000_DOWN, &adapter->flags)) {
		e1000_down(adapter);
		e1000_up(adapter);
	}

	clear_bit(__E1000_RESETTING, &adapter->flags);
}

@@ -1433,10 +1438,15 @@ int e1000_close(struct net_device *netdev)
	struct e1000_hw *hw = &adapter->hw;
	int count = E1000_CHECK_RESET_COUNT;

	while (test_bit(__E1000_RESETTING, &adapter->flags) && count--)
	while (test_and_set_bit(__E1000_RESETTING, &adapter->flags) && count--)
		usleep_range(10000, 20000);

	WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
	WARN_ON(count < 0);

	/* signal that we're down so that the reset task will no longer run */
	set_bit(__E1000_DOWN, &adapter->flags);
	clear_bit(__E1000_RESETTING, &adapter->flags);

	e1000_down(adapter);
	e1000_power_down_phy(adapter);
	e1000_free_irq(adapter);
+27 −42
Original line number Diff line number Diff line
@@ -16,8 +16,7 @@

#include "igc_hw.h"

/* forward declaration */
void igc_set_ethtool_ops(struct net_device *);
void igc_ethtool_set_ops(struct net_device *);

/* Transmit and receive queues */
#define IGC_MAX_RX_QUEUES		4
@@ -29,6 +28,11 @@ void igc_set_ethtool_ops(struct net_device *);
#define MAX_ETYPE_FILTER		8
#define IGC_RETA_SIZE			128

enum igc_mac_filter_type {
	IGC_MAC_FILTER_TYPE_DST = 0,
	IGC_MAC_FILTER_TYPE_SRC
};

struct igc_tx_queue_stats {
	u64 packets;
	u64 bytes;
@@ -183,14 +187,12 @@ struct igc_adapter {
	u32 rss_queues;
	u32 rss_indir_tbl_init;

	/* RX network flow classification support */
	struct hlist_head nfc_filter_list;
	unsigned int nfc_filter_count;

	/* lock for RX network flow classification filter */
	spinlock_t nfc_lock;

	struct igc_mac_addr *mac_table;
	/* Any access to elements in nfc_rule_list is protected by the
	 * nfc_rule_lock.
	 */
	spinlock_t nfc_rule_lock;
	struct hlist_head nfc_rule_list;
	unsigned int nfc_rule_count;

	u8 rss_indir_tbl[IGC_RETA_SIZE];

@@ -230,10 +232,11 @@ void igc_write_rss_indir_tbl(struct igc_adapter *adapter);
bool igc_has_link(struct igc_adapter *adapter);
void igc_reset(struct igc_adapter *adapter);
int igc_set_spd_dplx(struct igc_adapter *adapter, u32 spd, u8 dplx);
int igc_add_mac_filter(struct igc_adapter *adapter, const u8 *addr,
		       const s8 queue, const u8 flags);
int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
		       const u8 flags);
int igc_add_mac_filter(struct igc_adapter *adapter,
		       enum igc_mac_filter_type type, const u8 *addr,
		       int queue);
int igc_del_mac_filter(struct igc_adapter *adapter,
		       enum igc_mac_filter_type type, const u8 *addr);
int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio,
			     int queue);
void igc_del_vlan_prio_filter(struct igc_adapter *adapter, int prio);
@@ -449,39 +452,22 @@ enum igc_filter_match_flags {
	IGC_FILTER_FLAG_DST_MAC_ADDR =	0x8,
};

/* RX network flow classification data structure */
struct igc_nfc_input {
	/* Byte layout in order, all values with MSB first:
	 * match_flags - 1 byte
	 * etype - 2 bytes
	 * vlan_tci - 2 bytes
	 */
struct igc_nfc_filter {
	u8 match_flags;
	__be16 etype;
	__be16 vlan_tci;
	u16 etype;
	u16 vlan_tci;
	u8 src_addr[ETH_ALEN];
	u8 dst_addr[ETH_ALEN];
};

struct igc_nfc_filter {
struct igc_nfc_rule {
	struct hlist_node nfc_node;
	struct igc_nfc_input filter;
	unsigned long cookie;
	struct igc_nfc_filter filter;
	u16 sw_idx;
	u16 action;
};

struct igc_mac_addr {
	u8 addr[ETH_ALEN];
	s8 queue;
	u8 state; /* bitmask */
};

#define IGC_MAC_STATE_DEFAULT		0x1
#define IGC_MAC_STATE_IN_USE		0x2
#define IGC_MAC_STATE_SRC_ADDR		0x4

#define IGC_MAX_RXNFC_FILTERS		16
#define IGC_MAX_RXNFC_RULES		16

/* igc_desc_unused - calculate if we have unused descriptors */
static inline u16 igc_desc_unused(const struct igc_ring *ring)
@@ -557,12 +543,11 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
	return 0;
}

/* forward declaration */
void igc_reinit_locked(struct igc_adapter *);
int igc_add_filter(struct igc_adapter *adapter,
		   struct igc_nfc_filter *input);
int igc_erase_filter(struct igc_adapter *adapter,
		     struct igc_nfc_filter *input);
int igc_enable_nfc_rule(struct igc_adapter *adapter,
			const struct igc_nfc_rule *rule);
int igc_disable_nfc_rule(struct igc_adapter *adapter,
			 const struct igc_nfc_rule *rule);

void igc_ptp_init(struct igc_adapter *adapter);
void igc_ptp_reset(struct igc_adapter *adapter);
+3 −0
Original line number Diff line number Diff line
@@ -62,6 +62,9 @@
 * (RAR[15]) for our directed address used by controllers with
 * manageability enabled, allowing us room for 15 multicast addresses.
 */
#define IGC_RAH_RAH_MASK	0x0000FFFF
#define IGC_RAH_ASEL_MASK	0x00030000
#define IGC_RAH_ASEL_SRC_ADDR	BIT(16)
#define IGC_RAH_QSEL_MASK	0x000C0000
#define IGC_RAH_QSEL_SHIFT	18
#define IGC_RAH_QSEL_ENABLE	BIT(28)
+225 −243

File changed.

Preview size limit exceeded, changes collapsed.

+0 −4
Original line number Diff line number Diff line
@@ -307,12 +307,8 @@ void igc_clear_hw_cntrs_base(struct igc_hw *hw)
	rd32(IGC_ICTXQMTC);
	rd32(IGC_ICRXDMTC);

	rd32(IGC_CBTMPC);
	rd32(IGC_HTDPMC);
	rd32(IGC_CBRMPC);
	rd32(IGC_RPTHC);
	rd32(IGC_HGPTC);
	rd32(IGC_HTCBDPC);
	rd32(IGC_HGORCL);
	rd32(IGC_HGORCH);
	rd32(IGC_HGOTCL);
Loading