Skip to content

Commit 7b1b843

Browse files
committed
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
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: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 2a330b5 + c983e32 commit 7b1b843

File tree

7 files changed

+342
-393
lines changed

7 files changed

+342
-393
lines changed

drivers/net/ethernet/intel/e1000/e1000_main.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,13 @@ void e1000_reinit_locked(struct e1000_adapter *adapter)
542542
WARN_ON(in_interrupt());
543543
while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
544544
msleep(1);
545-
e1000_down(adapter);
546-
e1000_up(adapter);
545+
546+
/* only run the task if not already down */
547+
if (!test_bit(__E1000_DOWN, &adapter->flags)) {
548+
e1000_down(adapter);
549+
e1000_up(adapter);
550+
}
551+
547552
clear_bit(__E1000_RESETTING, &adapter->flags);
548553
}
549554

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

1436-
while (test_bit(__E1000_RESETTING, &adapter->flags) && count--)
1441+
while (test_and_set_bit(__E1000_RESETTING, &adapter->flags) && count--)
14371442
usleep_range(10000, 20000);
14381443

1439-
WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
1444+
WARN_ON(count < 0);
1445+
1446+
/* signal that we're down so that the reset task will no longer run */
1447+
set_bit(__E1000_DOWN, &adapter->flags);
1448+
clear_bit(__E1000_RESETTING, &adapter->flags);
1449+
14401450
e1000_down(adapter);
14411451
e1000_power_down_phy(adapter);
14421452
e1000_free_irq(adapter);

drivers/net/ethernet/intel/igc/igc.h

Lines changed: 27 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
#include "igc_hw.h"
1818

19-
/* forward declaration */
20-
void igc_set_ethtool_ops(struct net_device *);
19+
void igc_ethtool_set_ops(struct net_device *);
2120

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

31+
enum igc_mac_filter_type {
32+
IGC_MAC_FILTER_TYPE_DST = 0,
33+
IGC_MAC_FILTER_TYPE_SRC
34+
};
35+
3236
struct igc_tx_queue_stats {
3337
u64 packets;
3438
u64 bytes;
@@ -183,14 +187,12 @@ struct igc_adapter {
183187
u32 rss_queues;
184188
u32 rss_indir_tbl_init;
185189

186-
/* RX network flow classification support */
187-
struct hlist_head nfc_filter_list;
188-
unsigned int nfc_filter_count;
189-
190-
/* lock for RX network flow classification filter */
191-
spinlock_t nfc_lock;
192-
193-
struct igc_mac_addr *mac_table;
190+
/* Any access to elements in nfc_rule_list is protected by the
191+
* nfc_rule_lock.
192+
*/
193+
spinlock_t nfc_rule_lock;
194+
struct hlist_head nfc_rule_list;
195+
unsigned int nfc_rule_count;
194196

195197
u8 rss_indir_tbl[IGC_RETA_SIZE];
196198

@@ -230,10 +232,11 @@ void igc_write_rss_indir_tbl(struct igc_adapter *adapter);
230232
bool igc_has_link(struct igc_adapter *adapter);
231233
void igc_reset(struct igc_adapter *adapter);
232234
int igc_set_spd_dplx(struct igc_adapter *adapter, u32 spd, u8 dplx);
233-
int igc_add_mac_filter(struct igc_adapter *adapter, const u8 *addr,
234-
const s8 queue, const u8 flags);
235-
int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
236-
const u8 flags);
235+
int igc_add_mac_filter(struct igc_adapter *adapter,
236+
enum igc_mac_filter_type type, const u8 *addr,
237+
int queue);
238+
int igc_del_mac_filter(struct igc_adapter *adapter,
239+
enum igc_mac_filter_type type, const u8 *addr);
237240
int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio,
238241
int queue);
239242
void igc_del_vlan_prio_filter(struct igc_adapter *adapter, int prio);
@@ -449,39 +452,22 @@ enum igc_filter_match_flags {
449452
IGC_FILTER_FLAG_DST_MAC_ADDR = 0x8,
450453
};
451454

452-
/* RX network flow classification data structure */
453-
struct igc_nfc_input {
454-
/* Byte layout in order, all values with MSB first:
455-
* match_flags - 1 byte
456-
* etype - 2 bytes
457-
* vlan_tci - 2 bytes
458-
*/
455+
struct igc_nfc_filter {
459456
u8 match_flags;
460-
__be16 etype;
461-
__be16 vlan_tci;
457+
u16 etype;
458+
u16 vlan_tci;
462459
u8 src_addr[ETH_ALEN];
463460
u8 dst_addr[ETH_ALEN];
464461
};
465462

466-
struct igc_nfc_filter {
463+
struct igc_nfc_rule {
467464
struct hlist_node nfc_node;
468-
struct igc_nfc_input filter;
469-
unsigned long cookie;
465+
struct igc_nfc_filter filter;
470466
u16 sw_idx;
471467
u16 action;
472468
};
473469

474-
struct igc_mac_addr {
475-
u8 addr[ETH_ALEN];
476-
s8 queue;
477-
u8 state; /* bitmask */
478-
};
479-
480-
#define IGC_MAC_STATE_DEFAULT 0x1
481-
#define IGC_MAC_STATE_IN_USE 0x2
482-
#define IGC_MAC_STATE_SRC_ADDR 0x4
483-
484-
#define IGC_MAX_RXNFC_FILTERS 16
470+
#define IGC_MAX_RXNFC_RULES 16
485471

486472
/* igc_desc_unused - calculate if we have unused descriptors */
487473
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)
557543
return 0;
558544
}
559545

560-
/* forward declaration */
561546
void igc_reinit_locked(struct igc_adapter *);
562-
int igc_add_filter(struct igc_adapter *adapter,
563-
struct igc_nfc_filter *input);
564-
int igc_erase_filter(struct igc_adapter *adapter,
565-
struct igc_nfc_filter *input);
547+
int igc_enable_nfc_rule(struct igc_adapter *adapter,
548+
const struct igc_nfc_rule *rule);
549+
int igc_disable_nfc_rule(struct igc_adapter *adapter,
550+
const struct igc_nfc_rule *rule);
566551

567552
void igc_ptp_init(struct igc_adapter *adapter);
568553
void igc_ptp_reset(struct igc_adapter *adapter);

drivers/net/ethernet/intel/igc/igc_defines.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
* (RAR[15]) for our directed address used by controllers with
6363
* manageability enabled, allowing us room for 15 multicast addresses.
6464
*/
65+
#define IGC_RAH_RAH_MASK 0x0000FFFF
66+
#define IGC_RAH_ASEL_MASK 0x00030000
67+
#define IGC_RAH_ASEL_SRC_ADDR BIT(16)
6568
#define IGC_RAH_QSEL_MASK 0x000C0000
6669
#define IGC_RAH_QSEL_SHIFT 18
6770
#define IGC_RAH_QSEL_ENABLE BIT(28)

0 commit comments

Comments
 (0)