Commit 803df55d authored by Mengyuan Lou's avatar Mengyuan Lou Committed by Jakub Kicinski

net: ngbe: Remove structure ngbe_adapter

Move the total private structure to libwx.
Signed-off-by: default avatarMengyuan Lou <mengyuanlou@net-swift.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 270a71e6
......@@ -189,6 +189,8 @@
#define WX_MAC_STATE_MODIFIED 0x2
#define WX_MAC_STATE_IN_USE 0x4
#define WX_CFG_PORT_ST 0x14404
/* Host Interface Command Structures */
struct wx_hic_hdr {
u8 cmd;
......@@ -253,6 +255,12 @@ enum wx_mac_type {
wx_mac_em
};
enum em_mac_type {
em_mac_type_unknown = 0,
em_mac_type_mdi,
em_mac_type_rgmii
};
struct wx_mac_info {
enum wx_mac_type type;
bool set_lben;
......@@ -306,6 +314,7 @@ struct wx {
struct net_device *netdev;
struct wx_bus_info bus;
struct wx_mac_info mac;
enum em_mac_type mac_type;
struct wx_eeprom_info eeprom;
struct wx_addr_filter_info addr_ctrl;
struct wx_mac_addr *mac_table;
......@@ -320,6 +329,35 @@ struct wx {
bool adapter_stopped;
char eeprom_id[32];
enum wx_reset_type reset_type;
bool wol_enabled;
bool ncsi_enabled;
bool gpio_ctrl;
/* Tx fast path data */
int num_tx_queues;
u16 tx_itr_setting;
u16 tx_work_limit;
/* Rx fast path data */
int num_rx_queues;
u16 rx_itr_setting;
u16 rx_work_limit;
int num_q_vectors; /* current number of q_vectors for device */
int max_q_vectors; /* upper limit of q_vectors for device */
u32 tx_ring_count;
u32 rx_ring_count;
#define WX_MAX_RETA_ENTRIES 128
u8 rss_indir_tbl[WX_MAX_RETA_ENTRIES];
#define WX_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */
u32 *rss_key;
u32 wol;
u16 bd_number;
};
#define WX_INTR_ALL (~0ULL)
......
......@@ -10,10 +10,9 @@
#include "ngbe_type.h"
#include "ngbe_hw.h"
int ngbe_eeprom_chksum_hostif(struct ngbe_adapter *adapter)
int ngbe_eeprom_chksum_hostif(struct wx *wx)
{
struct wx_hic_read_shadow_ram buffer;
struct wx *wx = &adapter->wx;
int status;
int tmp;
......@@ -37,14 +36,12 @@ int ngbe_eeprom_chksum_hostif(struct ngbe_adapter *adapter)
return -EIO;
}
static int ngbe_reset_misc(struct ngbe_adapter *adapter)
static int ngbe_reset_misc(struct wx *wx)
{
struct wx *wx = &adapter->wx;
wx_reset_misc(wx);
if (adapter->mac_type == ngbe_mac_type_rgmii)
if (wx->mac_type == em_mac_type_rgmii)
wr32(wx, NGBE_MDIO_CLAUSE_SELECT, 0xF);
if (adapter->gpio_ctrl) {
if (wx->gpio_ctrl) {
/* gpio0 is used to power on/off control*/
wr32(wx, NGBE_GPIO_DDR, 0x1);
wr32(wx, NGBE_GPIO_DR, NGBE_GPIO_DR_0);
......@@ -54,25 +51,24 @@ static int ngbe_reset_misc(struct ngbe_adapter *adapter)
/**
* ngbe_reset_hw - Perform hardware reset
* @adapter: pointer to hardware structure
* @wx: pointer to hardware structure
*
* Resets the hardware by resetting the transmit and receive units, masks
* and clears all interrupts, perform a PHY reset, and perform a link (MAC)
* reset.
**/
int ngbe_reset_hw(struct ngbe_adapter *adapter)
int ngbe_reset_hw(struct wx *wx)
{
struct wx *wx = &adapter->wx;
int status = 0;
u32 reset = 0;
/* Call adapter stop to disable tx/rx and clear interrupts */
/* Call wx stop to disable tx/rx and clear interrupts */
status = wx_stop_adapter(wx);
if (status != 0)
return status;
reset = WX_MIS_RST_LAN_RST(wx->bus.func);
wr32(wx, WX_MIS_RST, reset | rd32(wx, WX_MIS_RST));
ngbe_reset_misc(adapter);
ngbe_reset_misc(wx);
/* Store the permanent mac address */
wx_get_mac_addr(wx, wx->mac.perm_addr);
......
......@@ -7,6 +7,6 @@
#ifndef _NGBE_HW_H_
#define _NGBE_HW_H_
int ngbe_eeprom_chksum_hostif(struct ngbe_adapter *adapter);
int ngbe_reset_hw(struct ngbe_adapter *adapter);
int ngbe_eeprom_chksum_hostif(struct wx *wx);
int ngbe_reset_hw(struct wx *wx);
#endif /* _NGBE_HW_H_ */
......@@ -110,86 +110,6 @@
#define NGBE_MAX_RXD 8192
#define NGBE_MIN_RXD 128
enum ngbe_phy_type {
ngbe_phy_unknown = 0,
ngbe_phy_none,
ngbe_phy_internal,
ngbe_phy_m88e1512,
ngbe_phy_m88e1512_sfi,
ngbe_phy_m88e1512_unknown,
ngbe_phy_yt8521s,
ngbe_phy_yt8521s_sfi,
ngbe_phy_internal_yt8521s_sfi,
ngbe_phy_generic
};
enum ngbe_media_type {
ngbe_media_type_unknown = 0,
ngbe_media_type_fiber,
ngbe_media_type_copper,
ngbe_media_type_backplane,
};
enum ngbe_mac_type {
ngbe_mac_type_unknown = 0,
ngbe_mac_type_mdi,
ngbe_mac_type_rgmii
};
struct ngbe_phy_info {
enum ngbe_phy_type type;
enum ngbe_media_type media_type;
u32 addr;
u32 id;
bool reset_if_overtemp;
};
/* board specific private data structure */
struct ngbe_adapter {
u8 __iomem *io_addr; /* Mainly for iounmap use */
/* OS defined structs */
struct net_device *netdev;
struct pci_dev *pdev;
struct wx wx;
struct ngbe_phy_info phy;
enum ngbe_mac_type mac_type;
bool wol_enabled;
bool ncsi_enabled;
bool gpio_ctrl;
u16 msg_enable;
/* Tx fast path data */
int num_tx_queues;
u16 tx_itr_setting;
u16 tx_work_limit;
/* Rx fast path data */
int num_rx_queues;
u16 rx_itr_setting;
u16 rx_work_limit;
int num_q_vectors; /* current number of q_vectors for device */
int max_q_vectors; /* upper limit of q_vectors for device */
u32 tx_ring_count;
u32 rx_ring_count;
#define NGBE_MAX_RETA_ENTRIES 128
u8 rss_indir_tbl[NGBE_MAX_RETA_ENTRIES];
#define NGBE_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */
u32 *rss_key;
u32 wol;
u16 bd_number;
};
extern char ngbe_driver_name[];
#endif /* _NGBE_TYPE_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment