Skip to content

Commit de1b99e

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-19 This series contains updates to igc only. Sasha cleans up the igc driver code that is not used or needed. Vitaly cleans up driver code that was used to support Virtualization on a device that is not supported by igc, so remove the dead code. Andre renames a few macros to align with register and field names described in the data sheet. Also adds the VLAN Priority Queue Fliter and EType Queue Filter registers to the list of registers dumped by igc_get_regs(). Added additional debug messages and updated return codes for unsupported features. Refactored the VLAN priority filtering code to move the core logic into igc_main.c. Cleaned up duplicate code and useless code. ==================== Acked-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2 parents c536fc7 + e526421 commit de1b99e

File tree

8 files changed

+184
-163
lines changed

8 files changed

+184
-163
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void igc_set_ethtool_ops(struct net_device *);
2626
#define MAX_Q_VECTORS 8
2727
#define MAX_STD_JUMBO_FRAME_SIZE 9216
2828

29-
#define MAX_ETYPE_FILTER (4 - 1)
29+
#define MAX_ETYPE_FILTER 8
3030
#define IGC_RETA_SIZE 128
3131

3232
struct igc_tx_queue_stats {
@@ -189,7 +189,6 @@ struct igc_adapter {
189189

190190
/* lock for RX network flow classification filter */
191191
spinlock_t nfc_lock;
192-
bool etype_bitmap[MAX_ETYPE_FILTER];
193192

194193
struct igc_mac_addr *mac_table;
195194

@@ -235,6 +234,11 @@ int igc_add_mac_filter(struct igc_adapter *adapter, const u8 *addr,
235234
const s8 queue, const u8 flags);
236235
int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
237236
const u8 flags);
237+
int igc_add_vlan_prio_filter(struct igc_adapter *adapter, int prio,
238+
int queue);
239+
void igc_del_vlan_prio_filter(struct igc_adapter *adapter, int prio);
240+
int igc_add_etype_filter(struct igc_adapter *adapter, u16 etype, int queue);
241+
int igc_del_etype_filter(struct igc_adapter *adapter, u16 etype);
238242
void igc_update_stats(struct igc_adapter *adapter);
239243

240244
/* igc_dump declarations */
@@ -463,7 +467,6 @@ struct igc_nfc_filter {
463467
struct hlist_node nfc_node;
464468
struct igc_nfc_input filter;
465469
unsigned long cookie;
466-
u16 etype_reg_index;
467470
u16 sw_idx;
468471
u16 action;
469472
};

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,6 @@
163163

164164
/* For checksumming, the sum of all words in the NVM should equal 0xBABA. */
165165
#define NVM_SUM 0xBABA
166-
167-
#define NVM_PBA_OFFSET_0 8
168-
#define NVM_PBA_OFFSET_1 9
169-
#define NVM_RESERVED_WORD 0xFFFF
170-
#define NVM_PBA_PTR_GUARD 0xFAFA
171166
#define NVM_WORD_SIZE_BASE_SHIFT 6
172167

173168
/* Collision related configuration parameters */
@@ -249,7 +244,6 @@
249244
/* Interrupt Cause Set */
250245
#define IGC_ICS_LSC IGC_ICR_LSC /* Link Status Change */
251246
#define IGC_ICS_RXDMT0 IGC_ICR_RXDMT0 /* rx desc min. threshold */
252-
#define IGC_ICS_DRSTA IGC_ICR_DRSTA /* Device Reset Aserted */
253247

254248
#define IGC_ICR_DOUTSYNC 0x10000000 /* NIC DMA out of sync */
255249
#define IGC_EITR_CNT_IGNR 0x80000000 /* Don't reset counters on write */
@@ -389,9 +383,6 @@
389383

390384
#define IGC_TSICR_INTERRUPTS IGC_TSICR_TXTS
391385

392-
/* PTP Queue Filter */
393-
#define IGC_ETQF_1588 BIT(30)
394-
395386
#define IGC_FTQF_VF_BP 0x00008000
396387
#define IGC_FTQF_1588_TIME_STAMP 0x08000000
397388
#define IGC_FTQF_MASK 0xF0000000
@@ -513,9 +504,9 @@
513504
#define IGC_MAX_MAC_HDR_LEN 127
514505
#define IGC_MAX_NETWORK_HDR_LEN 511
515506

516-
#define IGC_VLAPQF_QUEUE_SEL(_n, q_idx) ((q_idx) << ((_n) * 4))
517-
#define IGC_VLAPQF_P_VALID(_n) (0x1 << (3 + (_n) * 4))
518-
#define IGC_VLAPQF_QUEUE_MASK 0x03
507+
#define IGC_VLANPQF_QSEL(_n, q_idx) ((q_idx) << ((_n) * 4))
508+
#define IGC_VLANPQF_VALID(_n) (0x1 << (3 + (_n) * 4))
509+
#define IGC_VLANPQF_QUEUE_MASK 0x03
519510

520511
#define IGC_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
521512
#define IGC_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type:1=IPv4 */

drivers/net/ethernet/intel/igc/igc_dump.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ static const struct igc_reg_info igc_reg_info_tbl[] = {
3535
{IGC_TDH(0), "TDH"},
3636
{IGC_TDT(0), "TDT"},
3737
{IGC_TXDCTL(0), "TXDCTL"},
38-
{IGC_TDFH, "TDFH"},
39-
{IGC_TDFT, "TDFT"},
40-
{IGC_TDFHS, "TDFHS"},
41-
{IGC_TDFPC, "TDFPC"},
4238

4339
/* List Terminator */
4440
{}

drivers/net/ethernet/intel/igc/igc_ethtool.c

Lines changed: 28 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ static void igc_get_regs(struct net_device *netdev,
316316
regs_buff[172 + i] = rd32(IGC_RAL(i));
317317
for (i = 0; i < 16; i++)
318318
regs_buff[188 + i] = rd32(IGC_RAH(i));
319+
320+
regs_buff[204] = rd32(IGC_VLANPQF);
321+
322+
for (i = 0; i < 8; i++)
323+
regs_buff[205 + i] = rd32(IGC_ETQF(i));
319324
}
320325

321326
static void igc_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
@@ -1181,75 +1186,6 @@ static int igc_set_rss_hash_opt(struct igc_adapter *adapter,
11811186
return 0;
11821187
}
11831188

1184-
static int igc_rxnfc_write_etype_filter(struct igc_adapter *adapter,
1185-
struct igc_nfc_filter *input)
1186-
{
1187-
struct igc_hw *hw = &adapter->hw;
1188-
u8 i;
1189-
u32 etqf;
1190-
u16 etype;
1191-
1192-
/* find an empty etype filter register */
1193-
for (i = 0; i < MAX_ETYPE_FILTER; ++i) {
1194-
if (!adapter->etype_bitmap[i])
1195-
break;
1196-
}
1197-
if (i == MAX_ETYPE_FILTER) {
1198-
netdev_err(adapter->netdev,
1199-
"ethtool -N: etype filters are all used\n");
1200-
return -EINVAL;
1201-
}
1202-
1203-
adapter->etype_bitmap[i] = true;
1204-
1205-
etqf = rd32(IGC_ETQF(i));
1206-
etype = ntohs(input->filter.etype & ETHER_TYPE_FULL_MASK);
1207-
1208-
etqf |= IGC_ETQF_FILTER_ENABLE;
1209-
etqf &= ~IGC_ETQF_ETYPE_MASK;
1210-
etqf |= (etype & IGC_ETQF_ETYPE_MASK);
1211-
1212-
etqf &= ~IGC_ETQF_QUEUE_MASK;
1213-
etqf |= ((input->action << IGC_ETQF_QUEUE_SHIFT)
1214-
& IGC_ETQF_QUEUE_MASK);
1215-
etqf |= IGC_ETQF_QUEUE_ENABLE;
1216-
1217-
wr32(IGC_ETQF(i), etqf);
1218-
1219-
input->etype_reg_index = i;
1220-
1221-
return 0;
1222-
}
1223-
1224-
static int igc_rxnfc_write_vlan_prio_filter(struct igc_adapter *adapter,
1225-
struct igc_nfc_filter *input)
1226-
{
1227-
struct igc_hw *hw = &adapter->hw;
1228-
u8 vlan_priority;
1229-
u16 queue_index;
1230-
u32 vlapqf;
1231-
1232-
vlapqf = rd32(IGC_VLAPQF);
1233-
vlan_priority = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK)
1234-
>> VLAN_PRIO_SHIFT;
1235-
queue_index = (vlapqf >> (vlan_priority * 4)) & IGC_VLAPQF_QUEUE_MASK;
1236-
1237-
/* check whether this vlan prio is already set */
1238-
if (vlapqf & IGC_VLAPQF_P_VALID(vlan_priority) &&
1239-
queue_index != input->action) {
1240-
netdev_err(adapter->netdev,
1241-
"ethtool rxnfc set VLAN prio filter failed\n");
1242-
return -EEXIST;
1243-
}
1244-
1245-
vlapqf |= IGC_VLAPQF_P_VALID(vlan_priority);
1246-
vlapqf |= IGC_VLAPQF_QUEUE_SEL(vlan_priority, input->action);
1247-
1248-
wr32(IGC_VLAPQF, vlapqf);
1249-
1250-
return 0;
1251-
}
1252-
12531189
int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
12541190
{
12551191
struct igc_hw *hw = &adapter->hw;
@@ -1263,7 +1199,9 @@ int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
12631199
}
12641200

12651201
if (input->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
1266-
err = igc_rxnfc_write_etype_filter(adapter, input);
1202+
u16 etype = ntohs(input->filter.etype);
1203+
1204+
err = igc_add_etype_filter(adapter, etype, input->action);
12671205
if (err)
12681206
return err;
12691207
}
@@ -1283,53 +1221,30 @@ int igc_add_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
12831221
return err;
12841222
}
12851223

