]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: aquantia: Eliminate aq_nic structure abstraction
authorIgor Russkikh <igor.russkikh@aquantia.com>
Thu, 29 Mar 2018 10:06:22 +0000 (18:06 +0800)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 29 Mar 2018 12:57:03 +0000 (07:57 -0500)
BugLink: https://bugs.launchpad.net/bugs/1759303
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>
(cherry picked from commit db5506156443409955d5689d4a2a49b08fb54d86)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/net/ethernet/aquantia/atlantic/aq_common.h
drivers/net/ethernet/aquantia/atlantic/aq_hw.h
drivers/net/ethernet/aquantia/atlantic/aq_main.c
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
drivers/net/ethernet/aquantia/atlantic/aq_nic.h
drivers/net/ethernet/aquantia/atlantic/aq_nic_internal.h [deleted file]
drivers/net/ethernet/aquantia/atlantic/aq_ring.h
drivers/net/ethernet/aquantia/atlantic/aq_vec.h
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c

index 9eb5e222a234fc98b8fca5631f1f37c0567cdc43..f79da4b5900b97fd03be74fa0aa0b965cc06b0d6 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/pci.h>
 
 #include "ver.h"
-#include "aq_nic.h"
 #include "aq_cfg.h"
 #include "aq_utils.h"
 
index cdd1acd417c2094049a049888bcf9fe8246a10a5..5d67f1335f4d0d4d336588125eeef18e3001bb27 100644 (file)
@@ -15,6 +15,7 @@
 #define AQ_HW_H
 
 #include "aq_common.h"
+#include "aq_rss.h"
 #include "hw_atl/hw_atl_utils.h"
 
 /* NIC H/W capabilities */
