Skip to content

Commit 8c5ad0d

Browse files
Sasha NeftinJeff Kirsher
authored andcommitted
igc: Add ethtool support
This patch adds basic ethtool support to the device to allow for configuration. Signed-off-by: Sasha Neftin <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent a865d22 commit 8c5ad0d

File tree

8 files changed

+1169
-18
lines changed

8 files changed

+1169
-18
lines changed

drivers/net/ethernet/intel/igc/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77

88
obj-$(CONFIG_IGC) += igc.o
99

10-
igc-objs := igc_main.o igc_mac.o igc_i225.o igc_base.o igc_nvm.o igc_phy.o
10+
igc-objs := igc_main.o igc_mac.o igc_i225.o igc_base.o igc_nvm.o igc_phy.o \
11+
igc_ethtool.o

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,43 @@
1313

1414
#include "igc_hw.h"
1515

16-
/* main */
16+
/* forward declaration */
17+
void igc_set_ethtool_ops(struct net_device *);
18+
19+
struct igc_adapter;
20+
struct igc_ring;
21+
22+
void igc_up(struct igc_adapter *adapter);
23+
void igc_down(struct igc_adapter *adapter);
24+
int igc_setup_tx_resources(struct igc_ring *ring);
25+
int igc_setup_rx_resources(struct igc_ring *ring);
26+
void igc_free_tx_resources(struct igc_ring *ring);
27+
void igc_free_rx_resources(struct igc_ring *ring);
28+
unsigned int igc_get_max_rss_queues(struct igc_adapter *adapter);
29+
void igc_set_flag_queue_pairs(struct igc_adapter *adapter,
30+
const u32 max_rss_queues);
31+
int igc_reinit_queues(struct igc_adapter *adapter);
32+
bool igc_has_link(struct igc_adapter *adapter);
33+
void igc_reset(struct igc_adapter *adapter);
34+
int igc_set_spd_dplx(struct igc_adapter *adapter, u32 spd, u8 dplx);
35+
1736
extern char igc_driver_name[];
1837
extern char igc_driver_version[];
1938

39+
#define IGC_REGS_LEN 740
40+
#define IGC_RETA_SIZE 128
41+
2042
/* Interrupt defines */
2143
#define IGC_START_ITR 648 /* ~6000 ints/sec */
2244
#define IGC_FLAG_HAS_MSI BIT(0)
23-
#define IGC_FLAG_QUEUE_PAIRS BIT(4)
45+
#define IGC_FLAG_QUEUE_PAIRS BIT(3)
46+
#define IGC_FLAG_DMAC BIT(4)
2447
#define IGC_FLAG_NEED_LINK_UPDATE BIT(9)
2548
#define IGC_FLAG_MEDIA_RESET BIT(10)
2649
#define IGC_FLAG_MAS_ENABLE BIT(12)
2750
#define IGC_FLAG_HAS_MSIX BIT(13)
2851
#define IGC_FLAG_VLAN_PROMISC BIT(15)
52+
#define IGC_FLAG_RX_LEGACY BIT(16)
2953

3054
#define IGC_START_ITR 648 /* ~6000 ints/sec */
3155
#define IGC_4K_ITR 980
@@ -60,6 +84,7 @@ extern char igc_driver_version[];
6084
#define IGC_RXBUFFER_2048 2048
6185
#define IGC_RXBUFFER_3072 3072
6286

87+
#define AUTO_ALL_MODES 0
6388
#define IGC_RX_HDR_LEN IGC_RXBUFFER_256
6489

6590
/* RX and TX descriptor control thresholds.
@@ -340,6 +365,8 @@ struct igc_adapter {
340365

341366
struct igc_mac_addr *mac_table;
342367

368+
u8 rss_indir_tbl[IGC_RETA_SIZE];
369+
343370
unsigned long link_check_timeout;
344371
struct igc_info ei;
345372
};
@@ -418,6 +445,9 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
418445
return 0;
419446
}
420447

448+
/* forward declaration */
449+
void igc_reinit_locked(struct igc_adapter *);
450+
421451
#define igc_rx_pg_size(_ring) (PAGE_SIZE << igc_rx_pg_order(_ring))
422452

423453
#define IGC_TXD_DCMD (IGC_ADVTXD_DCMD_EOP | IGC_ADVTXD_DCMD_RS)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ static s32 igc_init_nvm_params_base(struct igc_hw *hw)
131131
if (size > 15)
132132
size = 15;
133133

134+
nvm->type = igc_nvm_eeprom_spi;
134135
nvm->word_size = BIT(size);
135136
nvm->opcode_bits = 8;
136137
nvm->delay_usec = 1;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
#ifndef _IGC_DEFINES_H_
55
#define _IGC_DEFINES_H_
66

7+
/* Number of Transmit and Receive Descriptors must be a multiple of 8 */
8+
#define REQ_TX_DESCRIPTOR_MULTIPLE 8
9+
#define REQ_RX_DESCRIPTOR_MULTIPLE 8
10+
711
#define IGC_CTRL_EXT_DRV_LOAD 0x10000000 /* Drv loaded bit for FW */
812

913
/* PCI Bus Info */

0 commit comments

Comments
 (0)