1286-
if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI)
1287-
err = igc_rxnfc_write_vlan_prio_filter(adapter, input);
1288-
1289-
return err;
1290-
}
1291-
1292-
static void igc_clear_etype_filter_regs(struct igc_adapter *adapter,
1293-
u16 reg_index)
1294-
{
1295-
struct igc_hw *hw = &adapter->hw;
1296-
u32 etqf = rd32(IGC_ETQF(reg_index));
1297-
1298-
etqf &= ~IGC_ETQF_QUEUE_ENABLE;
1299-
etqf &= ~IGC_ETQF_QUEUE_MASK;
1300-
etqf &= ~IGC_ETQF_FILTER_ENABLE;
1301-
1302-
wr32(IGC_ETQF(reg_index), etqf);
1303-
1304-
adapter->etype_bitmap[reg_index] = false;
1305-
}
1306-
1307-
static void igc_clear_vlan_prio_filter(struct igc_adapter *adapter,
1308-
u16 vlan_tci)
1309-
{
1310-
struct igc_hw *hw = &adapter->hw;
1311-
u8 vlan_priority;
1312-
u32 vlapqf;
1313-
1314-
vlan_priority = (vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
1315-
1316-
vlapqf = rd32(IGC_VLAPQF);
1317-
vlapqf &= ~IGC_VLAPQF_P_VALID(vlan_priority);
1318-
vlapqf &= ~IGC_VLAPQF_QUEUE_SEL(vlan_priority,
1319-
IGC_VLAPQF_QUEUE_MASK);
1224+
if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
1225+
int prio = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK) >>
1226+
VLAN_PRIO_SHIFT;
1227+
err = igc_add_vlan_prio_filter(adapter, prio, input->action);
1228+
if (err)
1229+
return err;
1230+
}
13201231

