Skip to content

Commit c9a11c2

Browse files
aneftinJeff Kirsher
authored andcommitted
igc: Add netdev
Now that we have the ability to configure the basic settings on the device we can start allocating and configuring a netdev for the interface. Signed-off-by: Sasha Neftin <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 146740f commit c9a11c2

File tree

4 files changed

+534
-1
lines changed

4 files changed

+534
-1
lines changed

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,63 @@
2828
extern char igc_driver_name[];
2929
extern char igc_driver_version[];
3030

31+
/* Transmit and receive queues */
32+
#define IGC_MAX_RX_QUEUES 4
33+
#define IGC_MAX_TX_QUEUES 4
34+
35+
#define MAX_Q_VECTORS 8
36+
#define MAX_STD_JUMBO_FRAME_SIZE 9216
37+
38+
enum igc_state_t {
39+
__IGC_TESTING,
40+
__IGC_RESETTING,
41+
__IGC_DOWN,
42+
__IGC_PTP_TX_IN_PROGRESS,
43+
};
44+
45+
struct igc_q_vector {
46+
struct igc_adapter *adapter; /* backlink */
47+
48+
struct napi_struct napi;
49+
};
50+
51+
struct igc_mac_addr {
52+
u8 addr[ETH_ALEN];
53+
u8 queue;
54+
u8 state; /* bitmask */
55+
};
56+
57+
#define IGC_MAC_STATE_DEFAULT 0x1
58+
#define IGC_MAC_STATE_MODIFIED 0x2
59+
#define IGC_MAC_STATE_IN_USE 0x4
60+
3161
/* Board specific private data structure */
3262
struct igc_adapter {
63+
struct net_device *netdev;
64+
65+
unsigned long state;
66+
unsigned int flags;
67+
unsigned int num_q_vectors;
68+
u16 link_speed;
69+
u16 link_duplex;
70+
71+
u8 port_num;
72+
3373
u8 __iomem *io_addr;
74+
struct work_struct watchdog_task;
75+
76+
int msg_enable;
77+
u32 max_frame_size;
3478

3579
/* OS defined structs */
3680
struct pci_dev *pdev;
3781

3882
/* structs defined in igc_hw.h */
3983
struct igc_hw hw;
84+
85+
struct igc_q_vector *q_vector[MAX_Q_VECTORS];
86+
87+
struct igc_mac_addr *mac_table;
4088
};
4189

4290
#endif /* _IGC_H_ */

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

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

7+
#define IGC_CTRL_EXT_DRV_LOAD 0x10000000 /* Drv loaded bit for FW */
8+
79
/* PCI Bus Info */
810
#define PCIE_DEVICE_CONTROL2 0x28
911
#define PCIE_DEVICE_CONTROL2_16ms 0x0005
1012

13+
/* Receive Address
14+
* Number of high/low register pairs in the RAR. The RAR (Receive Address
15+
* Registers) holds the directed and multicast addresses that we monitor.
16+
* Technically, we have 16 spots. However, we reserve one of these spots
17+
* (RAR[15]) for our directed address used by controllers with
18+
* manageability enabled, allowing us room for 15 multicast addresses.
19+
*/
20+
#define IGC_RAH_AV 0x80000000 /* Receive descriptor valid */
21+
#define IGC_RAH_POOL_1 0x00040000
22+
1123
/* Error Codes */
1224
#define IGC_SUCCESS 0
1325
#define IGC_ERR_NVM 1
@@ -17,6 +29,9 @@
1729
#define IGC_ERR_MAC_INIT 5
1830
#define IGC_ERR_RESET 9
1931

32+
/* PBA constants */
33+
#define IGC_PBA_34K 0x0022
34+
2035
/* Device Status */
2136
#define IGC_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */
2237
#define IGC_STATUS_LU 0x00000002 /* Link up.0=no,1=link */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct igc_mac_info {
5959

6060
bool autoneg;
6161
bool autoneg_failed;
62+
bool get_link_status;
6263
};
6364

6465
struct igc_bus_info {

0 commit comments

Comments
 (0)