@@ -87,6 +88,13 @@ struct aq_stats_s {
 
 #define AQ_HW_FLAG_ERRORS      (AQ_HW_FLAG_ERR_HW | AQ_HW_FLAG_ERR_UNPLUG)
 
+#define AQ_NIC_FLAGS_IS_NOT_READY (AQ_NIC_FLAG_STOPPING | \
+                       AQ_NIC_FLAG_RESETTING | AQ_NIC_FLAG_CLOSING | \
+                       AQ_NIC_FLAG_ERR_UNPLUG | AQ_NIC_FLAG_ERR_HW)
+
+#define AQ_NIC_FLAGS_IS_NOT_TX_READY (AQ_NIC_FLAGS_IS_NOT_READY | \
+                                       AQ_NIC_LINK_DOWN)
+
 struct aq_hw_s {
        atomic_t flags;
        struct aq_nic_cfg_s *aq_nic_cfg;
index c2c1eb57ab6c0c9bc08be07d06311b705e17e75f..887bc846375a8cb4914347f63510e82f2b5699f6 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "aq_main.h"
 #include "aq_nic.h"
-#include "aq_nic_internal.h"
 #include "aq_pci_func.h"
 #include "aq_ethtool.h"
 
index 00b0ad92540a8055a8cd46fa21add087765ee685..d98251371ee474045c1ba85e160f7ea4ae6c91c2 100644 (file)
@@ -14,7 +14,6 @@
 #include "aq_vec.h"
 #include "aq_hw.h"
 #include "aq_pci_func.h"
-#include "aq_nic_internal.h"
 #include "aq_main.h"
 
 #include <linux/moduleparam.h>
@@ -357,11 +356,6 @@ void aq_nic_set_tx_ring(struct aq_nic_s *self, unsigned int idx,
        self->aq_ring_tx[idx] = ring;
 }
 
-struct device *aq_nic_get_dev(struct aq_nic_s *self)
-{
-       return self->ndev->dev.parent;
-}
-
 struct net_device *aq_nic_get_ndev(struct aq_nic_s *self)
 {
        return self->ndev;
index cd00faf885c60f3746e332c9249a25e3e9e5ba18..1cd7d728e91ba9940f2cba352d241dc89013d4cb 100644 (file)
@@ -19,6 +19,8 @@
 struct aq_ring_s;
 struct aq_pci_func_s;
 struct aq_hw_ops;
+struct aq_fw_s;
+struct aq_vec_s;
 
 #define AQ_NIC_FC_OFF    0U
 #define AQ_NIC_FC_TX     1U
@@ -45,7 +47,6 @@ struct aq_nic_cfg_s {
        u16 tx_itr;
        u32 num_rss_queues;
        u32 mtu;
-       u32 ucp_0x364;
        u32 flow_control;
        u32 link_speed_msk;
        u32 vlan_id;
@@ -70,6 +71,37 @@ struct aq_nic_cfg_s {
 #define AQ_NIC_TCVEC2RING(_NIC_, _TC_, _VEC_) \
        ((_TC_) * AQ_CFG_TCS_MAX + (_VEC_))
 
+struct aq_nic_s {
+       atomic_t flags;
+       struct aq_vec_s *aq_vec[AQ_CFG_VECS_MAX];
+       struct aq_ring_s *aq_ring_tx[AQ_CFG_VECS_MAX * AQ_CFG_TCS_MAX];
+       struct aq_hw_s *aq_hw;
+       struct net_device *ndev;
+       struct aq_pci_func_s *aq_pci_func;
+       unsigned int aq_vecs;
+       unsigned int packet_filter;
+       unsigned int power_state;
+       u8 port;
+       struct aq_hw_ops aq_hw_ops;
+       struct aq_hw_caps_s aq_hw_caps;
+       struct aq_nic_cfg_s aq_nic_cfg;
+       struct timer_list service_timer;
+       struct timer_list polling_timer;
+       struct aq_hw_link_status_s link_status;
+       struct {
+               u32 count;
+               u8 ar[AQ_CFG_MULTICAST_ADDRESS_MAX][ETH_ALEN];
+       } mc_list;
+
+       struct pci_dev *pdev;
+       unsigned int msix_entry_mask;
+};
+
+static inline struct device *aq_nic_get_dev(struct aq_nic_s *self)
+{
+       return self->ndev->dev.parent;
+}
+
 struct aq_nic_s *aq_nic_alloc_cold(struct pci_dev *pdev,
                                   struct aq_pci_func_s *aq_pci_func,
                                   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 (file)
index 265211c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * aQuantia Corporation Network Driver
- * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- */
-
-/* File aq_nic_internal.h: Definition of private object structure. */
-
-#ifndef AQ_NIC_INTERNAL_H
-#define AQ_NIC_INTERNAL_H
-
-struct aq_nic_s {
-       atomic_t flags;
-       struct aq_vec_s *aq_vec[AQ_CFG_VECS_MAX];
-       struct aq_ring_s *aq_ring_tx[AQ_CFG_VECS_MAX * AQ_CFG_TCS_MAX];
-       struct aq_hw_s *aq_hw;
-       struct net_device *ndev;
-       struct aq_pci_func_s *aq_pci_func;
-       unsigned int aq_vecs;
-       unsigned int packet_filter;
-       unsigned int power_state;
-       u8 port;
-       struct aq_hw_ops aq_hw_ops;
-       struct aq_hw_caps_s aq_hw_caps;
-       struct aq_nic_cfg_s aq_nic_cfg;
-       struct timer_list service_timer;
-       struct timer_list polling_timer;
-       struct aq_hw_link_status_s link_status;
-       struct {
-               u32 count;
-               u8 ar[AQ_CFG_MULTICAST_ADDRESS_MAX][ETH_ALEN];
-       } mc_list;
-};
-
-#define AQ_NIC_FLAGS_IS_NOT_READY (AQ_NIC_FLAG_STOPPING | \
-                       AQ_NIC_FLAG_RESETTING | AQ_NIC_FLAG_CLOSING | \
-                       AQ_NIC_FLAG_ERR_UNPLUG | AQ_NIC_FLAG_ERR_HW)
-
-#define AQ_NIC_FLAGS_IS_NOT_TX_READY (AQ_NIC_FLAGS_IS_NOT_READY | \
-                                       AQ_NIC_LINK_DOWN)
-
-#endif /* AQ_NIC_INTERNAL_H */
index 2b051fdb67b7c1c95af6927019210b825a9e8f73..965fae0fb6e0ddee8165a91097aeb148cb1308ab 100644 (file)
@@ -15,6 +15,7 @@
 #include "aq_common.h"
 
 struct page;
+struct aq_nic_cfg_s;
 
 /*           TxC       SOP        DX         EOP
  *         +----------+----------+----------+-----------
index 78cc6c36b5504f19741bdf68fa4c86069df76341..8bdf60bb3f63a183102fc9284bfe184cf1fe5a73 100644 (file)
@@ -19,6 +19,8 @@
 
 struct aq_hw_s;
 struct aq_hw_ops;
+struct aq_nic_s;
+struct aq_nic_cfg_s;
 struct aq_ring_stats_rx_s;
 struct aq_ring_stats_tx_s;
 
index 5b1f3c19d8ba9e0148d0729f6fb0de337327ac12..5074988bdd489315058715d8f2366b8719197955 100644 (file)
@@ -12,6 +12,7 @@
 #include "../aq_hw.h"
 #include "../aq_hw_utils.h"
 #include "../aq_ring.h"
+#include "../aq_nic.h"
 #include "hw_atl_a0.h"
 #include "hw_atl_utils.h"
 #include "hw_atl_llh.h"
index 1c47811a03e718039aa02ecd1b1d874e55ff2e12..9b7e04f536ff7ebb2ace582618bb9e0d63c3e360 100644 (file)
@@ -12,6 +12,7 @@
 #include "../aq_hw.h"
 #include "../aq_hw_utils.h"
 #include "../aq_ring.h"
+#include "../aq_nic.h"
 #include "hw_atl_b0.h"
 #include "hw_atl_utils.h"
 #include "hw_atl_llh.h"