aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Russkikh <igor.russkikh@aquantia.com>2018-01-15 08:41:19 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-16 14:40:01 -0500
commitdb5506156443409955d5689d4a2a49b08fb54d86 (patch)
tree1622ccc9edf816d5aedc9447dc6bbce5ab5f9410
parent5b97b0d10eddeeec258b807f009a2cb2764653c7 (diff)
net: aquantia: Eliminate aq_nic structure abstraction
aq_nic_s was hidden in aq_nic_internal.h, that made it difficult to access nic fields and structures from other modules. This change moves aq_nic_s struct into aq_nic.h and thus makes it available to other driver modules, mainly pci module and hw related module. Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_common.h1
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_hw.h8
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_main.c1
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_nic.c6
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_nic.h34
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_nic_internal.h45
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_ring.h1
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_vec.h2
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c1
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c1
10 files changed, 46 insertions, 54 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_common.h b/drivers/net/ethernet/aquantia/atlantic/aq_common.h
index 9eb5e222a234..f79da4b5900b 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_common.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_common.h
@@ -16,7 +16,6 @@
16#include <linux/pci.h> 16#include <linux/pci.h>
17 17
18#include "ver.h" 18#include "ver.h"
19#include "aq_nic.h"
20#include "aq_cfg.h" 19#include "aq_cfg.h"
21#include "aq_utils.h" 20#include "aq_utils.h"
22 21
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
index cdd1acd417c2..5d67f1335f4d 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
@@ -15,6 +15,7 @@
15#define AQ_HW_H 15#define AQ_HW_H
16 16
17#include "aq_common.h" 17#include "aq_common.h"
18#include "aq_rss.h"
18#include "hw_atl/hw_atl_utils.h" 19#include "hw_atl/hw_atl_utils.h"
19 20
20/* NIC H/W capabilities */ 21/* NIC H/W capabilities */
@@ -87,6 +88,13 @@ struct aq_stats_s {
87 88
88#define AQ_HW_FLAG_ERRORS (AQ_HW_FLAG_ERR_HW | AQ_HW_FLAG_ERR_UNPLUG) 89#define AQ_HW_FLAG_ERRORS (AQ_HW_FLAG_ERR_HW | AQ_HW_FLAG_ERR_UNPLUG)
89 90
91#define AQ_NIC_FLAGS_IS_NOT_READY (AQ_NIC_FLAG_STOPPING | \
92 AQ_NIC_FLAG_RESETTING | AQ_NIC_FLAG_CLOSING | \
93 AQ_NIC_FLAG_ERR_UNPLUG | AQ_NIC_FLAG_ERR_HW)
94
95#define AQ_NIC_FLAGS_IS_NOT_TX_READY (AQ_NIC_FLAGS_IS_NOT_READY | \
96 AQ_NIC_LINK_DOWN)
97
90struct aq_hw_s { 98struct aq_hw_s {
91 atomic_t flags; 99 atomic_t flags;
92 struct aq_nic_cfg_s *aq_nic_cfg; 100 struct aq_nic_cfg_s *aq_nic_cfg;
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
index c2c1eb57ab6c..887bc846375a 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c
@@ -11,7 +11,6 @@
11 11
12#include "aq_main.h" 12#include "aq_main.h"
13#include "aq_nic.h" 13#include "aq_nic.h"
14#include "aq_nic_internal.h"
15#include "aq_pci_func.h" 14#include "aq_pci_func.h"
16#include "aq_ethtool.h" 15#include "aq_ethtool.h"
17 16
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 00b0ad92540a..d98251371ee4 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -14,7 +14,6 @@
14#include "aq_vec.h" 14#include "aq_vec.h"
15#include "aq_hw.h" 15#include "aq_hw.h"
16#include "aq_pci_func.h" 16#include "aq_pci_func.h"
17#include "aq_nic_internal.h"
18#include "aq_main.h" 17#include "aq_main.h"
19 18
20#include <linux/moduleparam.h> 19#include <linux/moduleparam.h>
@@ -357,11 +356,6 @@ void aq_nic_set_tx_ring(struct aq_nic_s *self, unsigned int idx,
357 self->aq_ring_tx[idx] = ring; 356 self->aq_ring_tx[idx] = ring;
358} 357}
359 358
360struct device *aq_nic_get_dev(struct aq_nic_s *self)
361{
362 return self->ndev->dev.parent;
363}
364
365struct net_device *aq_nic_get_ndev(struct aq_nic_s *self) 359struct net_device *aq_nic_get_ndev(struct aq_nic_s *self)
366{ 360{
367 return self->ndev; 361 return self->ndev;
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
index cd00faf885c6..1cd7d728e91b 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
@@ -19,6 +19,8 @@
19struct aq_ring_s; 19struct aq_ring_s;
20struct aq_pci_func_s; 20struct aq_pci_func_s;
21struct aq_hw_ops; 21struct aq_hw_ops;
22struct aq_fw_s;
23struct aq_vec_s;
22 24
23#define AQ_NIC_FC_OFF 0U 25#define AQ_NIC_FC_OFF 0U
24#define AQ_NIC_FC_TX 1U 26#define AQ_NIC_FC_TX 1U
@@ -45,7 +47,6 @@ struct aq_nic_cfg_s {
45 u16 tx_itr; 47 u16 tx_itr;
46 u32 num_rss_queues; 48 u32 num_rss_queues;
47 u32 mtu; 49 u32 mtu;
48 u32 ucp_0x364;
49 u32 flow_control; 50 u32 flow_control;
50 u32 link_speed_msk; 51 u32 link_speed_msk;
51 u32 vlan_id; 52 u32 vlan_id;
@@ -70,6 +71,37 @@ struct aq_nic_cfg_s {
70#define AQ_NIC_TCVEC2RING(_NIC_, _TC_, _VEC_) \ 71#define AQ_NIC_TCVEC2RING(_NIC_, _TC_, _VEC_) \
71 ((_TC_) * AQ_CFG_TCS_MAX + (_VEC_)) 72 ((_TC_) * AQ_CFG_TCS_MAX + (_VEC_))
72 73
74struct aq_nic_s {
75 atomic_t flags;
76 struct aq_vec_s *aq_vec[AQ_CFG_VECS_MAX];
77 struct aq_ring_s *aq_ring_tx[AQ_CFG_VECS_MAX * AQ_CFG_TCS_MAX];
78 struct aq_hw_s *aq_hw;
79 struct net_device *ndev;
80 struct aq_pci_func_s *aq_pci_func;
81 unsigned int aq_vecs;
82 unsigned int packet_filter;
83 unsigned int power_state;
84 u8 port;
85 struct aq_hw_ops aq_hw_ops;
86 struct aq_hw_caps_s aq_hw_caps;
87 struct aq_nic_cfg_s aq_nic_cfg;
88 struct timer_list service_timer;
89 struct timer_list polling_timer;
90 struct aq_hw_link_status_s link_status;
91 struct {
92 u32 count;
93 u8 ar[AQ_CFG_MULTICAST_ADDRESS_MAX][ETH_ALEN];
94 } mc_list;
95
96 struct pci_dev *pdev;
97 unsigned int msix_entry_mask;
98};
99
100static inline struct device *aq_nic_get_dev(struct aq_nic_s *self)
101{
102 return self->ndev->dev.parent;
103}
104
73struct aq_nic_s *aq_nic_alloc_cold(struct pci_dev *pdev, 105struct aq_nic_s *aq_nic_alloc_cold(struct pci_dev *pdev,
74 struct aq_pci_func_s *aq_pci_func, 106 struct aq_pci_func_s *aq_pci_func,
75 unsigned int port, 107 unsigned int port,
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic_internal.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic_internal.h
deleted file mode 100644
index 265211c763ca..000000000000
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic_internal.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * aQuantia Corporation Network Driver
3 * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 */
9
10/* File aq_nic_internal.h: Definition of private object structure. */
11
12#ifndef AQ_NIC_INTERNAL_H
13#define AQ_NIC_INTERNAL_H
14
15struct aq_nic_s {
16 atomic_t flags;
17 struct aq_vec_s *aq_vec[AQ_CFG_VECS_MAX];
18 struct aq_ring_s *aq_ring_tx[AQ_CFG_VECS_MAX * AQ_CFG_TCS_MAX];
19 struct aq_hw_s *aq_hw;
20 struct net_device *ndev;
21 struct aq_pci_func_s *aq_pci_func;
22 unsigned int aq_vecs;
23 unsigned int packet_filter;
24 unsigned int power_state;
25 u8 port;
26 struct aq_hw_ops aq_hw_ops;
27 struct aq_hw_caps_s aq_hw_caps;
28 struct aq_nic_cfg_s aq_nic_cfg;
29 struct timer_list service_timer;
30 struct timer_list polling_timer;
31 struct aq_hw_link_status_s link_status;
32 struct {
33 u32 count;
34 u8 ar[AQ_CFG_MULTICAST_ADDRESS_MAX][ETH_ALEN];
35 } mc_list;
36};
37
38#define AQ_NIC_FLAGS_IS_NOT_READY (AQ_NIC_FLAG_STOPPING | \
39 AQ_NIC_FLAG_RESETTING | AQ_NIC_FLAG_CLOSING | \
40 AQ_NIC_FLAG_ERR_UNPLUG | AQ_NIC_FLAG_ERR_HW)
41
42#define AQ_NIC_FLAGS_IS_NOT_TX_READY (AQ_NIC_FLAGS_IS_NOT_READY | \
43 AQ_NIC_LINK_DOWN)
44
45#endif /* AQ_NIC_INTERNAL_H */
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.h b/drivers/net/ethernet/aquantia/atlantic/aq_ring.h
index 2b051fdb67b7..965fae0fb6e0 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.h
@@ -15,6 +15,7 @@
15#include "aq_common.h" 15#include "aq_common.h"
16 16
17struct page; 17struct page;
18struct aq_nic_cfg_s;
18 19
19/* TxC SOP DX EOP 20/* TxC SOP DX EOP
20 * +----------+----------+----------+----------- 21 * +----------+----------+----------+-----------
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.h b/drivers/net/ethernet/aquantia/atlantic/aq_vec.h
index 78cc6c36b550..8bdf60bb3f63 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.h
@@ -19,6 +19,8 @@
19 19
20struct aq_hw_s; 20struct aq_hw_s;
21struct aq_hw_ops; 21struct aq_hw_ops;
22struct aq_nic_s;
23struct aq_nic_cfg_s;
22struct aq_ring_stats_rx_s; 24struct aq_ring_stats_rx_s;
23struct aq_ring_stats_tx_s; 25struct aq_ring_stats_tx_s;
24 26
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
index 5b1f3c19d8ba..5074988bdd48 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
@@ -12,6 +12,7 @@
12#include "../aq_hw.h" 12#include "../aq_hw.h"
13#include "../aq_hw_utils.h" 13#include "../aq_hw_utils.h"
14#include "../aq_ring.h" 14#include "../aq_ring.h"
15#include "../aq_nic.h"
15#include "hw_atl_a0.h" 16#include "hw_atl_a0.h"
16#include "hw_atl_utils.h" 17#include "hw_atl_utils.h"
17#include "hw_atl_llh.h" 18#include "hw_atl_llh.h"
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index 1c47811a03e7..9b7e04f536ff 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -12,6 +12,7 @@
12#include "../aq_hw.h" 12#include "../aq_hw.h"
13#include "../aq_hw_utils.h" 13#include "../aq_hw_utils.h"
14#include "../aq_ring.h" 14#include "../aq_ring.h"
15#include "../aq_nic.h"
15#include "hw_atl_b0.h" 16#include "hw_atl_b0.h"
16#include "hw_atl_utils.h" 17#include "hw_atl_utils.h"
17#include "hw_atl_llh.h" 18#include "hw_atl_llh.h"