1321-
wr32(IGC_VLAPQF, vlapqf);
1232+
return 0;
13221233
}
13231234

13241235
int igc_erase_filter(struct igc_adapter *adapter, struct igc_nfc_filter *input)
13251236
{
1326-
if (input->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE)
1327-
igc_clear_etype_filter_regs(adapter,
1328-
input->etype_reg_index);
1237+
if (input->filter.match_flags & IGC_FILTER_FLAG_ETHER_TYPE) {
1238+
u16 etype = ntohs(input->filter.etype);
13291239

1330-
if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI)
1331-
igc_clear_vlan_prio_filter(adapter,
1332-
ntohs(input->filter.vlan_tci));
1240+
igc_del_etype_filter(adapter, etype);
1241+
}
1242+
1243+
if (input->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) {
1244+
int prio = (ntohs(input->filter.vlan_tci) & VLAN_PRIO_MASK) >>
1245+
VLAN_PRIO_SHIFT;
1246+
igc_del_vlan_prio_filter(adapter, prio);
1247+
}
13331248

13341249
if (input->filter.match_flags & IGC_FILTER_FLAG_SRC_MAC_ADDR)
13351250
igc_del_mac_filter(adapter, input->filter.src_addr,
@@ -1445,7 +1360,8 @@ static int igc_add_ethtool_nfc_entry(struct igc_adapter *adapter,
14451360

14461361
if ((fsp->flow_type & FLOW_EXT) && fsp->m_ext.vlan_tci) {
14471362
if (fsp->m_ext.vlan_tci != htons(VLAN_PRIO_MASK)) {
1448-
err = -EINVAL;
1363+
netdev_dbg(netdev, "VLAN mask not supported\n");
1364+
err = -EOPNOTSUPP;
14491365
goto err_out;
14501366
}
14511367
input->filter.vlan_tci = fsp->h_ext.vlan_tci;

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
#include "igc_phy.h"
99
#include "igc_defines.h"
1010

11-
#ifndef IGC_REMOVED
12-
#define IGC_REMOVED(a) (0)
13-
#endif /* IGC_REMOVED */
14-
1511
/* forward declaration */
1612
s32 igc_disable_pcie_master(struct igc_hw *hw);
1713
s32 igc_check_for_copper_link(struct igc_hw *hw);

0 commit comments

Comments
 (0)