diff options
Diffstat (limited to 'drivers')
28 files changed, 1414 insertions, 1848 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index c85768cd1b18..12b5b5168dca 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h @@ -29,6 +29,7 @@ #include <linux/interrupt.h> #include <linux/firmware.h> #include <linux/slab.h> +#include <linux/u64_stats_sync.h> #include "be_hw.h" @@ -167,15 +168,15 @@ struct be_mcc_obj { }; struct be_tx_stats { - u32 be_tx_reqs; /* number of TX requests initiated */ - u32 be_tx_stops; /* number of times TX Q was stopped */ - u32 be_tx_wrbs; /* number of tx WRBs used */ - u32 be_tx_compl; /* number of tx completion entries processed */ - ulong be_tx_jiffies; - u64 be_tx_bytes; - u64 be_tx_bytes_prev; - u64 be_tx_pkts; - u32 be_tx_rate; + u64 tx_bytes; + u64 tx_pkts; + u64 tx_reqs; + u64 tx_wrbs; + u64 tx_compl; + ulong tx_jiffies; + u32 tx_stops; + struct u64_stats_sync sync; + struct u64_stats_sync sync_compl; }; struct be_tx_obj { @@ -195,22 +196,20 @@ struct be_rx_page_info { }; struct be_rx_stats { - u32 rx_post_fail;/* number of ethrx buffer alloc failures */ - u32 rx_polls; /* number of times NAPI called poll function */ - u32 rx_events; /* number of ucast rx completion events */ - u32 rx_compl; /* number of rx completion entries processed */ - ulong rx_dropped; /* number of skb allocation errors */ - ulong rx_jiffies; u64 rx_bytes; - u64 rx_bytes_prev; u64 rx_pkts; - u32 rx_rate; + u64 rx_pkts_prev; + ulong rx_jiffies; + u32 rx_drops_no_skbs; /* skb allocation errors */ + u32 rx_drops_no_frags; /* HW has no fetched frags */ + u32 rx_post_fail; /* page post alloc failures */ + u32 rx_polls; /* NAPI calls */ + u32 rx_events; + u32 rx_compl; u32 rx_mcast_pkts; - u32 rxcp_err; /* Num rx completion entries w/ err set. */ - ulong rx_fps_jiffies; /* jiffies at last FPS calc */ - u32 rx_frags; - u32 prev_rx_frags; - u32 rx_fps; /* Rx frags per second */ + u32 rx_compl_err; /* completions with err set */ + u32 rx_pps; /* pkts per second */ + struct u64_stats_sync sync; }; struct be_rx_compl_info { @@ -218,7 +217,7 @@ struct be_rx_compl_info { u16 vlan_tag; u16 pkt_size; u16 rxq_idx; - u16 mac_id; + u16 port; u8 vlanf; u8 num_rcvd; u8 err; @@ -247,43 +246,40 @@ struct be_rx_obj { struct be_drv_stats { u8 be_on_die_temperature; - u64 be_tx_events; - u64 eth_red_drops; - u64 rx_drops_no_pbuf; - u64 rx_drops_no_txpb; - u64 rx_drops_no_erx_descr; - u64 rx_drops_no_tpre_descr; - u64 rx_drops_too_many_frags; - u64 rx_drops_invalid_ring; - u64 forwarded_packets; - u64 rx_drops_mtu; - u64 rx_crc_errors; - u64 rx_alignment_symbol_errors; - u64 rx_pause_frames; - u64 rx_priority_pause_frames; - u64 rx_control_frames; - u64 rx_in_range_errors; - u64 rx_out_range_errors; - u64 rx_frame_too_long; - u64 rx_address_match_errors; - u64 rx_dropped_too_small; - u64 rx_dropped_too_short; - u64 rx_dropped_header_too_small; - u64 rx_dropped_tcp_length; - u64 rx_dropped_runt; - u64 rx_ip_checksum_errs; - u64 rx_tcp_checksum_errs; - u64 rx_udp_checksum_errs; - u64 rx_switched_unicast_packets; - u64 rx_switched_multicast_packets; - u64 rx_switched_broadcast_packets; - u64 tx_pauseframes; - u64 tx_priority_pauseframes; - u64 tx_controlframes; - u64 rxpp_fifo_overflow_drop; - u64 rx_input_fifo_overflow_drop; - u64 pmem_fifo_overflow_drop; - u64 jabber_events; + u32 tx_events; + u32 eth_red_drops; + u32 rx_drops_no_pbuf; + u32 rx_drops_no_txpb; + u32 rx_drops_no_erx_descr; + u32 rx_drops_no_tpre_descr; + u32 rx_drops_too_many_frags; + u32 rx_drops_invalid_ring; + u32 forwarded_packets; + u32 rx_drops_mtu; + u32 rx_crc_errors; + u32 rx_alignment_symbol_errors; + u32 rx_pause_frames; + u32 rx_priority_pause_frames; + u32 rx_control_frames; + u32 rx_in_range_errors; + u32 rx_out_range_errors; + u32 rx_frame_too_long; + u32 rx_address_match_errors; + u32 rx_dropped_too_small; + u32 rx_dropped_too_short; + u32 rx_dropped_header_too_small; + u32 rx_dropped_tcp_length; + u32 rx_dropped_runt; + u32 rx_ip_checksum_errs; + u32 rx_tcp_checksum_errs; + u32 rx_udp_checksum_errs; + u32 tx_pauseframes; + u32 tx_priority_pauseframes; + u32 tx_controlframes; + u32 rxpp_fifo_overflow_drop; + u32 rx_input_fifo_overflow_drop; + u32 pmem_fifo_overflow_drop; + u32 jabber_events; }; struct be_vf_cfg { @@ -338,7 +334,7 @@ struct be_adapter { u8 vlan_tag[VLAN_N_VID]; u8 vlan_prio_bmap; /* Available Priority BitMap */ u16 recommended_prio; /* Recommended Priority */ - struct be_dma_mem mc_cmd_mem; + struct be_dma_mem rx_filter; /* Cmd DMA mem for rx-filter */ struct be_dma_mem stats_cmd; /* Work queue used to perform periodic tasks like getting statistics */ @@ -385,6 +381,8 @@ struct be_adapter { #define BE_GEN2 2 #define BE_GEN3 3 +#define ON 1 +#define OFF 0 #define lancer_chip(adapter) ((adapter->pdev->device == OC_DEVICE_ID3) || \ (adapter->pdev->device == OC_DEVICE_ID4)) @@ -525,8 +523,7 @@ static inline bool be_multi_rxq(const struct be_adapter *adapter) extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, u16 num_popped); -extern void be_link_status_update(struct be_adapter *adapter, bool link_up); -extern void netdev_stats_update(struct be_adapter *adapter); +extern void be_link_status_update(struct be_adapter *adapter, u32 link_status); extern void be_parse_stats(struct be_adapter *adapter); extern int be_load_fw(struct be_adapter *adapter, u8 *func); #endif /* BE_H */ diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 054fa67bc4e3..427859532f02 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -82,28 +82,7 @@ static int be_mcc_compl_process(struct be_adapter *adapter, if (((compl->tag0 == OPCODE_ETH_GET_STATISTICS) || (compl->tag0 == OPCODE_ETH_GET_PPORT_STATS)) && (compl->tag1 == CMD_SUBSYSTEM_ETH)) { - if (adapter->generation == BE_GEN3) { - if (lancer_chip(adapter)) { - struct lancer_cmd_resp_pport_stats - *resp = adapter->stats_cmd.va; - be_dws_le_to_cpu(&resp->pport_stats, - sizeof(resp->pport_stats)); - } else { - struct be_cmd_resp_get_stats_v1 *resp = - adapter->stats_cmd.va; - - be_dws_le_to_cpu(&resp->hw_stats, - sizeof(resp->hw_stats)); - } - } else { - struct be_cmd_resp_get_stats_v0 *resp = - adapter->stats_cmd.va; - - be_dws_le_to_cpu(&resp->hw_stats, - sizeof(resp->hw_stats)); - } be_parse_stats(adapter); - netdev_stats_update(adapter); adapter->stats_cmd_sent = false; } } else { @@ -131,8 +110,7 @@ done: static void be_async_link_state_process(struct be_adapter *adapter, struct be_async_event_link_state *evt) { - be_link_status_update(adapter, - evt->port_link_status == ASYNC_EVENT_LINK_UP); + be_link_status_update(adapter, evt->port_link_status); } /* Grp5 CoS Priority evt */ @@ -1282,8 +1260,8 @@ err: } /* Uses synchronous mcc */ -int be_cmd_link_status_query(struct be_adapter *adapter, - bool *link_up, u8 *mac_speed, u16 *link_speed, u32 dom) +int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed, + u16 *link_speed, u32 dom) { struct be_mcc_wrb *wrb; struct be_cmd_req_link_status *req; @@ -1298,8 +1276,6 @@ int be_cmd_link_status_query(struct be_adapter *adapter, } req = embedded_payload(wrb); - *link_up = false; - be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0, OPCODE_COMMON_NTWK_LINK_STATUS_QUERY); @@ -1310,7 +1286,6 @@ int be_cmd_link_status_query(struct be_adapter *adapter, if (!status) { struct be_cmd_resp_link_status *resp = embedded_payload(wrb); if (resp->mac_speed != PHY_LINK_SPEED_ZERO) { - *link_up = true; *link_speed = le16_to_cpu(resp->link_speed); *mac_speed = resp->mac_speed; } @@ -1573,27 +1548,14 @@ err: return status; } -/* Uses MCC for this command as it may be called in BH context - * Uses synchronous mcc - */ -int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en) +int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value) { struct be_mcc_wrb *wrb; - struct be_cmd_req_rx_filter *req; - struct be_dma_mem promiscous_cmd; + struct be_dma_mem *mem = &adapter->rx_filter; + struct be_cmd_req_rx_filter *req = mem->va; struct be_sge *sge; int status; - memset(&promiscous_cmd, 0, sizeof(struct be_dma_mem)); - promiscous_cmd.size = sizeof(struct be_cmd_req_rx_filter); - promiscous_cmd.va = pci_alloc_consistent(adapter->pdev, - promiscous_cmd.size, &promiscous_cmd.dma); - if (!promiscous_cmd.va) { - dev_err(&adapter->pdev->dev, - "Memory allocation failure\n"); - return -ENOMEM; - } - spin_lock_bh(&adapter->mcc_lock); wrb = wrb_from_mccq(adapter); @@ -1601,80 +1563,37 @@ int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en) status = -EBUSY; goto err; } - - req = promiscous_cmd.va; sge = nonembedded_sgl(wrb); - - be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1, - OPCODE_COMMON_NTWK_RX_FILTER); - be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, - OPCODE_COMMON_NTWK_RX_FILTER, sizeof(*req)); - - req->if_id = cpu_to_le32(adapter->if_handle); - req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS); - if (en) - req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS); - - sge->pa_hi = cpu_to_le32(upper_32_bits(promiscous_cmd.dma)); - sge->pa_lo = cpu_to_le32(promiscous_cmd.dma & 0xFFFFFFFF); - sge->len = cpu_to_le32(promiscous_cmd.size); - - status = be_mcc_notify_wait(adapter); - -err: - spin_unlock_bh(&adapter->mcc_lock); - pci_free_consistent(adapter->pdev, promiscous_cmd.size, - promiscous_cmd.va, promiscous_cmd.dma); - return status; -} - -/* - * Uses MCC for this command as it may be called in BH context - * (mc == NULL) => multicast promiscuous - */ -int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, - struct net_device *netdev, struct be_dma_mem *mem) -{ - struct be_mcc_wrb *wrb; - struct be_cmd_req_mcast_mac_config *req = mem->va; - struct be_sge *sge; - int status; - - spin_lock_bh(&adapter->mcc_lock); - - wrb = wrb_from_mccq(adapter); - if (!wrb) { - status = -EBUSY; - goto err; - } - sge = nonembedded_sgl(wrb); - memset(req, 0, sizeof(*req)); - - be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1, - OPCODE_COMMON_NTWK_MULTICAST_SET); sge->pa_hi = cpu_to_le32(upper_32_bits(mem->dma)); sge->pa_lo = cpu_to_le32(mem->dma & 0xFFFFFFFF); sge->len = cpu_to_le32(mem->size); + be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1, + OPCODE_COMMON_NTWK_RX_FILTER); + memset(req, 0, sizeof(*req)); be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, - OPCODE_COMMON_NTWK_MULTICAST_SET, sizeof(*req)); + OPCODE_COMMON_NTWK_RX_FILTER, sizeof(*req)); - req->interface_id = if_id; - if (netdev) { - int i; + req->if_id = cpu_to_le32(adapter->if_handle); + if (flags & IFF_PROMISC) { + req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS | + BE_IF_FLAGS_VLAN_PROMISCUOUS); + if (value == ON) + req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS | + BE_IF_FLAGS_VLAN_PROMISCUOUS); + } else if (flags & IFF_ALLMULTI) { + req->if_flags_mask = req->if_flags = + cpu_to_le32(BE_IF_FLAGS_MCAST_PROMISCUOUS); + } else { struct netdev_hw_addr *ha; + int i = 0; - req->num_mac = cpu_to_le16(netdev_mc_count(netdev)); - - i = 0; - netdev_for_each_mc_addr(ha, netdev) - memcpy(req->mac[i++].byte, ha->addr, ETH_ALEN); - } else { - req->promiscuous = 1; + req->mcast_num = cpu_to_le16(netdev_mc_count(adapter->netdev)); + netdev_for_each_mc_addr(ha, adapter->netdev) + memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN); } status = be_mcc_notify_wait(adapter); - err: spin_unlock_bh(&adapter->mcc_lock); return status; @@ -2268,11 +2187,13 @@ err: return status; } -int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd) +int be_cmd_get_phy_info(struct be_adapter *adapter, + struct be_phy_info *phy_info) { struct be_mcc_wrb *wrb; struct be_cmd_req_get_phy_info *req; struct be_sge *sge; + struct be_dma_mem cmd; int status; spin_lock_bh(&adapter->mcc_lock); @@ -2282,8 +2203,16 @@ int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd) status = -EBUSY; goto err; } + cmd.size = sizeof(struct be_cmd_req_get_phy_info); + cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, + &cmd.dma); + if (!cmd.va) { + dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); + status = -ENOMEM; + goto err; + } - req = cmd->va; + req = cmd.va; sge = nonembedded_sgl(wrb); be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1, @@ -2293,11 +2222,20 @@ int be_cmd_get_phy_info(struct be_adapter *adapter, struct be_dma_mem *cmd) OPCODE_COMMON_GET_PHY_DETAILS, sizeof(*req)); - sge->pa_hi = cpu_to_le32(upper_32_bits(cmd->dma)); - sge->pa_lo = cpu_to_le32(cmd->dma & 0xFFFFFFFF); - sge->len = cpu_to_le32(cmd->size); + sge->pa_hi = cpu_to_le32(upper_32_bits(cmd.dma)); + sge->pa_lo = cpu_to_le32(cmd.dma & 0xFFFFFFFF); + sge->len = cpu_to_le32(cmd.size); status = be_mcc_notify_wait(adapter); + if (!status) { + struct be_phy_info *resp_phy_info = + cmd.va + sizeof(struct be_cmd_req_hdr); + phy_info->phy_type = le16_to_cpu(resp_phy_info->phy_type); + phy_info->interface_type = + le16_to_cpu(resp_phy_info->interface_type); + } + pci_free_consistent(adapter->pdev, cmd.size, + cmd.va, cmd.dma); err: spin_unlock_bh(&adapter->mcc_lock); return status; diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index 8e4d48824fe9..b61eac7ece35 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h @@ -89,9 +89,10 @@ struct be_async_event_trailer { }; enum { - ASYNC_EVENT_LINK_DOWN = 0x0, - ASYNC_EVENT_LINK_UP = 0x1 + LINK_DOWN = 0x0, + LINK_UP = 0x1 }; +#define LINK_STATUS_MASK 0x1 /* When the event code of an async trailer is link-state, the mcc_compl * must be interpreted as follows @@ -693,8 +694,7 @@ struct be_cmd_resp_get_stats_v0 { struct be_hw_stats_v0 hw_stats; }; -#define make_64bit_val(hi_32, lo_32) (((u64)hi_32<<32) | lo_32) -struct lancer_cmd_pport_stats { +struct lancer_pport_stats { u32 tx_packets_lo; u32 tx_packets_hi; u32 tx_unicast_packets_lo; @@ -871,16 +871,16 @@ struct lancer_cmd_req_pport_stats { struct be_cmd_req_hdr hdr; union { struct pport_stats_params params; - u8 rsvd[sizeof(struct lancer_cmd_pport_stats)]; + u8 rsvd[sizeof(struct lancer_pport_stats)]; } cmd_params; }; struct lancer_cmd_resp_pport_stats { struct be_cmd_resp_hdr hdr; - struct lancer_cmd_pport_stats pport_stats; + struct lancer_pport_stats pport_stats; }; -static inline struct lancer_cmd_pport_stats* +static inline struct lancer_pport_stats* pport_stats_from_cmd(struct be_adapter *adapter) { struct lancer_cmd_resp_pport_stats *cmd = adapter->stats_cmd.va; @@ -910,21 +910,12 @@ struct be_cmd_req_vlan_config { u16 normal_vlan[64]; } __packed; -/******************** Multicast MAC Config *******************/ +/******************* RX FILTER ******************************/ #define BE_MAX_MC 64 /* set mcast promisc if > 64 */ struct macaddr { u8 byte[ETH_ALEN]; }; -struct be_cmd_req_mcast_mac_config { - struct be_cmd_req_hdr hdr; - u16 num_mac; - u8 promiscuous; - u8 interface_id; - struct macaddr mac[BE_MAX_MC]; -} __packed; - -/******************* RX FILTER ******************************/ struct be_cmd_req_rx_filter { struct be_cmd_req_hdr hdr; u32 global_flags_mask; @@ -932,11 +923,10 @@ struct be_cmd_req_rx_filter { u32 if_flags_mask; u32 if_flags; u32 if_id; - u32 multicast_num; - struct macaddr mac[BE_MAX_MC]; + u32 mcast_num; + struct macaddr mcast_mac[BE_MAX_MC]; }; - /******************** Link Status Query *******************/ struct be_cmd_req_link_status { struct be_cmd_req_hdr hdr; @@ -1254,14 +1244,19 @@ struct be_cmd_req_get_phy_info { struct be_cmd_req_hdr hdr; u8 rsvd0[24]; }; -struct be_cmd_resp_get_phy_info { - struct be_cmd_req_hdr hdr; + +struct be_phy_info { u16 phy_type; u16 interface_type; u32 misc_params; u32 future_use[4]; }; +struct be_cmd_resp_get_phy_info { + struct be_cmd_req_hdr hdr; + struct be_phy_info phy_info; +}; + /*********************** Set QOS ***********************/ #define BE_QOS_BITS_NIC 1 @@ -1383,8 +1378,7 @@ struct be_cmd_resp_get_stats_v1 { struct be_hw_stats_v1 hw_stats; }; -static inline void * -hw_stats_from_cmd(struct be_adapter *adapter) +static inline void *hw_stats_from_cmd(struct be_adapter *adapter) { if (adapter->generation == BE_GEN3) { struct be_cmd_resp_get_stats_v1 *cmd = adapter->stats_cmd.va; @@ -1397,34 +1391,6 @@ hw_stats_from_cmd(struct be_adapter *adapter) } } -static inline void *be_port_rxf_stats_from_cmd(struct be_adapter *adapter) -{ - if (adapter->generation == BE_GEN3) { - struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); - struct be_rxf_stats_v1 *rxf_stats = &hw_stats->rxf; - - return &rxf_stats->port[adapter->port_num]; - } else { - struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); - struct be_rxf_stats_v0 *rxf_stats = &hw_stats->rxf; - - return &rxf_stats->port[adapter->port_num]; - } -} - -static inline void *be_rxf_stats_from_cmd(struct be_adapter *adapter) -{ - if (adapter->generation == BE_GEN3) { - struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); - - return &hw_stats->rxf; - } else { - struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); - - return &hw_stats->rxf; - } -} - static inline void *be_erx_stats_from_cmd(struct be_adapter *adapter) { if (adapter->generation == BE_GEN3) { @@ -1438,19 +1404,6 @@ static inline void *be_erx_stats_from_cmd(struct be_adapter *adapter) } } -static inline void *be_pmem_stats_from_cmd(struct be_adapter *adapter) -{ - if (adapter->generation == BE_GEN3) { - struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); - - return &hw_stats->pmem; - } else { - struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); - - return &hw_stats->pmem; - } -} - extern int be_pci_fnum_get(struct be_adapter *adapter); extern int be_cmd_POST(struct be_adapter *adapter); extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, @@ -1485,7 +1438,7 @@ extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, extern int be_cmd_rxq_destroy(struct be_adapter *adapter, struct be_queue_info *q); extern int be_cmd_link_status_query(struct be_adapter *adapter, - bool *link_up, u8 *mac_speed, u16 *link_speed, u32 dom); + u8 *mac_speed, u16 *link_speed, u32 dom); extern int be_cmd_reset(struct be_adapter *adapter); extern int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd); @@ -1497,9 +1450,7 @@ extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd); extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, u32 num, bool untagged, bool promiscuous); -extern int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en); -extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, - struct net_device *netdev, struct be_dma_mem *mem); +extern int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status); extern int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc); extern int be_cmd_get_flow_control(struct be_adapter *adapter, @@ -1540,7 +1491,7 @@ extern int be_cmd_get_seeprom_data(struct be_adapter *adapter, extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, u8 loopback_type, u8 enable); extern int be_cmd_get_phy_info(struct be_adapter *adapter, - struct be_dma_mem *cmd); + struct be_phy_info *phy_info); extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); extern void be_detect_dump_ue(struct be_adapter *adapter); extern int be_cmd_get_die_temperature(struct be_adapter *adapter); diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 7fd8130d86ea..f144a6f99862 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c @@ -26,33 +26,18 @@ struct be_ethtool_stat { int offset; }; -enum {NETSTAT, DRVSTAT_TX, DRVSTAT_RX, ERXSTAT, - DRVSTAT}; +enum {DRVSTAT_TX, DRVSTAT_RX, DRVSTAT}; #define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \ offsetof(_struct, field) -#define NETSTAT_INFO(field) #field, NETSTAT,\ - FIELDINFO(struct net_device_stats,\ - field) #define DRVSTAT_TX_INFO(field) #field, DRVSTAT_TX,\ FIELDINFO(struct be_tx_stats, field) #define DRVSTAT_RX_INFO(field) #field, DRVSTAT_RX,\ FIELDINFO(struct be_rx_stats, field) -#define ERXSTAT_INFO(field) #field, ERXSTAT,\ - FIELDINFO(struct be_erx_stats_v1, field) #define DRVSTAT_INFO(field) #field, DRVSTAT,\ - FIELDINFO(struct be_drv_stats, \ - field) + FIELDINFO(struct be_drv_stats, field) static const struct be_ethtool_stat et_stats[] = { - {NETSTAT_INFO(rx_packets)}, - {NETSTAT_INFO(tx_packets)}, - {NETSTAT_INFO(rx_bytes)}, - {NETSTAT_INFO(tx_bytes)}, - {NETSTAT_INFO(rx_errors)}, - {NETSTAT_INFO(tx_errors)}, - {NETSTAT_INFO(rx_dropped)}, - {NETSTAT_INFO(tx_dropped)}, - {DRVSTAT_INFO(be_tx_events)}, + {DRVSTAT_INFO(tx_events)}, {DRVSTAT_INFO(rx_crc_errors)}, {DRVSTAT_INFO(rx_alignment_symbol_errors)}, {DRVSTAT_INFO(rx_pause_frames)}, @@ -71,9 +56,6 @@ static const struct be_ethtool_stat et_stats[] = { {DRVSTAT_INFO(rx_ip_checksum_errs)}, {DRVSTAT_INFO(rx_tcp_checksum_errs)}, {DRVSTAT_INFO(rx_udp_checksum_errs)}, - {DRVSTAT_INFO(rx_switched_unicast_packets)}, - {DRVSTAT_INFO(rx_switched_multicast_packets)}, - {DRVSTAT_INFO(rx_switched_broadcast_packets)}, {DRVSTAT_INFO(tx_pauseframes)}, {DRVSTAT_INFO(tx_controlframes)}, {DRVSTAT_INFO(rx_priority_pause_frames)}, @@ -92,28 +74,33 @@ static const struct be_ethtool_stat et_stats[] = { }; #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats) -/* Stats related to multi RX queues */ +/* Stats related to multi RX queues: get_stats routine assumes bytes, pkts + * are first and second members respectively. + */ static const struct be_ethtool_stat et_rx_stats[] = { - {DRVSTAT_RX_INFO(rx_bytes)}, - {DRVSTAT_RX_INFO(rx_pkts)}, - {DRVSTAT_RX_INFO(rx_rate)}, + {DRVSTAT_RX_INFO(rx_bytes)},/* If moving this member see above note */ + {DRVSTAT_RX_INFO(rx_pkts)}, /* If moving this member see above note */ {DRVSTAT_RX_INFO(rx_polls)}, {DRVSTAT_RX_INFO(rx_events)}, {DRVSTAT_RX_INFO(rx_compl)}, {DRVSTAT_RX_INFO(rx_mcast_pkts)}, {DRVSTAT_RX_INFO(rx_post_fail)}, - {DRVSTAT_RX_INFO(rx_dropped)}, - {ERXSTAT_INFO(rx_drops_no_fragments)} + {DRVSTAT_RX_INFO(rx_drops_no_skbs)}, + {DRVSTAT_RX_INFO(rx_drops_no_frags)} }; #define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats)) -/* Stats related to multi TX queues */ +/* Stats related to multi TX queues: get_stats routine assumes compl is the + * first member + */ static const struct be_ethtool_stat et_tx_stats[] = { - {DRVSTAT_TX_INFO(be_tx_rate)}, - {DRVSTAT_TX_INFO(be_tx_reqs)}, - {DRVSTAT_TX_INFO(be_tx_wrbs)}, - {DRVSTAT_TX_INFO(be_tx_stops)}, - {DRVSTAT_TX_INFO(be_tx_compl)} + {DRVSTAT_TX_INFO(tx_compl)}, /* If moving this member see above note */ + {DRVSTAT_TX_INFO(tx_bytes)}, + {DRVSTAT_TX_INFO(tx_pkts)}, + {DRVSTAT_TX_INFO(tx_reqs)}, + {DRVSTAT_TX_INFO(tx_wrbs)}, + {DRVSTAT_TX_INFO(tx_compl)}, + {DRVSTAT_TX_INFO(tx_stops)} }; #define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats)) @@ -260,50 +247,49 @@ be_get_ethtool_stats(struct net_device *netdev, struct be_adapter *adapter = netdev_priv(netdev); struct be_rx_obj *rxo; struct be_tx_obj *txo; - void *p = NULL; - int i, j, base; + void *p; + unsigned int i, j, base = 0, start; for (i = 0; i < ETHTOOL_STATS_NUM; i++) { - switch (et_stats[i].type) { - case NETSTAT: - p = &netdev->stats; - break; - case DRVSTAT: - p = &adapter->drv_stats; - break; - } - - p = (u8 *)p + et_stats[i].offset; - data[i] = (et_stats[i].size == sizeof(u64)) ? - *(u64 *)p: *(u32 *)p; + p = (u8 *)&adapter->drv_stats + et_stats[i].offset; + data[i] = *(u32 *)p; } + base += ETHTOOL_STATS_NUM; - base = ETHTOOL_STATS_NUM; for_all_rx_queues(adapter, rxo, j) { - for (i = 0; i < ETHTOOL_RXSTATS_NUM; i++) { - switch (et_rx_stats[i].type) { - case DRVSTAT_RX: - p = (u8 *)&rxo->stats + et_rx_stats[i].offset; - break; - case ERXSTAT: - p = (u32 *)be_erx_stats_from_cmd(adapter) + - rxo->q.id; - break; - } - data[base + j * ETHTOOL_RXSTATS_NUM + i] = - (et_rx_stats[i].size == sizeof(u64)) ? - *(u64 *)p: *(u32 *)p; + struct be_rx_stats *stats = rx_stats(rxo); + + do { + start = u64_stats_fetch_begin_bh(&stats->sync); + data[base] = stats->rx_bytes; + data[base + 1] = stats->rx_pkts; + } while (u64_stats_fetch_retry_bh(&stats->sync, start)); + + for (i = 2; i < ETHTOOL_RXSTATS_NUM; i++) { + p = (u8 *)stats + et_rx_stats[i].offset; + data[base + i] = *(u32 *)p; } + base += ETHTOOL_RXSTATS_NUM; } - base = ETHTOOL_STATS_NUM + adapter->num_rx_qs * ETHTOOL_RXSTATS_NUM; for_all_tx_queues(adapter, txo, j) { - for (i = 0; i < ETHTOOL_TXSTATS_NUM; i++) { - p = (u8 *)&txo->stats + et_tx_stats[i].offset; - data[base + j * ETHTOOL_TXSTATS_NUM + i] = - (et_tx_stats[i].size == sizeof(u64)) ? - *(u64 *)p: *(u32 *)p; - } + struct be_tx_stats *stats = tx_stats(txo); + + do { + start = u64_stats_fetch_begin_bh(&stats->sync_compl); + data[base] = stats->tx_compl; + } while (u64_stats_fetch_retry_bh(&stats->sync_compl, start)); + + do { + start = u64_stats_fetch_begin_bh(&stats->sync); + for (i = 1; i < ETHTOOL_TXSTATS_NUM; i++) { + p = (u8 *)stats + et_tx_stats[i].offset; + data[base + i] = + (et_tx_stats[i].size == sizeof(u64)) ? + *(u64 *)p : *(u32 *)p; + } + } while (u64_stats_fetch_retry_bh(&stats->sync, start)); + base += ETHTOOL_TXSTATS_NUM; } } @@ -363,19 +349,15 @@ static int be_get_sset_count(struct net_device *netdev, int stringset) static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) { struct be_adapter *adapter = netdev_priv(netdev); - struct be_dma_mem phy_cmd; - struct be_cmd_resp_get_phy_info *resp; + struct be_phy_info phy_info; u8 mac_speed = 0; u16 link_speed = 0; - bool link_up = false; int status; - u16 intf_type; if ((adapter->link_speed < 0) || (!(netdev->flags & IFF_UP))) { - status = be_cmd_link_status_query(adapter, &link_up, - &mac_speed, &link_speed, 0); + status = be_cmd_link_status_query(adapter, &mac_speed, + &link_speed, 0); - be_link_status_update(adapter, link_up); /* link_speed is in units of 10 Mbps */ if (link_speed) { ethtool_cmd_speed_set(ecmd, link_speed*10); @@ -399,20 +381,9 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) } } - phy_cmd.size = sizeof(struct be_cmd_req_get_phy_info); - phy_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, - phy_cmd.size, &phy_cmd.dma, - GFP_KERNEL); - if (!phy_cmd.va) { - dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); - return -ENOMEM; - } - status = be_cmd_get_phy_info(adapter, &phy_cmd); + status = be_cmd_get_phy_info(adapter, &phy_info); if (!status) { - resp = phy_cmd.va; - intf_type = le16_to_cpu(resp->interface_type); - - switch (intf_type) { + switch (phy_info.interface_type) { case PHY_TYPE_XFP_10GB: case PHY_TYPE_SFP_1GB: case PHY_TYPE_SFP_PLUS_10GB: @@ -423,7 +394,7 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) break; } - switch (intf_type) { + switch (phy_info.interface_type) { case PHY_TYPE_KR_10GB: case PHY_TYPE_KX4_10GB: ecmd->autoneg = AUTONEG_ENABLE; @@ -441,8 +412,6 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) adapter->port_type = ecmd->port; adapter->transceiver = ecmd->transceiver; adapter->autoneg = ecmd->autoneg; - dma_free_coherent(&adapter->pdev->dev, phy_cmd.size, phy_cmd.va, - phy_cmd.dma); } else { ethtool_cmd_speed_set(ecmd, adapter->link_speed); ecmd->port = adapter->port_type; @@ -631,7 +600,6 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) { struct be_adapter *adapter = netdev_priv(netdev); - bool link_up; u8 mac_speed = 0; u16 qos_link_speed = 0; @@ -657,7 +625,7 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) test->flags |= ETH_TEST_FL_FAILED; } - if (be_cmd_link_status_query(adapter, &link_up, &mac_speed, + if (be_cmd_link_status_query(adapter, &mac_speed, &qos_link_speed, 0) != 0) { test->flags |= ETH_TEST_FL_FAILED; data[4] = -1; diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h index 53d658afea2a..fbc8a915519e 100644 --- a/drivers/net/benet/be_hw.h +++ b/drivers/net/benet/be_hw.h @@ -175,18 +175,24 @@ #define IMG_TYPE_FCOE_FW_ACTIVE 10 #define IMG_TYPE_FCOE_FW_BACKUP 11 #define IMG_TYPE_NCSI_FW 13 +#define IMG_TYPE_PHY_FW 99 +#define TN_8022 13 +#define ILLEGAL_IOCTL_REQ 2 +#define FLASHROM_OPER_PHY_FLASH 9 +#define FLASHROM_OPER_PHY_SAVE 10 #define FLASHROM_OPER_FLASH 1 #define FLASHROM_OPER_SAVE 2 #define FLASHROM_OPER_REPORT 4 -#define FLASH_IMAGE_MAX_SIZE_g2 (1310720) /* Max firmware image sz */ -#define FLASH_BIOS_IMAGE_MAX_SIZE_g2 (262144) /* Max OPTION ROM img sz */ -#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 (262144) /* Max Redboot image sz */ -#define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max fw image size */ -#define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM img sz */ -#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */ -#define FLASH_NCSI_IMAGE_MAX_SIZE_g3 (262144) /* Max NSCI image sz */ +#define FLASH_IMAGE_MAX_SIZE_g2 (1310720) /* Max firmware image size */ +#define FLASH_BIOS_IMAGE_MAX_SIZE_g2 (262144) /* Max OPTION ROM image sz */ +#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 (262144) /* Max Redboot image sz */ +#define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max firmware image size */ +#define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM image sz */ +#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */ +#define FLASH_NCSI_IMAGE_MAX_SIZE_g3 (262144) +#define FLASH_PHY_FW_IMAGE_MAX_SIZE_g3 262144 #define FLASH_NCSI_MAGIC (0x16032009) #define FLASH_NCSI_DISABLED (0) @@ -213,6 +219,7 @@ #define FLASH_PXE_BIOS_START_g3 (13107200) #define FLASH_FCoE_BIOS_START_g3 (13631488) #define FLASH_REDBOOT_START_g3 (262144) +#define FLASH_PHY_FW_START_g3 1310720 /************* Rx Packet Type Encoding **************/ #define BE_UNICAST_PACKET 0 diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index c411bb1845fd..1a3accab3d17 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c @@ -245,14 +245,14 @@ netdev_addr: static void populate_be2_stats(struct be_adapter *adapter) { - - struct be_drv_stats *drvs = &adapter->drv_stats; - struct be_pmem_stats *pmem_sts = be_pmem_stats_from_cmd(adapter); + struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter); + struct be_pmem_stats *pmem_sts = &hw_stats->pmem; + struct be_rxf_stats_v0 *rxf_stats = &hw_stats->rxf; struct be_port_rxf_stats_v0 *port_stats = - be_port_rxf_stats_from_cmd(adapter); - struct be_rxf_stats_v0 *rxf_stats = - be_rxf_stats_from_cmd(adapter); + &rxf_stats->port[adapter->port_num]; + struct be_drv_stats *drvs = &adapter->drv_stats; + be_dws_le_to_cpu(hw_stats, sizeof(*hw_stats)); drvs->rx_pause_frames = port_stats->rx_pause_frames; drvs->rx_crc_errors = port_stats->rx_crc_errors; drvs->rx_control_frames = port_stats->rx_control_frames; @@ -267,12 +267,10 @@ static void populate_be2_stats(struct be_adapter *adapter) drvs->rx_dropped_too_small = port_stats->rx_dropped_too_small; drvs->rx_dropped_too_short = port_stats->rx_dropped_too_short; drvs->rx_out_range_errors = port_stats->rx_out_range_errors; - drvs->rx_input_fifo_overflow_drop = - port_stats->rx_input_fifo_overflow; + drvs->rx_input_fifo_overflow_drop = port_stats->rx_input_fifo_overflow; drvs->rx_dropped_header_too_small = port_stats->rx_dropped_header_too_small; - drvs->rx_address_match_errors = - port_stats->rx_address_match_errors; + drvs->rx_address_match_errors = port_stats->rx_address_match_errors; drvs->rx_alignment_symbol_errors = port_stats->rx_alignment_symbol_errors; @@ -280,36 +278,30 @@ static void populate_be2_stats(struct be_adapter *adapter) drvs->tx_controlframes = port_stats->tx_controlframes; if (adapter->port_num) - drvs->jabber_events = - rxf_stats->port1_jabber_events; + drvs->jabber_events = rxf_stats->port1_jabber_events; else - drvs->jabber_events = - rxf_stats->port0_jabber_events; + drvs->jabber_events = rxf_stats->port0_jabber_events; drvs->rx_drops_no_pbuf = rxf_stats->rx_drops_no_pbuf; drvs->rx_drops_no_txpb = rxf_stats->rx_drops_no_txpb; drvs->rx_drops_no_erx_descr = rxf_stats->rx_drops_no_erx_descr; drvs->rx_drops_invalid_ring = rxf_stats->rx_drops_invalid_ring; drvs->forwarded_packets = rxf_stats->forwarded_packets; drvs->rx_drops_mtu = rxf_stats->rx_drops_mtu; - drvs->rx_drops_no_tpre_descr = - rxf_stats->rx_drops_no_tpre_descr; - drvs->rx_drops_too_many_frags = - rxf_stats->rx_drops_too_many_frags; + drvs->rx_drops_no_tpre_descr = rxf_stats->rx_drops_no_tpre_descr; + drvs->rx_drops_too_many_frags = rxf_stats->rx_drops_too_many_frags; adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops; } static void populate_be3_stats(struct be_adapter *adapter) { - struct be_drv_stats *drvs = &adapter->drv_stats; - struct be_pmem_stats *pmem_sts = be_pmem_stats_from_cmd(adapter); - - struct be_rxf_stats_v1 *rxf_stats = - be_rxf_stats_from_cmd(adapter); + struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter); + struct be_pmem_stats *pmem_sts = &hw_stats->pmem; + struct be_rxf_stats_v1 *rxf_stats = &hw_stats->rxf; struct be_port_rxf_stats_v1 *port_stats = - be_port_rxf_stats_from_cmd(adapter); + &rxf_stats->port[adapter->port_num]; + struct be_drv_stats *drvs = &adapter->drv_stats; - drvs->rx_priority_pause_frames = 0; - drvs->pmem_fifo_overflow_drop = 0; + be_dws_le_to_cpu(hw_stats, sizeof(*hw_stats)); drvs->rx_pause_frames = port_stats->rx_pause_frames; drvs->rx_crc_errors = port_stats->rx_crc_errors; drvs->rx_control_frames = port_stats->rx_control_frames; @@ -327,12 +319,10 @@ static void populate_be3_stats(struct be_adapter *adapter) port_stats->rx_dropped_header_too_small; drvs->rx_input_fifo_overflow_drop = port_stats->rx_input_fifo_overflow_drop; - drvs->rx_address_match_errors = - port_stats->rx_address_match_errors; + drvs->rx_address_match_errors = port_stats->rx_address_match_errors; drvs->rx_alignment_symbol_errors = port_stats->rx_alignment_symbol_errors; - drvs->rxpp_fifo_overflow_drop = - port_stats->rxpp_fifo_overflow_drop; + drvs->rxpp_fifo_overflow_drop = port_stats->rxpp_fifo_overflow_drop; drvs->tx_pauseframes = port_stats->tx_pauseframes; drvs->tx_controlframes = port_stats->tx_controlframes; drvs->jabber_events = port_stats->jabber_events; @@ -342,10 +332,8 @@ static void populate_be3_stats(struct be_adapter *adapter) drvs->rx_drops_invalid_ring = rxf_stats->rx_drops_invalid_ring; drvs->forwarded_packets = rxf_stats->forwarded_packets; drvs->rx_drops_mtu = rxf_stats->rx_drops_mtu; - drvs->rx_drops_no_tpre_descr = - rxf_stats->rx_drops_no_tpre_descr; - drvs->rx_drops_too_many_frags = - rxf_stats->rx_drops_too_many_frags; + drvs->rx_drops_no_tpre_descr = rxf_stats->rx_drops_no_tpre_descr; + drvs->rx_drops_too_many_frags = rxf_stats->rx_drops_too_many_frags; adapter->drv_stats.eth_red_drops = pmem_sts->eth_red_drops; } @@ -353,22 +341,15 @@ static void populate_lancer_stats(struct be_adapter *adapter) { struct be_drv_stats *drvs = &adapter->drv_stats; - struct lancer_cmd_pport_stats *pport_stats = pport_stats_from_cmd - (adapter); - drvs->rx_priority_pause_frames = 0; - drvs->pmem_fifo_overflow_drop = 0; - drvs->rx_pause_frames = - make_64bit_val(pport_stats->rx_pause_frames_hi, - pport_stats->rx_pause_frames_lo); - drvs->rx_crc_errors = make_64bit_val(pport_stats->rx_crc_errors_hi, - pport_stats->rx_crc_errors_lo); - drvs->rx_control_frames = - make_64bit_val(pport_stats->rx_control_frames_hi, - pport_stats->rx_control_frames_lo); + struct lancer_pport_stats *pport_stats = + pport_stats_from_cmd(adapter); + + be_dws_le_to_cpu(pport_stats, sizeof(*pport_stats)); + drvs->rx_pause_frames = pport_stats->rx_pause_frames_lo; + drvs->rx_crc_errors = pport_stats->rx_crc_errors_lo; + drvs->rx_control_frames = pport_stats->rx_control_frames_lo; drvs->rx_in_range_errors = pport_stats->rx_in_range_errors; - drvs->rx_frame_too_long = - make_64bit_val(pport_stats->rx_internal_mac_errors_hi, - pport_stats->rx_frames_too_long_lo); + drvs->rx_frame_too_long = pport_stats->rx_frames_too_long_lo; drvs->rx_dropped_runt = pport_stats->rx_dropped_runt; drvs->rx_ip_checksum_errs = pport_stats->rx_ip_checksum_errors; drvs->rx_tcp_checksum_errs = pport_stats->rx_tcp_checksum_errors; @@ -382,32 +363,24 @@ static void populate_lancer_stats(struct be_adapter *adapter) pport_stats->rx_dropped_header_too_small; drvs->rx_input_fifo_overflow_drop = pport_stats->rx_fifo_overflow; drvs->rx_address_match_errors = pport_stats->rx_address_match_errors; - drvs->rx_alignment_symbol_errors = - make_64bit_val(pport_stats->rx_symbol_errors_hi, - pport_stats->rx_symbol_errors_lo); + drvs->rx_alignment_symbol_errors = pport_stats->rx_symbol_errors_lo; drvs->rxpp_fifo_overflow_drop = pport_stats->rx_fifo_overflow; - drvs->tx_pauseframes = make_64bit_val(pport_stats->tx_pause_frames_hi, - pport_stats->tx_pause_frames_lo); - drvs->tx_controlframes = - make_64bit_val(pport_stats->tx_control_frames_hi, - pport_stats->tx_control_frames_lo); + drvs->tx_pauseframes = pport_stats->tx_pause_frames_lo; + drvs->tx_controlframes = pport_stats->tx_control_frames_lo; drvs->jabber_events = pport_stats->rx_jabbers; - drvs->rx_drops_no_pbuf = 0; - drvs->rx_drops_no_txpb = 0; - drvs->rx_drops_no_erx_descr = 0; drvs->rx_drops_invalid_ring = pport_stats->rx_drops_invalid_queue; - drvs->forwarded_packets = make_64bit_val(pport_stats->num_forwards_hi, - pport_stats->num_forwards_lo); - drvs->rx_drops_mtu = make_64bit_val(pport_stats->rx_drops_mtu_hi, - pport_stats->rx_drops_mtu_lo); - drvs->rx_drops_no_tpre_descr = 0; + drvs->forwarded_packets = pport_stats->num_forwards_lo; + drvs->rx_drops_mtu = pport_stats->rx_drops_mtu_lo; drvs->rx_drops_too_many_frags = - make_64bit_val(pport_stats->rx_drops_too_many_frags_hi, - pport_stats->rx_drops_too_many_frags_lo); + pport_stats->rx_drops_too_many_frags_lo; } void be_parse_stats(struct be_adapter *adapter) { + struct be_erx_stats_v1 *erx = be_erx_stats_from_cmd(adapter); + struct be_rx_obj *rxo; + int i; + if (adapter->generation == BE_GEN3) { if (lancer_chip(adapter)) populate_lancer_stats(adapter); @@ -416,50 +389,51 @@ void be_parse_stats(struct be_adapter *adapter) } else { populate_be2_stats(adapter); } + + /* as erx_v1 is longer than v0, ok to use v1 defn for v0 access */ + for_all_rx_queues(adapter, rxo, i) + rx_stats(rxo)->rx_drops_no_frags = + erx->rx_drops_no_fragments[rxo->q.id]; } -void netdev_stats_update(struct be_adapter *adapter) +static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev, + struct rtnl_link_stats64 *stats) { + struct be_adapter *adapter = netdev_priv(netdev); struct be_drv_stats *drvs = &adapter->drv_stats; - struct net_device_stats *dev_stats = &adapter->netdev->stats; struct be_rx_obj *rxo; struct be_tx_obj *txo; - unsigned long pkts = 0, bytes = 0, mcast = 0, drops = 0; + u64 pkts, bytes; + unsigned int start; int i; for_all_rx_queues(adapter, rxo, i) { - pkts += rx_stats(rxo)->rx_pkts; - bytes += rx_stats(rxo)->rx_bytes; - mcast += rx_stats(rxo)->rx_mcast_pkts; - drops += rx_stats(rxo)->rx_dropped; - /* no space in linux buffers: best possible approximation */ - if (adapter->generation == BE_GEN3) { - if (!(lancer_chip(adapter))) { - struct be_erx_stats_v1 *erx = - be_erx_stats_from_cmd(adapter); - drops += erx->rx_drops_no_fragments[rxo->q.id]; - } - } else { - struct be_erx_stats_v0 *erx = - be_erx_stats_from_cmd(adapter); - drops += erx->rx_drops_no_fragments[rxo->q.id]; - } + const struct be_rx_stats *rx_stats = rx_stats(rxo); + do { + start = u64_stats_fetch_begin_bh(&rx_stats->sync); + pkts = rx_stats(rxo)->rx_pkts; + bytes = rx_stats(rxo)->rx_bytes; + } while (u64_stats_fetch_retry_bh(&rx_stats->sync, start)); + stats->rx_packets += pkts; + stats->rx_bytes += bytes; + stats->multicast += rx_stats(rxo)->rx_mcast_pkts; + stats->rx_dropped += rx_stats(rxo)->rx_drops_no_skbs + + rx_stats(rxo)->rx_drops_no_frags; } - dev_stats->rx_packets = pkts; - dev_stats->rx_bytes = bytes; - dev_stats->multicast = mcast; - dev_stats->rx_dropped = drops; - pkts = bytes = 0; for_all_tx_queues(adapter, txo, i) { - pkts += tx_stats(txo)->be_tx_pkts; - bytes += tx_stats(txo)->be_tx_bytes; + const struct be_tx_stats *tx_stats = tx_stats(txo); + do { + start = u64_stats_fetch_begin_bh(&tx_stats->sync); + pkts = tx_stats(txo)->tx_pkts; + bytes = tx_stats(txo)->tx_bytes; + } while (u64_stats_fetch_retry_bh(&tx_stats->sync, start)); + stats->tx_packets += pkts; + stats->tx_bytes += bytes; } - dev_stats->tx_packets = pkts; - dev_stats->tx_bytes = bytes; /* bad pkts received */ - dev_stats->rx_errors = drvs->rx_crc_errors + + stats->rx_errors = drvs->rx_crc_errors + drvs->rx_alignment_symbol_errors + drvs->rx_in_range_errors + drvs->rx_out_range_errors + @@ -468,115 +442,38 @@ void netdev_stats_update(struct be_adapter *adapter) drvs->rx_dropped_too_short + drvs->rx_dropped_header_too_small + drvs->rx_dropped_tcp_length + - drvs->rx_dropped_runt + - drvs->rx_tcp_checksum_errs + - drvs->rx_ip_checksum_errs + - drvs->rx_udp_checksum_errs; + drvs->rx_dropped_runt; /* detailed rx errors */ - dev_stats->rx_length_errors = drvs->rx_in_range_errors + + stats->rx_length_errors = drvs->rx_in_range_errors + drvs->rx_out_range_errors + drvs->rx_frame_too_long; - dev_stats->rx_crc_errors = drvs->rx_crc_errors; + stats->rx_crc_errors = drvs->rx_crc_errors; /* frame alignment errors */ - dev_stats->rx_frame_errors = drvs->rx_alignment_symbol_errors; + stats->rx_frame_errors = drvs->rx_alignment_symbol_errors; /* receiver fifo overrun */ /* drops_no_pbuf is no per i/f, it's per BE card */ - dev_stats->rx_fifo_errors = drvs->rxpp_fifo_overflow_drop + + stats->rx_fifo_errors = drvs->rxpp_fifo_overflow_drop + drvs->rx_input_fifo_overflow_drop + drvs->rx_drops_no_pbuf; + return stats; } -void be_link_status_update(struct be_adapter *adapter, bool link_up) +void be_link_status_update(struct be_adapter *adapter, u32 link_status) { struct net_device *netdev = adapter->netdev; - /* If link came up or went down */ - if (adapter->link_up != link_up) { - adapter->link_speed = -1; - if (link_up) { - netif_carrier_on(netdev); - printk(KERN_INFO "%s: Link up\n", netdev->name); - } else { - netif_carrier_off(netdev); - printk(KERN_INFO "%s: Link down\n", netdev->name); - } - adapter->link_up = link_up; - } -} - -/* Update the EQ delay n BE based on the RX frags consumed / sec */ -static void be_rx_eqd_update(struct be_adapter *adapter, struct be_rx_obj *rxo) -{ - struct be_eq_obj *rx_eq = &rxo->rx_eq; - struct be_rx_stats *stats = &rxo->stats; - ulong now = jiffies; - u32 eqd; - - if (!rx_eq->enable_aic) - return; - - /* Wrapped around */ - if (time_before(now, stats->rx_fps_jiffies)) { - stats->rx_fps_jiffies = now; - return; - } - - /* Update once a second */ - if ((now - stats->rx_fps_jiffies) < HZ) - return; - - stats->rx_fps = (stats->rx_frags - stats->prev_rx_frags) / - ((now - stats->rx_fps_jiffies) / HZ); - - stats->rx_fps_jiffies = now; - stats->prev_rx_frags = stats->rx_frags; - eqd = stats->rx_fps / 110000; - eqd = eqd << 3; - if (eqd > rx_eq->max_eqd) - eqd = rx_eq->max_eqd; - if (eqd < rx_eq->min_eqd) - eqd = rx_eq->min_eqd; - if (eqd < 10) - eqd = 0; - if (eqd != rx_eq->cur_eqd) - be_cmd_modify_eqd(adapter, rx_eq->q.id, eqd); - - rx_eq->cur_eqd = eqd; -} - -static u32 be_calc_rate(u64 bytes, unsigned long ticks) -{ - u64 rate = bytes; - - do_div(rate, ticks / HZ); - rate <<= 3; /* bytes/sec -> bits/sec */ - do_div(rate, 1000000ul); /* MB/Sec */ - - return rate; -} - -static void be_tx_rate_update(struct be_tx_obj *txo) -{ - struct be_tx_stats *stats = tx_stats(txo); - ulong now = jiffies; - - /* Wrapped around? */ - if (time_before(now, stats->be_tx_jiffies)) { - stats->be_tx_jiffies = now; - return; - } - - /* Update tx rate once in two seconds */ - if ((now - stats->be_tx_jiffies) > 2 * HZ) { - stats->be_tx_rate = be_calc_rate(stats->be_tx_bytes - - stats->be_tx_bytes_prev, - now - stats->be_tx_jiffies); - stats->be_tx_jiffies = now; - stats->be_tx_bytes_prev = stats->be_tx_bytes; + /* when link status changes, link speed must be re-queried from card */ + adapter->link_speed = -1; + if ((link_status & LINK_STATUS_MASK) == LINK_UP) { + netif_carrier_on(netdev); + dev_info(&adapter->pdev->dev, "%s: Link up\n", netdev->name); + } else { + netif_carrier_off(netdev); + dev_info(&adapter->pdev->dev, "%s: Link down\n", netdev->name); } } @@ -585,12 +482,14 @@ static void be_tx_stats_update(struct be_tx_obj *txo, { struct be_tx_stats *stats = tx_stats(txo); - stats->be_tx_reqs++; - stats->be_tx_wrbs += wrb_cnt; - stats->be_tx_bytes += copied; - stats->be_tx_pkts += (gso_segs ? gso_segs : 1); + u64_stats_update_begin(&stats->sync); + stats->tx_reqs++; + stats->tx_wrbs += wrb_cnt; + stats->tx_bytes += copied; + stats->tx_pkts += (gso_segs ? gso_segs : 1); if (stopped) - stats->be_tx_stops++; + stats->tx_stops++; + u64_stats_update_end(&stats->sync); } /* Determine number of WRB entries needed to xmit data in an skb */ @@ -829,6 +728,10 @@ static int be_vid_config(struct be_adapter *adapter, bool vf, u32 vf_num) status = be_cmd_vlan_config(adapter, if_handle, vtag, 1, 1, 0); } + /* No need to further configure vids if in promiscuous mode */ + if (adapter->promiscuous) + return 0; + if (adapter->vlans_added <= adapter->max_vlans) { /* Construct VLAN Table to give to HW */ for (i = 0; i < VLAN_N_VID; i++) { @@ -879,7 +782,7 @@ static void be_set_multicast_list(struct net_device *netdev) struct be_adapter *adapter = netdev_priv(netdev); if (netdev->flags & IFF_PROMISC) { - be_cmd_promiscuous_config(adapter, true); + be_cmd_rx_filter(adapter, IFF_PROMISC, ON); adapter->promiscuous = true; goto done; } @@ -887,19 +790,20 @@ static void be_set_multicast_list(struct net_device *netdev) /* BE was previously in promiscuous mode; disable it */ if (adapter->promiscuous) { adapter->promiscuous = false; - be_cmd_promiscuous_config(adapter, false); + be_cmd_rx_filter(adapter, IFF_PROMISC, OFF); + + if (adapter->vlans_added) + be_vid_config(adapter, false, 0); } /* Enable multicast promisc if num configured exceeds what we support */ if (netdev->flags & IFF_ALLMULTI || - netdev_mc_count(netdev) > BE_MAX_MC) { - be_cmd_multicast_set(adapter, adapter->if_handle, NULL, - &adapter->mc_cmd_mem); + netdev_mc_count(netdev) > BE_MAX_MC) { + be_cmd_rx_filter(adapter, IFF_ALLMULTI, ON); goto done; } - be_cmd_multicast_set(adapter, adapter->if_handle, netdev, - &adapter->mc_cmd_mem); + be_cmd_rx_filter(adapter, IFF_MULTICAST, ON); done: return; } @@ -1005,10 +909,17 @@ static int be_set_vf_tx_rate(struct net_device *netdev, return status; } -static void be_rx_rate_update(struct be_rx_obj *rxo) +static void be_rx_eqd_update(struct be_adapter *adapter, struct be_rx_obj *rxo) { - struct be_rx_stats *stats = &rxo->stats; + struct be_eq_obj *rx_eq = &rxo->rx_eq; + struct be_rx_stats *stats = rx_stats(rxo); ulong now = jiffies; + ulong delta = now - stats->rx_jiffies; + u64 pkts; + unsigned int start, eqd; + + if (!rx_eq->enable_aic) + return; /* Wrapped around */ if (time_before(now, stats->rx_jiffies)) { @@ -1016,29 +927,46 @@ static void be_rx_rate_update(struct be_rx_obj *rxo) return; } - /* Update the rate once in two seconds */ - if ((now - stats->rx_jiffies) < 2 * HZ) + /* Update once a second */ + if (delta < HZ) return; - stats->rx_rate = be_calc_rate(stats->rx_bytes - stats->rx_bytes_prev, - now - stats->rx_jiffies); + do { + start = u64_stats_fetch_begin_bh(&stats->sync); + pkts = stats->rx_pkts; + } while (u64_stats_fetch_retry_bh(&stats->sync, start)); + + stats->rx_pps = (pkts - stats->rx_pkts_prev) / (delta / HZ); + stats->rx_pkts_prev = pkts; stats->rx_jiffies = now; - stats->rx_bytes_prev = stats->rx_bytes; + eqd = stats->rx_pps / 110000; + eqd = eqd << 3; + if (eqd > rx_eq->max_eqd) + eqd = rx_eq->max_eqd; + if (eqd < rx_eq->min_eqd) + eqd = rx_eq->min_eqd; + if (eqd < 10) + eqd = 0; + if (eqd != rx_eq->cur_eqd) { + be_cmd_modify_eqd(adapter, rx_eq->q.id, eqd); + rx_eq->cur_eqd = eqd; + } } static void be_rx_stats_update(struct be_rx_obj *rxo, struct be_rx_compl_info *rxcp) { - struct be_rx_stats *stats = &rxo->stats; + struct be_rx_stats *stats = rx_stats(rxo); + u64_stats_update_begin(&stats->sync); stats->rx_compl++; - stats->rx_frags += rxcp->num_rcvd; stats->rx_bytes += rxcp->pkt_size; stats->rx_pkts++; if (rxcp->pkt_type == BE_MULTICAST_PACKET) stats->rx_mcast_pkts++; if (rxcp->err) - stats->rxcp_err++; + stats->rx_compl_err++; + u64_stats_update_end(&stats->sync); } static inline bool csum_passed(struct be_rx_compl_info *rxcp) @@ -1174,7 +1102,7 @@ static void be_rx_compl_process(struct be_adapter *adapter, skb = netdev_alloc_skb_ip_align(netdev, BE_HDR_LEN); if (unlikely(!skb)) { - rxo->stats.rx_dropped++; + rx_stats(rxo)->rx_drops_no_skbs++; be_rx_compl_discard(adapter, rxo, rxcp); return; } @@ -1285,6 +1213,7 @@ static void be_parse_rx_compl_v1(struct be_adapter *adapter, rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag, compl); } + rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, port, compl); } static void be_parse_rx_compl_v0(struct be_adapter *adapter, @@ -1317,6 +1246,7 @@ static void be_parse_rx_compl_v0(struct be_adapter *adapter, rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag, compl); } + rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl); } static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) @@ -1389,7 +1319,7 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp) if (!pagep) { pagep = be_alloc_pages(adapter->big_page_size, gfp); if (unlikely(!pagep)) { - rxo->stats.rx_post_fail++; + rx_stats(rxo)->rx_post_fail++; break; } page_dmaaddr = dma_map_page(&adapter->pdev->dev, pagep, @@ -1899,22 +1829,36 @@ static int be_poll_rx(struct napi_struct *napi, int budget) struct be_rx_compl_info *rxcp; u32 work_done; - rxo->stats.rx_polls++; + rx_stats(rxo)->rx_polls++; for (work_done = 0; work_done < budget; work_done++) { rxcp = be_rx_compl_get(rxo); if (!rxcp) break; - /* Ignore flush completions */ - if (rxcp->num_rcvd && rxcp->pkt_size) { - if (do_gro(rxcp)) - be_rx_compl_process_gro(adapter, rxo, rxcp); - else - be_rx_compl_process(adapter, rxo, rxcp); - } else if (rxcp->pkt_size == 0) { + /* Is it a flush compl that has no data */ + if (unlikely(rxcp->num_rcvd == 0)) + goto loop_continue; + + /* Discard compl with partial DMA Lancer B0 */ + if (unlikely(!rxcp->pkt_size)) { be_rx_compl_discard(adapter, rxo, rxcp); + goto loop_continue; } + /* On BE drop pkts that arrive due to imperfect filtering in + * promiscuous mode on some skews + */ + if (unlikely(rxcp->port != adapter->port_num && + !lancer_chip(adapter))) { + be_rx_compl_discard(adapter, rxo, rxcp); + goto loop_continue; + } + + if (do_gro(rxcp)) + be_rx_compl_process_gro(adapter, rxo, rxcp); + else + be_rx_compl_process(adapter, rxo, rxcp); +loop_continue: be_rx_stats_update(rxo, rxcp); } @@ -1968,8 +1912,9 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget) netif_wake_subqueue(adapter->netdev, i); } - adapter->drv_stats.be_tx_events++; - txo->stats.be_tx_compl += tx_compl; + u64_stats_update_begin(&tx_stats(txo)->sync_compl); + tx_stats(txo)->tx_compl += tx_compl; + u64_stats_update_end(&tx_stats(txo)->sync_compl); } } @@ -1983,6 +1928,7 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget) napi_complete(napi); be_eq_notify(adapter, tx_eq->q.id, true, false, 0); + adapter->drv_stats.tx_events++; return 1; } @@ -2031,7 +1977,6 @@ static void be_worker(struct work_struct *work) struct be_adapter *adapter = container_of(work, struct be_adapter, work.work); struct be_rx_obj *rxo; - struct be_tx_obj *txo; int i; if (!adapter->ue_detected && !lancer_chip(adapter)) @@ -2060,11 +2005,7 @@ static void be_worker(struct work_struct *work) be_cmd_get_stats(adapter, &adapter->stats_cmd); } - for_all_tx_queues(adapter, txo, i) - be_tx_rate_update(txo); - for_all_rx_queues(adapter, rxo, i) { - be_rx_rate_update(rxo); be_rx_eqd_update(adapter, rxo); if (rxo->rx_post_starved) { @@ -2294,9 +2235,6 @@ static int be_close(struct net_device *netdev) be_async_mcc_disable(adapter); - netif_carrier_off(netdev); - adapter->link_up = false; - if (!lancer_chip(adapter)) be_intr_set(adapter, false); @@ -2374,10 +2312,7 @@ static int be_open(struct net_device *netdev) struct be_adapter *adapter = netdev_priv(netdev); struct be_eq_obj *tx_eq = &adapter->tx_eq; struct be_rx_obj *rxo; - bool link_up; int status, i; - u8 mac_speed; - u16 link_speed; status = be_rx_queues_setup(adapter); if (status) @@ -2400,12 +2335,6 @@ static int be_open(struct net_device *netdev) /* Now that interrupts are on we can process async mcc */ be_async_mcc_enable(adapter); - status = be_cmd_link_status_query(adapter, &link_up, &mac_speed, - &link_speed, 0); - if (status) - goto err; - be_link_status_update(adapter, link_up); - if (be_physfn(adapter)) { status = be_vid_config(adapter, false, 0); if (status) @@ -2656,6 +2585,21 @@ static bool be_flash_redboot(struct be_adapter *adapter, return true; } +static bool phy_flashing_required(struct be_adapter *adapter) +{ + int status = 0; + struct be_phy_info phy_info; + + status = be_cmd_get_phy_info(adapter, &phy_info); + if (status) + return false; + if ((phy_info.phy_type == TN_8022) && + (phy_info.interface_type == PHY_TYPE_BASET_10GB)) { + return true; + } + return false; +} + static int be_flash_data(struct be_adapter *adapter, const struct firmware *fw, struct be_dma_mem *flash_cmd, int num_of_images) @@ -2669,7 +2613,7 @@ static int be_flash_data(struct be_adapter *adapter, const struct flash_comp *pflashcomp; int num_comp; - static const struct flash_comp gen3_flash_types[9] = { + static const struct flash_comp gen3_flash_types[10] = { { FLASH_iSCSI_PRIMARY_IMAGE_START_g3, IMG_TYPE_ISCSI_ACTIVE, FLASH_IMAGE_MAX_SIZE_g3}, { FLASH_REDBOOT_START_g3, IMG_TYPE_REDBOOT, @@ -2687,7 +2631,9 @@ static int be_flash_data(struct be_adapter *adapter, { FLASH_FCoE_BACKUP_IMAGE_START_g3, IMG_TYPE_FCOE_FW_BACKUP, FLASH_IMAGE_MAX_SIZE_g3}, { FLASH_NCSI_START_g3, IMG_TYPE_NCSI_FW, - FLASH_NCSI_IMAGE_MAX_SIZE_g3} + FLASH_NCSI_IMAGE_MAX_SIZE_g3}, + { FLASH_PHY_FW_START_g3, IMG_TYPE_PHY_FW, + FLASH_PHY_FW_IMAGE_MAX_SIZE_g3} }; static const struct flash_comp gen2_flash_types[8] = { { FLASH_iSCSI_PRIMARY_IMAGE_START_g2, IMG_TYPE_ISCSI_ACTIVE, @@ -2721,6 +2667,10 @@ static int be_flash_data(struct be_adapter *adapter, if ((pflashcomp[i].optype == IMG_TYPE_NCSI_FW) && memcmp(adapter->fw_ver, "3.102.148.0", 11) < 0) continue; + if (pflashcomp[i].optype == IMG_TYPE_PHY_FW) { + if (!phy_flashing_required(adapter)) + continue; + } if ((pflashcomp[i].optype == IMG_TYPE_REDBOOT) && (!be_flash_redboot(adapter, fw->data, pflashcomp[i].offset, pflashcomp[i].size, filehdr_size + @@ -2729,25 +2679,35 @@ static int be_flash_data(struct be_adapter *adapter, p = fw->data; p += filehdr_size + pflashcomp[i].offset + (num_of_images * sizeof(struct image_hdr)); - if (p + pflashcomp[i].size > fw->data + fw->size) - return -1; - total_bytes = pflashcomp[i].size; + if (p + pflashcomp[i].size > fw->data + fw->size) + return -1; + total_bytes = pflashcomp[i].size; while (total_bytes) { if (total_bytes > 32*1024) num_bytes = 32*1024; else num_bytes = total_bytes; total_bytes -= num_bytes; - - if (!total_bytes) - flash_op = FLASHROM_OPER_FLASH; - else - flash_op = FLASHROM_OPER_SAVE; + if (!total_bytes) { + if (pflashcomp[i].optype == IMG_TYPE_PHY_FW) + flash_op = FLASHROM_OPER_PHY_FLASH; + else + flash_op = FLASHROM_OPER_FLASH; + } else { + if (pflashcomp[i].optype == IMG_TYPE_PHY_FW) + flash_op = FLASHROM_OPER_PHY_SAVE; + else + flash_op = FLASHROM_OPER_SAVE; + } memcpy(req->params.data_buf, p, num_bytes); p += num_bytes; status = be_cmd_write_flashrom(adapter, flash_cmd, pflashcomp[i].optype, flash_op, num_bytes); if (status) { + if ((status == ILLEGAL_IOCTL_REQ) && + (pflashcomp[i].optype == + IMG_TYPE_PHY_FW)) + break; dev_err(&adapter->pdev->dev, "cmd to write to flash rom failed.\n"); return -1; @@ -2938,6 +2898,7 @@ static struct net_device_ops be_netdev_ops = { .ndo_set_rx_mode = be_set_multicast_list, .ndo_set_mac_address = be_mac_addr_set, .ndo_change_mtu = be_change_mtu, + .ndo_get_stats64 = be_get_stats64, .ndo_validate_addr = eth_validate_addr, .ndo_vlan_rx_add_vid = be_vlan_add_vid, .ndo_vlan_rx_kill_vid = be_vlan_rem_vid, @@ -3060,7 +3021,7 @@ static void be_ctrl_cleanup(struct be_adapter *adapter) dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va, mem->dma); - mem = &adapter->mc_cmd_mem; + mem = &adapter->rx_filter; if (mem->va) dma_free_coherent(&adapter->pdev->dev, mem->size, mem->va, mem->dma); @@ -3070,7 +3031,7 @@ static int be_ctrl_init(struct be_adapter *adapter) { struct be_dma_mem *mbox_mem_alloc = &adapter->mbox_mem_alloced; struct be_dma_mem *mbox_mem_align = &adapter->mbox_mem; - struct be_dma_mem *mc_cmd_mem = &adapter->mc_cmd_mem; + struct be_dma_mem *rx_filter = &adapter->rx_filter; int status; status = be_map_pci_bars(adapter); @@ -3086,21 +3047,19 @@ static int be_ctrl_init(struct be_adapter *adapter) status = -ENOMEM; goto unmap_pci_bars; } - mbox_mem_align->size = sizeof(struct be_mcc_mailbox); mbox_mem_align->va = PTR_ALIGN(mbox_mem_alloc->va, 16); mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16); memset(mbox_mem_align->va, 0, sizeof(struct be_mcc_mailbox)); - mc_cmd_mem->size = sizeof(struct be_cmd_req_mcast_mac_config); - mc_cmd_mem->va = dma_alloc_coherent(&adapter->pdev->dev, - mc_cmd_mem->size, &mc_cmd_mem->dma, - GFP_KERNEL); - if (mc_cmd_mem->va == NULL) { + rx_filter->size = sizeof(struct be_cmd_req_rx_filter); + rx_filter->va = dma_alloc_coherent(&adapter->pdev->dev, rx_filter->size, + &rx_filter->dma, GFP_KERNEL); + if (rx_filter->va == NULL) { status = -ENOMEM; goto free_mbox; } - memset(mc_cmd_mem->va, 0, mc_cmd_mem->size); + memset(rx_filter->va, 0, rx_filter->size); mutex_init(&adapter->mbox_lock); spin_lock_init(&adapter->mcc_lock); @@ -3421,11 +3380,9 @@ static int __devinit be_probe(struct pci_dev *pdev, status = register_netdev(netdev); if (status != 0) goto unsetup; - netif_carrier_off(netdev); if (be_physfn(adapter) && adapter->sriov_enabled) { u8 mac_speed; - bool link_up; u16 vf, lnk_speed; if (!lancer_chip(adapter)) { @@ -3435,8 +3392,8 @@ static int __devinit be_probe(struct pci_dev *pdev, } for (vf = 0; vf < num_vfs; vf++) { - status = be_cmd_link_status_query(adapter, &link_up, - &mac_speed, &lnk_speed, vf + 1); + status = be_cmd_link_status_query(adapter, &mac_speed, + &lnk_speed, vf + 1); if (!status) adapter->vf_cfg[vf].vf_tx_rate = lnk_speed * 10; else diff --git a/drivers/net/bna/bfa_ioc.c b/drivers/net/bna/bfa_ioc.c index 126b0aac9f94..3cdea65aee12 100644 --- a/drivers/net/bna/bfa_ioc.c +++ b/drivers/net/bna/bfa_ioc.c @@ -19,7 +19,7 @@ #include "bfa_ioc.h" #include "cna.h" #include "bfi.h" -#include "bfi_ctreg.h" +#include "bfi_reg.h" #include "bfa_defs.h" /** diff --git a/drivers/net/bna/bfa_ioc_ct.c b/drivers/net/bna/bfa_ioc_ct.c index 87aecdf22cf9..209f1f320343 100644 --- a/drivers/net/bna/bfa_ioc_ct.c +++ b/drivers/net/bna/bfa_ioc_ct.c @@ -19,7 +19,7 @@ #include "bfa_ioc.h" #include "cna.h" #include "bfi.h" -#include "bfi_ctreg.h" +#include "bfi_reg.h" #include "bfa_defs.h" #define bfa_ioc_ct_sync_pos(__ioc) \ @@ -50,26 +50,32 @@ static enum bfa_status bfa_ioc_ct_pll_init(void __iomem *rb, bool fcmode); static struct bfa_ioc_hwif nw_hwif_ct; +static void +bfa_ioc_set_ctx_hwif(struct bfa_ioc *ioc, struct bfa_ioc_hwif *hwif) +{ + hwif->ioc_firmware_lock = bfa_ioc_ct_firmware_lock; + hwif->ioc_firmware_unlock = bfa_ioc_ct_firmware_unlock; + hwif->ioc_notify_fail = bfa_ioc_ct_notify_fail; + hwif->ioc_ownership_reset = bfa_ioc_ct_ownership_reset; + hwif->ioc_sync_start = bfa_ioc_ct_sync_start; + hwif->ioc_sync_join = bfa_ioc_ct_sync_join; + hwif->ioc_sync_leave = bfa_ioc_ct_sync_leave; + hwif->ioc_sync_ack = bfa_ioc_ct_sync_ack; + hwif->ioc_sync_complete = bfa_ioc_ct_sync_complete; +} + /** * Called from bfa_ioc_attach() to map asic specific calls. */ void bfa_nw_ioc_set_ct_hwif(struct bfa_ioc *ioc) { + bfa_ioc_set_ctx_hwif(ioc, &nw_hwif_ct); + nw_hwif_ct.ioc_pll_init = bfa_ioc_ct_pll_init; - nw_hwif_ct.ioc_firmware_lock = bfa_ioc_ct_firmware_lock; - nw_hwif_ct.ioc_firmware_unlock = bfa_ioc_ct_firmware_unlock; nw_hwif_ct.ioc_reg_init = bfa_ioc_ct_reg_init; nw_hwif_ct.ioc_map_port = bfa_ioc_ct_map_port; nw_hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set; - nw_hwif_ct.ioc_notify_fail = bfa_ioc_ct_notify_fail; - nw_hwif_ct.ioc_ownership_reset = bfa_ioc_ct_ownership_reset; - nw_hwif_ct.ioc_sync_start = bfa_ioc_ct_sync_start; - nw_hwif_ct.ioc_sync_join = bfa_ioc_ct_sync_join; - nw_hwif_ct.ioc_sync_leave = bfa_ioc_ct_sync_leave; - nw_hwif_ct.ioc_sync_ack = bfa_ioc_ct_sync_ack; - nw_hwif_ct.ioc_sync_complete = bfa_ioc_ct_sync_complete; - ioc->ioc_hwif = &nw_hwif_ct; } @@ -84,12 +90,6 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc *ioc) struct bfi_ioc_image_hdr fwhdr; /** - * Firmware match check is relevant only for CNA. - */ - if (!ioc->cna) - return true; - - /** * If bios boot (flash based) -- do not increment usage count */ if (bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(ioc)) < @@ -140,12 +140,6 @@ bfa_ioc_ct_firmware_unlock(struct bfa_ioc *ioc) u32 usecnt; /** - * Firmware lock is relevant only for CNA. - */ - if (!ioc->cna) - return; - - /** * If bios boot (flash based) -- do not decrement usage count */ if (bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(ioc)) < @@ -178,7 +172,7 @@ bfa_ioc_ct_notify_fail(struct bfa_ioc *ioc) readl(ioc->ioc_regs.ll_halt); readl(ioc->ioc_regs.alt_ll_halt); } else { - writel(__PSS_ERR_STATUS_SET, ioc->ioc_regs.err_set); + writel(~0U, ioc->ioc_regs.err_set); readl(ioc->ioc_regs.err_set); } } @@ -196,21 +190,21 @@ static struct { u32 hfn_mbox, lpu_mbox, hfn_pgn; } iocreg_fnreg[] = { /** * Host <-> LPU mailbox command/status registers - port 0 */ -static struct { u32 hfn, lpu; } iocreg_mbcmd_p0[] = { - { HOSTFN0_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN0_MBOX0_CMD_STAT }, - { HOSTFN1_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN1_MBOX0_CMD_STAT }, - { HOSTFN2_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN2_MBOX0_CMD_STAT }, - { HOSTFN3_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN3_MBOX0_CMD_STAT } +static struct { u32 hfn, lpu; } ct_p0reg[] = { + { HOSTFN0_LPU0_CMD_STAT, LPU0_HOSTFN0_CMD_STAT }, + { HOSTFN1_LPU0_CMD_STAT, LPU0_HOSTFN1_CMD_STAT }, + { HOSTFN2_LPU0_CMD_STAT, LPU0_HOSTFN2_CMD_STAT }, + { HOSTFN3_LPU0_CMD_STAT, LPU0_HOSTFN3_CMD_STAT } }; /** * Host <-> LPU mailbox command/status registers - port 1 */ -static struct { u32 hfn, lpu; } iocreg_mbcmd_p1[] = { - { HOSTFN0_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN0_MBOX0_CMD_STAT }, - { HOSTFN1_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN1_MBOX0_CMD_STAT }, - { HOSTFN2_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN2_MBOX0_CMD_STAT }, - { HOSTFN3_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN3_MBOX0_CMD_STAT } +static struct { u32 hfn, lpu; } ct_p1reg[] = { + { HOSTFN0_LPU1_CMD_STAT, LPU1_HOSTFN0_CMD_STAT }, + { HOSTFN1_LPU1_CMD_STAT, LPU1_HOSTFN1_CMD_STAT }, + { HOSTFN2_LPU1_CMD_STAT, LPU1_HOSTFN2_CMD_STAT }, + { HOSTFN3_LPU1_CMD_STAT, LPU1_HOSTFN3_CMD_STAT } }; static void @@ -229,16 +223,16 @@ bfa_ioc_ct_reg_init(struct bfa_ioc *ioc) ioc->ioc_regs.heartbeat = rb + BFA_IOC0_HBEAT_REG; ioc->ioc_regs.ioc_fwstate = rb + BFA_IOC0_STATE_REG; ioc->ioc_regs.alt_ioc_fwstate = rb + BFA_IOC1_STATE_REG; - ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].hfn; - ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].lpu; + ioc->ioc_regs.hfn_mbox_cmd = rb + ct_p0reg[pcifn].hfn; + ioc->ioc_regs.lpu_mbox_cmd = rb + ct_p0reg[pcifn].lpu; ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P0; ioc->ioc_regs.alt_ll_halt = rb + FW_INIT_HALT_P1; } else { ioc->ioc_regs.heartbeat = (rb + BFA_IOC1_HBEAT_REG); ioc->ioc_regs.ioc_fwstate = (rb + BFA_IOC1_STATE_REG); ioc->ioc_regs.alt_ioc_fwstate = rb + BFA_IOC0_STATE_REG; - ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].hfn; - ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].lpu; + ioc->ioc_regs.hfn_mbox_cmd = rb + ct_p1reg[pcifn].hfn; + ioc->ioc_regs.lpu_mbox_cmd = rb + ct_p1reg[pcifn].lpu; ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P1; ioc->ioc_regs.alt_ll_halt = rb + FW_INIT_HALT_P0; } @@ -248,8 +242,8 @@ bfa_ioc_ct_reg_init(struct bfa_ioc *ioc) */ ioc->ioc_regs.pss_ctl_reg = (rb + PSS_CTL_REG); ioc->ioc_regs.pss_err_status_reg = (rb + PSS_ERR_STATUS_REG); - ioc->ioc_regs.app_pll_fast_ctl_reg = (rb + APP_PLL_425_CTL_REG); - ioc->ioc_regs.app_pll_slow_ctl_reg = (rb + APP_PLL_312_CTL_REG); + ioc->ioc_regs.app_pll_fast_ctl_reg = (rb + APP_PLL_LCLK_CTL_REG); + ioc->ioc_regs.app_pll_slow_ctl_reg = (rb + APP_PLL_SCLK_CTL_REG); /* * IOC semaphore registers and serialization @@ -309,7 +303,7 @@ bfa_ioc_ct_isr_mode_set(struct bfa_ioc *ioc, bool msix) /** * If already in desired mode, do not change anything */ - if (!msix && mode) + if ((!msix && mode) || (msix && !mode)) return; if (msix) @@ -446,14 +440,15 @@ bfa_ioc_ct_pll_init(void __iomem *rb, bool fcmode) { u32 pll_sclk, pll_fclk, r32; - pll_sclk = __APP_PLL_312_LRESETN | __APP_PLL_312_ENARST | - __APP_PLL_312_RSEL200500 | __APP_PLL_312_P0_1(3U) | - __APP_PLL_312_JITLMT0_1(3U) | - __APP_PLL_312_CNTLMT0_1(1U); - pll_fclk = __APP_PLL_425_LRESETN | __APP_PLL_425_ENARST | - __APP_PLL_425_RSEL200500 | __APP_PLL_425_P0_1(3U) | - __APP_PLL_425_JITLMT0_1(3U) | - __APP_PLL_425_CNTLMT0_1(1U); + pll_sclk = __APP_PLL_SCLK_LRESETN | __APP_PLL_SCLK_ENARST | + __APP_PLL_SCLK_RSEL200500 | __APP_PLL_SCLK_P0_1(3U) | + __APP_PLL_SCLK_JITLMT0_1(3U) | + __APP_PLL_SCLK_CNTLMT0_1(1U); + pll_fclk = __APP_PLL_LCLK_LRESETN | __APP_PLL_LCLK_ENARST | + __APP_PLL_LCLK_RSEL200500 | __APP_PLL_LCLK_P0_1(3U) | + __APP_PLL_LCLK_JITLMT0_1(3U) | + __APP_PLL_LCLK_CNTLMT0_1(1U); + if (fcmode) { writel(0, (rb + OP_MODE)); writel(__APP_EMS_CMLCKSEL | @@ -474,27 +469,28 @@ bfa_ioc_ct_pll_init(void __iomem *rb, bool fcmode) writel(0xffffffffU, (rb + HOSTFN0_INT_MSK)); writel(0xffffffffU, (rb + HOSTFN1_INT_MSK)); writel(pll_sclk | - __APP_PLL_312_LOGIC_SOFT_RESET, - rb + APP_PLL_312_CTL_REG); + __APP_PLL_SCLK_LOGIC_SOFT_RESET, + rb + APP_PLL_SCLK_CTL_REG); writel(pll_fclk | - __APP_PLL_425_LOGIC_SOFT_RESET, - rb + APP_PLL_425_CTL_REG); + __APP_PLL_LCLK_LOGIC_SOFT_RESET, + rb + APP_PLL_LCLK_CTL_REG); writel(pll_sclk | - __APP_PLL_312_LOGIC_SOFT_RESET | __APP_PLL_312_ENABLE, - rb + APP_PLL_312_CTL_REG); + __APP_PLL_SCLK_LOGIC_SOFT_RESET | __APP_PLL_SCLK_ENABLE, + rb + APP_PLL_SCLK_CTL_REG); writel(pll_fclk | - __APP_PLL_425_LOGIC_SOFT_RESET | __APP_PLL_425_ENABLE, - rb + APP_PLL_425_CTL_REG); + __APP_PLL_LCLK_LOGIC_SOFT_RESET | __APP_PLL_LCLK_ENABLE, + rb + APP_PLL_LCLK_CTL_REG); readl(rb + HOSTFN0_INT_MSK); udelay(2000); writel(0xffffffffU, (rb + HOSTFN0_INT_STATUS)); writel(0xffffffffU, (rb + HOSTFN1_INT_STATUS)); writel(pll_sclk | - __APP_PLL_312_ENABLE, - rb + APP_PLL_312_CTL_REG); + __APP_PLL_SCLK_ENABLE, + rb + APP_PLL_SCLK_CTL_REG); writel(pll_fclk | - __APP_PLL_425_ENABLE, - rb + APP_PLL_425_CTL_REG); + __APP_PLL_LCLK_ENABLE, + rb + APP_PLL_LCLK_CTL_REG); + if (!fcmode) { writel(__PMM_1T_RESET_P, (rb + PMM_1T_RESET_REG_P0)); writel(__PMM_1T_RESET_P, (rb + PMM_1T_RESET_REG_P1)); diff --git a/drivers/net/bna/bfi_ctreg.h b/drivers/net/bna/bfi_ctreg.h deleted file mode 100644 index 5130d7918660..000000000000 --- a/drivers/net/bna/bfi_ctreg.h +++ /dev/null @@ -1,646 +0,0 @@ -/* - * Linux network driver for Brocade Converged Network Adapter. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License (GPL) Version 2 as - * published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - */ -/* - * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. - * All rights reserved - * www.brocade.com - */ - -/* - * bfi_ctreg.h catapult host block register definitions - * - * !!! Do not edit. Auto generated. !!! - */ - -#ifndef __BFI_CTREG_H__ -#define __BFI_CTREG_H__ - -#define HOSTFN0_LPU_MBOX0_0 0x00019200 -#define HOSTFN1_LPU_MBOX0_8 0x00019260 -#define LPU_HOSTFN0_MBOX0_0 0x00019280 -#define LPU_HOSTFN1_MBOX0_8 0x000192e0 -#define HOSTFN2_LPU_MBOX0_0 0x00019400 -#define HOSTFN3_LPU_MBOX0_8 0x00019460 -#define LPU_HOSTFN2_MBOX0_0 0x00019480 -#define LPU_HOSTFN3_MBOX0_8 0x000194e0 -#define HOSTFN0_INT_STATUS 0x00014000 -#define __HOSTFN0_HALT_OCCURRED 0x01000000 -#define __HOSTFN0_INT_STATUS_LVL_MK 0x00f00000 -#define __HOSTFN0_INT_STATUS_LVL_SH 20 -#define __HOSTFN0_INT_STATUS_LVL(_v) ((_v) << __HOSTFN0_INT_STATUS_LVL_SH) -#define __HOSTFN0_INT_STATUS_P_MK 0x000f0000 -#define __HOSTFN0_INT_STATUS_P_SH 16 -#define __HOSTFN0_INT_STATUS_P(_v) ((_v) << __HOSTFN0_INT_STATUS_P_SH) -#define __HOSTFN0_INT_STATUS_F 0x0000ffff -#define HOSTFN0_INT_MSK 0x00014004 -#define HOST_PAGE_NUM_FN0 0x00014008 -#define __HOST_PAGE_NUM_FN 0x000001ff -#define HOST_MSIX_ERR_INDEX_FN0 0x0001400c -#define __MSIX_ERR_INDEX_FN 0x000001ff -#define HOSTFN1_INT_STATUS 0x00014100 -#define __HOSTFN1_HALT_OCCURRED 0x01000000 -#define __HOSTFN1_INT_STATUS_LVL_MK 0x00f00000 -#define __HOSTFN1_INT_STATUS_LVL_SH 20 -#define __HOSTFN1_INT_STATUS_LVL(_v) ((_v) << __HOSTFN1_INT_STATUS_LVL_SH) -#define __HOSTFN1_INT_STATUS_P_MK 0x000f0000 -#define __HOSTFN1_INT_STATUS_P_SH 16 -#define __HOSTFN1_INT_STATUS_P(_v) ((_v) << __HOSTFN1_INT_STATUS_P_SH) -#define __HOSTFN1_INT_STATUS_F 0x0000ffff -#define HOSTFN1_INT_MSK 0x00014104 -#define HOST_PAGE_NUM_FN1 0x00014108 -#define HOST_MSIX_ERR_INDEX_FN1 0x0001410c -#define APP_PLL_425_CTL_REG 0x00014204 -#define __P_425_PLL_LOCK 0x80000000 -#define __APP_PLL_425_SRAM_USE_100MHZ 0x00100000 -#define __APP_PLL_425_RESET_TIMER_MK 0x000e0000 -#define __APP_PLL_425_RESET_TIMER_SH 17 -#define __APP_PLL_425_RESET_TIMER(_v) ((_v) << __APP_PLL_425_RESET_TIMER_SH) -#define __APP_PLL_425_LOGIC_SOFT_RESET 0x00010000 -#define __APP_PLL_425_CNTLMT0_1_MK 0x0000c000 -#define __APP_PLL_425_CNTLMT0_1_SH 14 -#define __APP_PLL_425_CNTLMT0_1(_v) ((_v) << __APP_PLL_425_CNTLMT0_1_SH) -#define __APP_PLL_425_JITLMT0_1_MK 0x00003000 -#define __APP_PLL_425_JITLMT0_1_SH 12 -#define __APP_PLL_425_JITLMT0_1(_v) ((_v) << __APP_PLL_425_JITLMT0_1_SH) -#define __APP_PLL_425_HREF 0x00000800 -#define __APP_PLL_425_HDIV 0x00000400 -#define __APP_PLL_425_P0_1_MK 0x00000300 -#define __APP_PLL_425_P0_1_SH 8 -#define __APP_PLL_425_P0_1(_v) ((_v) << __APP_PLL_425_P0_1_SH) -#define __APP_PLL_425_Z0_2_MK 0x000000e0 -#define __APP_PLL_425_Z0_2_SH 5 -#define __APP_PLL_425_Z0_2(_v) ((_v) << __APP_PLL_425_Z0_2_SH) -#define __APP_PLL_425_RSEL200500 0x00000010 -#define __APP_PLL_425_ENARST 0x00000008 -#define __APP_PLL_425_BYPASS 0x00000004 -#define __APP_PLL_425_LRESETN 0x00000002 -#define __APP_PLL_425_ENABLE 0x00000001 -#define APP_PLL_312_CTL_REG 0x00014208 -#define __P_312_PLL_LOCK 0x80000000 -#define __ENABLE_MAC_AHB_1 0x00800000 -#define __ENABLE_MAC_AHB_0 0x00400000 -#define __ENABLE_MAC_1 0x00200000 -#define __ENABLE_MAC_0 0x00100000 -#define __APP_PLL_312_RESET_TIMER_MK 0x000e0000 -#define __APP_PLL_312_RESET_TIMER_SH 17 -#define __APP_PLL_312_RESET_TIMER(_v) ((_v) << __APP_PLL_312_RESET_TIMER_SH) -#define __APP_PLL_312_LOGIC_SOFT_RESET 0x00010000 -#define __APP_PLL_312_CNTLMT0_1_MK 0x0000c000 -#define __APP_PLL_312_CNTLMT0_1_SH 14 -#define __APP_PLL_312_CNTLMT0_1(_v) ((_v) << __APP_PLL_312_CNTLMT0_1_SH) -#define __APP_PLL_312_JITLMT0_1_MK 0x00003000 -#define __APP_PLL_312_JITLMT0_1_SH 12 -#define __APP_PLL_312_JITLMT0_1(_v) ((_v) << __APP_PLL_312_JITLMT0_1_SH) -#define __APP_PLL_312_HREF 0x00000800 -#define __APP_PLL_312_HDIV 0x00000400 -#define __APP_PLL_312_P0_1_MK 0x00000300 -#define __APP_PLL_312_P0_1_SH 8 -#define __APP_PLL_312_P0_1(_v) ((_v) << __APP_PLL_312_P0_1_SH) -#define __APP_PLL_312_Z0_2_MK 0x000000e0 -#define __APP_PLL_312_Z0_2_SH 5 -#define __APP_PLL_312_Z0_2(_v) ((_v) << __APP_PLL_312_Z0_2_SH) -#define __APP_PLL_312_RSEL200500 0x00000010 -#define __APP_PLL_312_ENARST 0x00000008 -#define __APP_PLL_312_BYPASS 0x00000004 -#define __APP_PLL_312_LRESETN 0x00000002 -#define __APP_PLL_312_ENABLE 0x00000001 -#define MBIST_CTL_REG 0x00014220 -#define __EDRAM_BISTR_START 0x00000004 -#define __MBIST_RESET 0x00000002 -#define __MBIST_START 0x00000001 -#define MBIST_STAT_REG 0x00014224 -#define __EDRAM_BISTR_STATUS 0x00000008 -#define __EDRAM_BISTR_DONE 0x00000004 -#define __MEM_BIT_STATUS 0x00000002 -#define __MBIST_DONE 0x00000001 -#define HOST_SEM0_REG 0x00014230 -#define __HOST_SEMAPHORE 0x00000001 -#define HOST_SEM1_REG 0x00014234 -#define HOST_SEM2_REG 0x00014238 -#define HOST_SEM3_REG 0x0001423c -#define HOST_SEM0_INFO_REG 0x00014240 -#define HOST_SEM1_INFO_REG 0x00014244 -#define HOST_SEM2_INFO_REG 0x00014248 -#define HOST_SEM3_INFO_REG 0x0001424c -#define ETH_MAC_SER_REG 0x00014288 -#define __APP_EMS_CKBUFAMPIN 0x00000020 -#define __APP_EMS_REFCLKSEL 0x00000010 -#define __APP_EMS_CMLCKSEL 0x00000008 -#define __APP_EMS_REFCKBUFEN2 0x00000004 -#define __APP_EMS_REFCKBUFEN1 0x00000002 -#define __APP_EMS_CHANNEL_SEL 0x00000001 -#define HOSTFN2_INT_STATUS 0x00014300 -#define __HOSTFN2_HALT_OCCURRED 0x01000000 -#define __HOSTFN2_INT_STATUS_LVL_MK 0x00f00000 -#define __HOSTFN2_INT_STATUS_LVL_SH 20 -#define __HOSTFN2_INT_STATUS_LVL(_v) ((_v) << __HOSTFN2_INT_STATUS_LVL_SH) -#define __HOSTFN2_INT_STATUS_P_MK 0x000f0000 -#define __HOSTFN2_INT_STATUS_P_SH 16 -#define __HOSTFN2_INT_STATUS_P(_v) ((_v) << __HOSTFN2_INT_STATUS_P_SH) -#define __HOSTFN2_INT_STATUS_F 0x0000ffff -#define HOSTFN2_INT_MSK 0x00014304 -#define HOST_PAGE_NUM_FN2 0x00014308 -#define HOST_MSIX_ERR_INDEX_FN2 0x0001430c -#define HOSTFN3_INT_STATUS 0x00014400 -#define __HALT_OCCURRED 0x01000000 -#define __HOSTFN3_INT_STATUS_LVL_MK 0x00f00000 -#define __HOSTFN3_INT_STATUS_LVL_SH 20 -#define __HOSTFN3_INT_STATUS_LVL(_v) ((_v) << __HOSTFN3_INT_STATUS_LVL_SH) -#define __HOSTFN3_INT_STATUS_P_MK 0x000f0000 -#define __HOSTFN3_INT_STATUS_P_SH 16 -#define __HOSTFN3_INT_STATUS_P(_v) ((_v) << __HOSTFN3_INT_STATUS_P_SH) -#define __HOSTFN3_INT_STATUS_F 0x0000ffff -#define HOSTFN3_INT_MSK 0x00014404 -#define HOST_PAGE_NUM_FN3 0x00014408 -#define HOST_MSIX_ERR_INDEX_FN3 0x0001440c -#define FNC_ID_REG 0x00014600 -#define __FUNCTION_NUMBER 0x00000007 -#define FNC_PERS_REG 0x00014604 -#define __F3_FUNCTION_ACTIVE 0x80000000 -#define __F3_FUNCTION_MODE 0x40000000 -#define __F3_PORT_MAP_MK 0x30000000 -#define __F3_PORT_MAP_SH 28 -#define __F3_PORT_MAP(_v) ((_v) << __F3_PORT_MAP_SH) -#define __F3_VM_MODE 0x08000000 -#define __F3_INTX_STATUS_MK 0x07000000 -#define __F3_INTX_STATUS_SH 24 -#define __F3_INTX_STATUS(_v) ((_v) << __F3_INTX_STATUS_SH) -#define __F2_FUNCTION_ACTIVE 0x00800000 -#define __F2_FUNCTION_MODE 0x00400000 -#define __F2_PORT_MAP_MK 0x00300000 -#define __F2_PORT_MAP_SH 20 -#define __F2_PORT_MAP(_v) ((_v) << __F2_PORT_MAP_SH) -#define __F2_VM_MODE 0x00080000 -#define __F2_INTX_STATUS_MK 0x00070000 -#define __F2_INTX_STATUS_SH 16 -#define __F2_INTX_STATUS(_v) ((_v) << __F2_INTX_STATUS_SH) -#define __F1_FUNCTION_ACTIVE 0x00008000 -#define __F1_FUNCTION_MODE 0x00004000 -#define __F1_PORT_MAP_MK 0x00003000 -#define __F1_PORT_MAP_SH 12 -#define __F1_PORT_MAP(_v) ((_v) << __F1_PORT_MAP_SH) -#define __F1_VM_MODE 0x00000800 -#define __F1_INTX_STATUS_MK 0x00000700 -#define __F1_INTX_STATUS_SH 8 -#define __F1_INTX_STATUS(_v) ((_v) << __F1_INTX_STATUS_SH) -#define __F0_FUNCTION_ACTIVE 0x00000080 -#define __F0_FUNCTION_MODE 0x00000040 -#define __F0_PORT_MAP_MK 0x00000030 -#define __F0_PORT_MAP_SH 4 -#define __F0_PORT_MAP(_v) ((_v) << __F0_PORT_MAP_SH) -#define __F0_VM_MODE 0x00000008 -#define __F0_INTX_STATUS 0x00000007 -enum { - __F0_INTX_STATUS_MSIX = 0x0, - __F0_INTX_STATUS_INTA = 0x1, - __F0_INTX_STATUS_INTB = 0x2, - __F0_INTX_STATUS_INTC = 0x3, - __F0_INTX_STATUS_INTD = 0x4, -}; -#define OP_MODE 0x0001460c -#define __APP_ETH_CLK_LOWSPEED 0x00000004 -#define __GLOBAL_CORECLK_HALFSPEED 0x00000002 -#define __GLOBAL_FCOE_MODE 0x00000001 -#define HOST_SEM4_REG 0x00014610 -#define HOST_SEM5_REG 0x00014614 -#define HOST_SEM6_REG 0x00014618 -#define HOST_SEM7_REG 0x0001461c -#define HOST_SEM4_INFO_REG 0x00014620 -#define HOST_SEM5_INFO_REG 0x00014624 -#define HOST_SEM6_INFO_REG 0x00014628 -#define HOST_SEM7_INFO_REG 0x0001462c -#define HOSTFN0_LPU0_MBOX0_CMD_STAT 0x00019000 -#define __HOSTFN0_LPU0_MBOX0_INFO_MK 0xfffffffe -#define __HOSTFN0_LPU0_MBOX0_INFO_SH 1 -#define __HOSTFN0_LPU0_MBOX0_INFO(_v) ((_v) << __HOSTFN0_LPU0_MBOX0_INFO_SH) -#define __HOSTFN0_LPU0_MBOX0_CMD_STATUS 0x00000001 -#define HOSTFN0_LPU1_MBOX0_CMD_STAT 0x00019004 -#define __HOSTFN0_LPU1_MBOX0_INFO_MK 0xfffffffe -#define __HOSTFN0_LPU1_MBOX0_INFO_SH 1 -#define __HOSTFN0_LPU1_MBOX0_INFO(_v) ((_v) << __HOSTFN0_LPU1_MBOX0_INFO_SH) -#define __HOSTFN0_LPU1_MBOX0_CMD_STATUS 0x00000001 -#define LPU0_HOSTFN0_MBOX0_CMD_STAT 0x00019008 -#define __LPU0_HOSTFN0_MBOX0_INFO_MK 0xfffffffe -#define __LPU0_HOSTFN0_MBOX0_INFO_SH 1 -#define __LPU0_HOSTFN0_MBOX0_INFO(_v) ((_v) << __LPU0_HOSTFN0_MBOX0_INFO_SH) -#define __LPU0_HOSTFN0_MBOX0_CMD_STATUS 0x00000001 -#define LPU1_HOSTFN0_MBOX0_CMD_STAT 0x0001900c -#define __LPU1_HOSTFN0_MBOX0_INFO_MK 0xfffffffe -#define __LPU1_HOSTFN0_MBOX0_INFO_SH 1 -#define __LPU1_HOSTFN0_MBOX0_INFO(_v) ((_v) << __LPU1_HOSTFN0_MBOX0_INFO_SH) -#define __LPU1_HOSTFN0_MBOX0_CMD_STATUS 0x00000001 -#define HOSTFN1_LPU0_MBOX0_CMD_STAT 0x00019010 -#define __HOSTFN1_LPU0_MBOX0_INFO_MK 0xfffffffe -#define __HOSTFN1_LPU0_MBOX0_INFO_SH 1 -#define __HOSTFN1_LPU0_MBOX0_INFO(_v) ((_v) << __HOSTFN1_LPU0_MBOX0_INFO_SH) -#define __HOSTFN1_LPU0_MBOX0_CMD_STATUS 0x00000001 -#define HOSTFN1_LPU1_MBOX0_CMD_STAT 0x00019014 -#define __HOSTFN1_LPU1_MBOX0_INFO_MK 0xfffffffe -#define __HOSTFN1_LPU1_MBOX0_INFO_SH 1 -#define __HOSTFN1_LPU1_MBOX0_INFO(_v) ((_v) << __HOSTFN1_LPU1_MBOX0_INFO_SH) -#define __HOSTFN1_LPU1_MBOX0_CMD_STATUS 0x00000001 -#define LPU0_HOSTFN1_MBOX0_CMD_STAT 0x00019018 -#define __LPU0_HOSTFN1_MBOX0_INFO_MK 0xfffffffe -#define __LPU0_HOSTFN1_MBOX0_INFO_SH 1 -#define __LPU0_HOSTFN1_MBOX0_INFO(_v) ((_v) << __LPU0_HOSTFN1_MBOX0_INFO_SH) -#define __LPU0_HOSTFN1_MBOX0_CMD_STATUS 0x00000001 -#define LPU1_HOSTFN1_MBOX0_CMD_STAT 0x0001901c -#define __LPU1_HOSTFN1_MBOX0_INFO_MK 0xfffffffe -#define __LPU1_HOSTFN1_MBOX0_INFO_SH 1 -#define __LPU1_HOSTFN1_MBOX0_INFO(_v) ((_v) << __LPU1_HOSTFN1_MBOX0_INFO_SH) -#define __LPU1_HOSTFN1_MBOX0_CMD_STATUS 0x00000001 -#define HOSTFN2_LPU0_MBOX0_CMD_STAT 0x00019150 -#define __HOSTFN2_LPU0_MBOX0_INFO_MK 0xfffffffe -#define __HOSTFN2_LPU0_MBOX0_INFO_SH 1 -#define __HOSTFN2_LPU0_MBOX0_INFO(_v) ((_v) << __HOSTFN2_LPU0_MBOX0_INFO_SH) -#define __HOSTFN2_LPU0_MBOX0_CMD_STATUS 0x00000001 -#define HOSTFN2_LPU1_MBOX0_CMD_STAT 0x00019154 -#define __HOSTFN2_LPU1_MBOX0_INFO_MK 0xfffffffe -#define __HOSTFN2_LPU1_MBOX0_INFO_SH 1 -#define __HOSTFN2_LPU1_MBOX0_INFO(_v) ((_v) << __HOSTFN2_LPU1_MBOX0_INFO_SH) -#define __HOSTFN2_LPU1_MBOX0BOX0_CMD_STATUS 0x00000001 -#define LPU0_HOSTFN2_MBOX0_CMD_STAT 0x00019158 -#define __LPU0_HOSTFN2_MBOX0_INFO_MK 0xfffffffe -#define __LPU0_HOSTFN2_MBOX0_INFO_SH 1 -#define __LPU0_HOSTFN2_MBOX0_INFO(_v) ((_v) << __LPU0_HOSTFN2_MBOX0_INFO_SH) -#define __LPU0_HOSTFN2_MBOX0_CMD_STATUS 0x00000001 -#define LPU1_HOSTFN2_MBOX0_CMD_STAT 0x0001915c -#define __LPU1_HOSTFN2_MBOX0_INFO_MK 0xfffffffe -#define __LPU1_HOSTFN2_MBOX0_INFO_SH 1 -#define __LPU1_HOSTFN2_MBOX0_INFO(_v) ((_v) << __LPU1_HOSTFN2_MBOX0_INFO_SH) -#define __LPU1_HOSTFN2_MBOX0_CMD_STATUS 0x00000001 -#define HOSTFN3_LPU0_MBOX0_CMD_STAT 0x00019160 -#define __HOSTFN3_LPU0_MBOX0_INFO_MK 0xfffffffe -#define __HOSTFN3_LPU0_MBOX0_INFO_SH 1 -#define __HOSTFN3_LPU0_MBOX0_INFO(_v) ((_v) << __HOSTFN3_LPU0_MBOX0_INFO_SH) -#define __HOSTFN3_LPU0_MBOX0_CMD_STATUS 0x00000001 -#define HOSTFN3_LPU1_MBOX0_CMD_STAT 0x00019164 -#define __HOSTFN3_LPU1_MBOX0_INFO_MK 0xfffffffe -#define __HOSTFN3_LPU1_MBOX0_INFO_SH 1 -#define __HOSTFN3_LPU1_MBOX0_INFO(_v) ((_v) << __HOSTFN3_LPU1_MBOX0_INFO_SH) -#define __HOSTFN3_LPU1_MBOX0_CMD_STATUS 0x00000001 -#define LPU0_HOSTFN3_MBOX0_CMD_STAT 0x00019168 -#define __LPU0_HOSTFN3_MBOX0_INFO_MK 0xfffffffe -#define __LPU0_HOSTFN3_MBOX0_INFO_SH 1 -#define __LPU0_HOSTFN3_MBOX0_INFO(_v) ((_v) << __LPU0_HOSTFN3_MBOX0_INFO_SH) -#define __LPU0_HOSTFN3_MBOX0_CMD_STATUS 0x00000001 -#define LPU1_HOSTFN3_MBOX0_CMD_STAT 0x0001916c -#define __LPU1_HOSTFN3_MBOX0_INFO_MK 0xfffffffe -#define __LPU1_HOSTFN3_MBOX0_INFO_SH 1 -#define __LPU1_HOSTFN3_MBOX0_INFO(_v) ((_v) << __LPU1_HOSTFN3_MBOX0_INFO_SH) -#define __LPU1_HOSTFN3_MBOX0_CMD_STATUS 0x00000001 -#define FW_INIT_HALT_P0 0x000191ac -#define __FW_INIT_HALT_P 0x00000001 -#define FW_INIT_HALT_P1 0x000191bc -#define CPE_PI_PTR_Q0 0x00038000 -#define __CPE_PI_UNUSED_MK 0xffff0000 -#define __CPE_PI_UNUSED_SH 16 -#define __CPE_PI_UNUSED(_v) ((_v) << __CPE_PI_UNUSED_SH) -#define __CPE_PI_PTR 0x0000ffff -#define CPE_PI_PTR_Q1 0x00038040 -#define CPE_CI_PTR_Q0 0x00038004 -#define __CPE_CI_UNUSED_MK 0xffff0000 -#define __CPE_CI_UNUSED_SH 16 -#define __CPE_CI_UNUSED(_v) ((_v) << __CPE_CI_UNUSED_SH) -#define __CPE_CI_PTR 0x0000ffff -#define CPE_CI_PTR_Q1 0x00038044 -#define CPE_DEPTH_Q0 0x00038008 -#define __CPE_DEPTH_UNUSED_MK 0xf8000000 -#define __CPE_DEPTH_UNUSED_SH 27 -#define __CPE_DEPTH_UNUSED(_v) ((_v) << __CPE_DEPTH_UNUSED_SH) -#define __CPE_MSIX_VEC_INDEX_MK 0x07ff0000 -#define __CPE_MSIX_VEC_INDEX_SH 16 -#define __CPE_MSIX_VEC_INDEX(_v) ((_v) << __CPE_MSIX_VEC_INDEX_SH) -#define __CPE_DEPTH 0x0000ffff -#define CPE_DEPTH_Q1 0x00038048 -#define CPE_QCTRL_Q0 0x0003800c -#define __CPE_CTRL_UNUSED30_MK 0xfc000000 -#define __CPE_CTRL_UNUSED30_SH 26 -#define __CPE_CTRL_UNUSED30(_v) ((_v) << __CPE_CTRL_UNUSED30_SH) -#define __CPE_FUNC_INT_CTRL_MK 0x03000000 -#define __CPE_FUNC_INT_CTRL_SH 24 -#define __CPE_FUNC_INT_CTRL(_v) ((_v) << __CPE_FUNC_INT_CTRL_SH) -enum { - __CPE_FUNC_INT_CTRL_DISABLE = 0x0, - __CPE_FUNC_INT_CTRL_F2NF = 0x1, - __CPE_FUNC_INT_CTRL_3QUART = 0x2, - __CPE_FUNC_INT_CTRL_HALF = 0x3, -}; -#define __CPE_CTRL_UNUSED20_MK 0x00f00000 -#define __CPE_CTRL_UNUSED20_SH 20 -#define __CPE_CTRL_UNUSED20(_v) ((_v) << __CPE_CTRL_UNUSED20_SH) -#define __CPE_SCI_TH_MK 0x000f0000 -#define __CPE_SCI_TH_SH 16 -#define __CPE_SCI_TH(_v) ((_v) << __CPE_SCI_TH_SH) -#define __CPE_CTRL_UNUSED10_MK 0x0000c000 -#define __CPE_CTRL_UNUSED10_SH 14 -#define __CPE_CTRL_UNUSED10(_v) ((_v) << __CPE_CTRL_UNUSED10_SH) -#define __CPE_ACK_PENDING 0x00002000 -#define __CPE_CTRL_UNUSED40_MK 0x00001c00 -#define __CPE_CTRL_UNUSED40_SH 10 -#define __CPE_CTRL_UNUSED40(_v) ((_v) << __CPE_CTRL_UNUSED40_SH) -#define __CPE_PCIEID_MK 0x00000300 -#define __CPE_PCIEID_SH 8 -#define __CPE_PCIEID(_v) ((_v) << __CPE_PCIEID_SH) -#define __CPE_CTRL_UNUSED00_MK 0x000000fe -#define __CPE_CTRL_UNUSED00_SH 1 -#define __CPE_CTRL_UNUSED00(_v) ((_v) << __CPE_CTRL_UNUSED00_SH) -#define __CPE_ESIZE 0x00000001 -#define CPE_QCTRL_Q1 0x0003804c -#define __CPE_CTRL_UNUSED31_MK 0xfc000000 -#define __CPE_CTRL_UNUSED31_SH 26 -#define __CPE_CTRL_UNUSED31(_v) ((_v) << __CPE_CTRL_UNUSED31_SH) -#define __CPE_CTRL_UNUSED21_MK 0x00f00000 -#define __CPE_CTRL_UNUSED21_SH 20 -#define __CPE_CTRL_UNUSED21(_v) ((_v) << __CPE_CTRL_UNUSED21_SH) -#define __CPE_CTRL_UNUSED11_MK 0x0000c000 -#define __CPE_CTRL_UNUSED11_SH 14 -#define __CPE_CTRL_UNUSED11(_v) ((_v) << __CPE_CTRL_UNUSED11_SH) -#define __CPE_CTRL_UNUSED41_MK 0x00001c00 -#define __CPE_CTRL_UNUSED41_SH 10 -#define __CPE_CTRL_UNUSED41(_v) ((_v) << __CPE_CTRL_UNUSED41_SH) -#define __CPE_CTRL_UNUSED01_MK 0x000000fe -#define __CPE_CTRL_UNUSED01_SH 1 -#define __CPE_CTRL_UNUSED01(_v) ((_v) << __CPE_CTRL_UNUSED01_SH) -#define RME_PI_PTR_Q0 0x00038020 -#define __LATENCY_TIME_STAMP_MK 0xffff0000 -#define __LATENCY_TIME_STAMP_SH 16 -#define __LATENCY_TIME_STAMP(_v) ((_v) << __LATENCY_TIME_STAMP_SH) -#define __RME_PI_PTR 0x0000ffff -#define RME_PI_PTR_Q1 0x00038060 -#define RME_CI_PTR_Q0 0x00038024 -#define __DELAY_TIME_STAMP_MK 0xffff0000 -#define __DELAY_TIME_STAMP_SH 16 -#define __DELAY_TIME_STAMP(_v) ((_v) << __DELAY_TIME_STAMP_SH) -#define __RME_CI_PTR 0x0000ffff -#define RME_CI_PTR_Q1 0x00038064 -#define RME_DEPTH_Q0 0x00038028 -#define __RME_DEPTH_UNUSED_MK 0xf8000000 -#define __RME_DEPTH_UNUSED_SH 27 -#define __RME_DEPTH_UNUSED(_v) ((_v) << __RME_DEPTH_UNUSED_SH) -#define __RME_MSIX_VEC_INDEX_MK 0x07ff0000 -#define __RME_MSIX_VEC_INDEX_SH 16 -#define __RME_MSIX_VEC_INDEX(_v) ((_v) << __RME_MSIX_VEC_INDEX_SH) -#define __RME_DEPTH 0x0000ffff -#define RME_DEPTH_Q1 0x00038068 -#define RME_QCTRL_Q0 0x0003802c -#define __RME_INT_LATENCY_TIMER_MK 0xff000000 -#define __RME_INT_LATENCY_TIMER_SH 24 -#define __RME_INT_LATENCY_TIMER(_v) ((_v) << __RME_INT_LATENCY_TIMER_SH) -#define __RME_INT_DELAY_TIMER_MK 0x00ff0000 -#define __RME_INT_DELAY_TIMER_SH 16 -#define __RME_INT_DELAY_TIMER(_v) ((_v) << __RME_INT_DELAY_TIMER_SH) -#define __RME_INT_DELAY_DISABLE 0x00008000 -#define __RME_DLY_DELAY_DISABLE 0x00004000 -#define __RME_ACK_PENDING 0x00002000 -#define __RME_FULL_INTERRUPT_DISABLE 0x00001000 -#define __RME_CTRL_UNUSED10_MK 0x00000c00 -#define __RME_CTRL_UNUSED10_SH 10 -#define __RME_CTRL_UNUSED10(_v) ((_v) << __RME_CTRL_UNUSED10_SH) -#define __RME_PCIEID_MK 0x00000300 -#define __RME_PCIEID_SH 8 -#define __RME_PCIEID(_v) ((_v) << __RME_PCIEID_SH) -#define __RME_CTRL_UNUSED00_MK 0x000000fe -#define __RME_CTRL_UNUSED00_SH 1 -#define __RME_CTRL_UNUSED00(_v) ((_v) << __RME_CTRL_UNUSED00_SH) -#define __RME_ESIZE 0x00000001 -#define RME_QCTRL_Q1 0x0003806c -#define __RME_CTRL_UNUSED11_MK 0x00000c00 -#define __RME_CTRL_UNUSED11_SH 10 -#define __RME_CTRL_UNUSED11(_v) ((_v) << __RME_CTRL_UNUSED11_SH) -#define __RME_CTRL_UNUSED01_MK 0x000000fe -#define __RME_CTRL_UNUSED01_SH 1 -#define __RME_CTRL_UNUSED01(_v) ((_v) << __RME_CTRL_UNUSED01_SH) -#define PSS_CTL_REG 0x00018800 -#define __PSS_I2C_CLK_DIV_MK 0x007f0000 -#define __PSS_I2C_CLK_DIV_SH 16 -#define __PSS_I2C_CLK_DIV(_v) ((_v) << __PSS_I2C_CLK_DIV_SH) -#define __PSS_LMEM_INIT_DONE 0x00001000 -#define __PSS_LMEM_RESET 0x00000200 -#define __PSS_LMEM_INIT_EN 0x00000100 -#define __PSS_LPU1_RESET 0x00000002 -#define __PSS_LPU0_RESET 0x00000001 -#define PSS_ERR_STATUS_REG 0x00018810 -#define __PSS_LPU1_TCM_READ_ERR 0x00200000 -#define __PSS_LPU0_TCM_READ_ERR 0x00100000 -#define __PSS_LMEM5_CORR_ERR 0x00080000 -#define __PSS_LMEM4_CORR_ERR 0x00040000 -#define __PSS_LMEM3_CORR_ERR 0x00020000 -#define __PSS_LMEM2_CORR_ERR 0x00010000 -#define __PSS_LMEM1_CORR_ERR 0x00008000 -#define __PSS_LMEM0_CORR_ERR 0x00004000 -#define __PSS_LMEM5_UNCORR_ERR 0x00002000 -#define __PSS_LMEM4_UNCORR_ERR 0x00001000 -#define __PSS_LMEM3_UNCORR_ERR 0x00000800 -#define __PSS_LMEM2_UNCORR_ERR 0x00000400 -#define __PSS_LMEM1_UNCORR_ERR 0x00000200 -#define __PSS_LMEM0_UNCORR_ERR 0x00000100 -#define __PSS_BAL_PERR 0x00000080 -#define __PSS_DIP_IF_ERR 0x00000040 -#define __PSS_IOH_IF_ERR 0x00000020 -#define __PSS_TDS_IF_ERR 0x00000010 -#define __PSS_RDS_IF_ERR 0x00000008 -#define __PSS_SGM_IF_ERR 0x00000004 -#define __PSS_LPU1_RAM_ERR 0x00000002 -#define __PSS_LPU0_RAM_ERR 0x00000001 -#define ERR_SET_REG 0x00018818 -#define __PSS_ERR_STATUS_SET 0x003fffff -#define PMM_1T_RESET_REG_P0 0x0002381c -#define __PMM_1T_RESET_P 0x00000001 -#define PMM_1T_RESET_REG_P1 0x00023c1c -#define HQM_QSET0_RXQ_DRBL_P0 0x00038000 -#define __RXQ0_ADD_VECTORS_P 0x80000000 -#define __RXQ0_STOP_P 0x40000000 -#define __RXQ0_PRD_PTR_P 0x0000ffff -#define HQM_QSET1_RXQ_DRBL_P0 0x00038080 -#define __RXQ1_ADD_VECTORS_P 0x80000000 -#define __RXQ1_STOP_P 0x40000000 -#define __RXQ1_PRD_PTR_P 0x0000ffff -#define HQM_QSET0_RXQ_DRBL_P1 0x0003c000 -#define HQM_QSET1_RXQ_DRBL_P1 0x0003c080 -#define HQM_QSET0_TXQ_DRBL_P0 0x00038020 -#define __TXQ0_ADD_VECTORS_P 0x80000000 -#define __TXQ0_STOP_P 0x40000000 -#define __TXQ0_PRD_PTR_P 0x0000ffff -#define HQM_QSET1_TXQ_DRBL_P0 0x000380a0 -#define __TXQ1_ADD_VECTORS_P 0x80000000 -#define __TXQ1_STOP_P 0x40000000 -#define __TXQ1_PRD_PTR_P 0x0000ffff -#define HQM_QSET0_TXQ_DRBL_P1 0x0003c020 -#define HQM_QSET1_TXQ_DRBL_P1 0x0003c0a0 -#define HQM_QSET0_IB_DRBL_1_P0 0x00038040 -#define __IB1_0_ACK_P 0x80000000 -#define __IB1_0_DISABLE_P 0x40000000 -#define __IB1_0_COALESCING_CFG_P_MK 0x00ff0000 -#define __IB1_0_COALESCING_CFG_P_SH 16 -#define __IB1_0_COALESCING_CFG_P(_v) ((_v) << __IB1_0_COALESCING_CFG_P_SH) -#define __IB1_0_NUM_OF_ACKED_EVENTS_P 0x0000ffff -#define HQM_QSET1_IB_DRBL_1_P0 0x000380c0 -#define __IB1_1_ACK_P 0x80000000 -#define __IB1_1_DISABLE_P 0x40000000 -#define __IB1_1_COALESCING_CFG_P_MK 0x00ff0000 -#define __IB1_1_COALESCING_CFG_P_SH 16 -#define __IB1_1_COALESCING_CFG_P(_v) ((_v) << __IB1_1_COALESCING_CFG_P_SH) -#define __IB1_1_NUM_OF_ACKED_EVENTS_P 0x0000ffff -#define HQM_QSET0_IB_DRBL_1_P1 0x0003c040 -#define HQM_QSET1_IB_DRBL_1_P1 0x0003c0c0 -#define HQM_QSET0_IB_DRBL_2_P0 0x00038060 -#define __IB2_0_ACK_P 0x80000000 -#define __IB2_0_DISABLE_P 0x40000000 -#define __IB2_0_COALESCING_CFG_P_MK 0x00ff0000 -#define __IB2_0_COALESCING_CFG_P_SH 16 -#define __IB2_0_COALESCING_CFG_P(_v) ((_v) << __IB2_0_COALESCING_CFG_P_SH) -#define __IB2_0_NUM_OF_ACKED_EVENTS_P 0x0000ffff -#define HQM_QSET1_IB_DRBL_2_P0 0x000380e0 -#define __IB2_1_ACK_P 0x80000000 -#define __IB2_1_DISABLE_P 0x40000000 -#define __IB2_1_COALESCING_CFG_P_MK 0x00ff0000 -#define __IB2_1_COALESCING_CFG_P_SH 16 -#define __IB2_1_COALESCING_CFG_P(_v) ((_v) << __IB2_1_COALESCING_CFG_P_SH) -#define __IB2_1_NUM_OF_ACKED_EVENTS_P 0x0000ffff -#define HQM_QSET0_IB_DRBL_2_P1 0x0003c060 -#define HQM_QSET1_IB_DRBL_2_P1 0x0003c0e0 - -/* - * These definitions are either in error/missing in spec. Its auto-generated - * from hard coded values in regparse.pl. - */ -#define __EMPHPOST_AT_4G_MK_FIX 0x0000001c -#define __EMPHPOST_AT_4G_SH_FIX 0x00000002 -#define __EMPHPRE_AT_4G_FIX 0x00000003 -#define __SFP_TXRATE_EN_FIX 0x00000100 -#define __SFP_RXRATE_EN_FIX 0x00000080 - -/* - * These register definitions are auto-generated from hard coded values - * in regparse.pl. - */ - -/* - * These register mapping definitions are auto-generated from mapping tables - * in regparse.pl. - */ -#define BFA_IOC0_HBEAT_REG HOST_SEM0_INFO_REG -#define BFA_IOC0_STATE_REG HOST_SEM1_INFO_REG -#define BFA_IOC1_HBEAT_REG HOST_SEM2_INFO_REG -#define BFA_IOC1_STATE_REG HOST_SEM3_INFO_REG -#define BFA_FW_USE_COUNT HOST_SEM4_INFO_REG -#define BFA_IOC_FAIL_SYNC HOST_SEM5_INFO_REG - -#define CPE_DEPTH_Q(__n) \ - (CPE_DEPTH_Q0 + (__n) * (CPE_DEPTH_Q1 - CPE_DEPTH_Q0)) -#define CPE_QCTRL_Q(__n) \ - (CPE_QCTRL_Q0 + (__n) * (CPE_QCTRL_Q1 - CPE_QCTRL_Q0)) -#define CPE_PI_PTR_Q(__n) \ - (CPE_PI_PTR_Q0 + (__n) * (CPE_PI_PTR_Q1 - CPE_PI_PTR_Q0)) -#define CPE_CI_PTR_Q(__n) \ - (CPE_CI_PTR_Q0 + (__n) * (CPE_CI_PTR_Q1 - CPE_CI_PTR_Q0)) -#define RME_DEPTH_Q(__n) \ - (RME_DEPTH_Q0 + (__n) * (RME_DEPTH_Q1 - RME_DEPTH_Q0)) -#define RME_QCTRL_Q(__n) \ - (RME_QCTRL_Q0 + (__n) * (RME_QCTRL_Q1 - RME_QCTRL_Q0)) -#define RME_PI_PTR_Q(__n) \ - (RME_PI_PTR_Q0 + (__n) * (RME_PI_PTR_Q1 - RME_PI_PTR_Q0)) -#define RME_CI_PTR_Q(__n) \ - (RME_CI_PTR_Q0 + (__n) * (RME_CI_PTR_Q1 - RME_CI_PTR_Q0)) -#define HQM_QSET_RXQ_DRBL_P0(__n) \ - (HQM_QSET0_RXQ_DRBL_P0 + (__n) * \ - (HQM_QSET1_RXQ_DRBL_P0 - HQM_QSET0_RXQ_DRBL_P0)) -#define HQM_QSET_TXQ_DRBL_P0(__n) \ - (HQM_QSET0_TXQ_DRBL_P0 + (__n) * \ - (HQM_QSET1_TXQ_DRBL_P0 - HQM_QSET0_TXQ_DRBL_P0)) -#define HQM_QSET_IB_DRBL_1_P0(__n) \ - (HQM_QSET0_IB_DRBL_1_P0 + (__n) * \ - (HQM_QSET1_IB_DRBL_1_P0 - HQM_QSET0_IB_DRBL_1_P0)) -#define HQM_QSET_IB_DRBL_2_P0(__n) \ - (HQM_QSET0_IB_DRBL_2_P0 + (__n) * \ - (HQM_QSET1_IB_DRBL_2_P0 - HQM_QSET0_IB_DRBL_2_P0)) -#define HQM_QSET_RXQ_DRBL_P1(__n) \ - (HQM_QSET0_RXQ_DRBL_P1 + (__n) * \ - (HQM_QSET1_RXQ_DRBL_P1 - HQM_QSET0_RXQ_DRBL_P1)) -#define HQM_QSET_TXQ_DRBL_P1(__n) \ - (HQM_QSET0_TXQ_DRBL_P1 + (__n) * \ - (HQM_QSET1_TXQ_DRBL_P1 - HQM_QSET0_TXQ_DRBL_P1)) -#define HQM_QSET_IB_DRBL_1_P1(__n) \ - (HQM_QSET0_IB_DRBL_1_P1 + (__n) * \ - (HQM_QSET1_IB_DRBL_1_P1 - HQM_QSET0_IB_DRBL_1_P1)) -#define HQM_QSET_IB_DRBL_2_P1(__n) \ - (HQM_QSET0_IB_DRBL_2_P1 + (__n) * \ - (HQM_QSET1_IB_DRBL_2_P1 - HQM_QSET0_IB_DRBL_2_P1)) - -#define CPE_Q_NUM(__fn, __q) (((__fn) << 2) + (__q)) -#define RME_Q_NUM(__fn, __q) (((__fn) << 2) + (__q)) -#define CPE_Q_MASK(__q) ((__q) & 0x3) -#define RME_Q_MASK(__q) ((__q) & 0x3) - -/* - * PCI MSI-X vector defines - */ -enum { - BFA_MSIX_CPE_Q0 = 0, - BFA_MSIX_CPE_Q1 = 1, - BFA_MSIX_CPE_Q2 = 2, - BFA_MSIX_CPE_Q3 = 3, - BFA_MSIX_RME_Q0 = 4, - BFA_MSIX_RME_Q1 = 5, - BFA_MSIX_RME_Q2 = 6, - BFA_MSIX_RME_Q3 = 7, - BFA_MSIX_LPU_ERR = 8, - BFA_MSIX_CT_MAX = 9, -}; - -/* - * And corresponding host interrupt status bit field defines - */ -#define __HFN_INT_CPE_Q0 0x00000001U -#define __HFN_INT_CPE_Q1 0x00000002U -#define __HFN_INT_CPE_Q2 0x00000004U -#define __HFN_INT_CPE_Q3 0x00000008U -#define __HFN_INT_CPE_Q4 0x00000010U -#define __HFN_INT_CPE_Q5 0x00000020U -#define __HFN_INT_CPE_Q6 0x00000040U -#define __HFN_INT_CPE_Q7 0x00000080U -#define __HFN_INT_RME_Q0 0x00000100U -#define __HFN_INT_RME_Q1 0x00000200U -#define __HFN_INT_RME_Q2 0x00000400U -#define __HFN_INT_RME_Q3 0x00000800U -#define __HFN_INT_RME_Q4 0x00001000U -#define __HFN_INT_RME_Q5 0x00002000U -#define __HFN_INT_RME_Q6 0x00004000U -#define __HFN_INT_RME_Q7 0x00008000U -#define __HFN_INT_ERR_EMC 0x00010000U -#define __HFN_INT_ERR_LPU0 0x00020000U -#define __HFN_INT_ERR_LPU1 0x00040000U -#define __HFN_INT_ERR_PSS 0x00080000U -#define __HFN_INT_MBOX_LPU0 0x00100000U -#define __HFN_INT_MBOX_LPU1 0x00200000U -#define __HFN_INT_MBOX1_LPU0 0x00400000U -#define __HFN_INT_MBOX1_LPU1 0x00800000U -#define __HFN_INT_LL_HALT 0x01000000U -#define __HFN_INT_CPE_MASK 0x000000ffU -#define __HFN_INT_RME_MASK 0x0000ff00U - -/* - * catapult memory map. - */ -#define LL_PGN_HQM0 0x0096 -#define LL_PGN_HQM1 0x0097 -#define PSS_SMEM_PAGE_START 0x8000 -#define PSS_SMEM_PGNUM(_pg0, _ma) ((_pg0) + ((_ma) >> 15)) -#define PSS_SMEM_PGOFF(_ma) ((_ma) & 0x7fff) - -/* - * End of catapult memory map - */ - -#endif /* __BFI_CTREG_H__ */ diff --git a/drivers/net/bna/bfi_reg.h b/drivers/net/bna/bfi_reg.h new file mode 100644 index 000000000000..efacff3ab51d --- /dev/null +++ b/drivers/net/bna/bfi_reg.h @@ -0,0 +1,452 @@ +/* + * Linux network driver for Brocade Converged Network Adapter. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License (GPL) Version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ +/* + * Copyright (c) 2005-2011 Brocade Communications Systems, Inc. + * All rights reserved + * www.brocade.com + */ + +/* + * bfi_reg.h ASIC register defines for all Brocade adapter ASICs + */ + +#ifndef __BFI_REG_H__ +#define __BFI_REG_H__ + +#define HOSTFN0_INT_STATUS 0x00014000 /* cb/ct */ +#define HOSTFN1_INT_STATUS 0x00014100 /* cb/ct */ +#define HOSTFN2_INT_STATUS 0x00014300 /* ct */ +#define HOSTFN3_INT_STATUS 0x00014400 /* ct */ +#define HOSTFN0_INT_MSK 0x00014004 /* cb/ct */ +#define HOSTFN1_INT_MSK 0x00014104 /* cb/ct */ +#define HOSTFN2_INT_MSK 0x00014304 /* ct */ +#define HOSTFN3_INT_MSK 0x00014404 /* ct */ + +#define HOST_PAGE_NUM_FN0 0x00014008 /* cb/ct */ +#define HOST_PAGE_NUM_FN1 0x00014108 /* cb/ct */ +#define HOST_PAGE_NUM_FN2 0x00014308 /* ct */ +#define HOST_PAGE_NUM_FN3 0x00014408 /* ct */ + +#define APP_PLL_LCLK_CTL_REG 0x00014204 /* cb/ct */ +#define __P_LCLK_PLL_LOCK 0x80000000 +#define __APP_PLL_LCLK_SRAM_USE_100MHZ 0x00100000 +#define __APP_PLL_LCLK_RESET_TIMER_MK 0x000e0000 +#define __APP_PLL_LCLK_RESET_TIMER_SH 17 +#define __APP_PLL_LCLK_RESET_TIMER(_v) ((_v) << __APP_PLL_LCLK_RESET_TIMER_SH) +#define __APP_PLL_LCLK_LOGIC_SOFT_RESET 0x00010000 +#define __APP_PLL_LCLK_CNTLMT0_1_MK 0x0000c000 +#define __APP_PLL_LCLK_CNTLMT0_1_SH 14 +#define __APP_PLL_LCLK_CNTLMT0_1(_v) ((_v) << __APP_PLL_LCLK_CNTLMT0_1_SH) +#define __APP_PLL_LCLK_JITLMT0_1_MK 0x00003000 +#define __APP_PLL_LCLK_JITLMT0_1_SH 12 +#define __APP_PLL_LCLK_JITLMT0_1(_v) ((_v) << __APP_PLL_LCLK_JITLMT0_1_SH) +#define __APP_PLL_LCLK_HREF 0x00000800 +#define __APP_PLL_LCLK_HDIV 0x00000400 +#define __APP_PLL_LCLK_P0_1_MK 0x00000300 +#define __APP_PLL_LCLK_P0_1_SH 8 +#define __APP_PLL_LCLK_P0_1(_v) ((_v) << __APP_PLL_LCLK_P0_1_SH) +#define __APP_PLL_LCLK_Z0_2_MK 0x000000e0 +#define __APP_PLL_LCLK_Z0_2_SH 5 +#define __APP_PLL_LCLK_Z0_2(_v) ((_v) << __APP_PLL_LCLK_Z0_2_SH) +#define __APP_PLL_LCLK_RSEL200500 0x00000010 +#define __APP_PLL_LCLK_ENARST 0x00000008 +#define __APP_PLL_LCLK_BYPASS 0x00000004 +#define __APP_PLL_LCLK_LRESETN 0x00000002 +#define __APP_PLL_LCLK_ENABLE 0x00000001 +#define APP_PLL_SCLK_CTL_REG 0x00014208 /* cb/ct */ +#define __P_SCLK_PLL_LOCK 0x80000000 +#define __APP_PLL_SCLK_RESET_TIMER_MK 0x000e0000 +#define __APP_PLL_SCLK_RESET_TIMER_SH 17 +#define __APP_PLL_SCLK_RESET_TIMER(_v) ((_v) << __APP_PLL_SCLK_RESET_TIMER_SH) +#define __APP_PLL_SCLK_LOGIC_SOFT_RESET 0x00010000 +#define __APP_PLL_SCLK_CNTLMT0_1_MK 0x0000c000 +#define __APP_PLL_SCLK_CNTLMT0_1_SH 14 +#define __APP_PLL_SCLK_CNTLMT0_1(_v) ((_v) << __APP_PLL_SCLK_CNTLMT0_1_SH) +#define __APP_PLL_SCLK_JITLMT0_1_MK 0x00003000 +#define __APP_PLL_SCLK_JITLMT0_1_SH 12 +#define __APP_PLL_SCLK_JITLMT0_1(_v) ((_v) << __APP_PLL_SCLK_JITLMT0_1_SH) +#define __APP_PLL_SCLK_HREF 0x00000800 +#define __APP_PLL_SCLK_HDIV 0x00000400 +#define __APP_PLL_SCLK_P0_1_MK 0x00000300 +#define __APP_PLL_SCLK_P0_1_SH 8 +#define __APP_PLL_SCLK_P0_1(_v) ((_v) << __APP_PLL_SCLK_P0_1_SH) +#define __APP_PLL_SCLK_Z0_2_MK 0x000000e0 +#define __APP_PLL_SCLK_Z0_2_SH 5 +#define __APP_PLL_SCLK_Z0_2(_v) ((_v) << __APP_PLL_SCLK_Z0_2_SH) +#define __APP_PLL_SCLK_RSEL200500 0x00000010 +#define __APP_PLL_SCLK_ENARST 0x00000008 +#define __APP_PLL_SCLK_BYPASS 0x00000004 +#define __APP_PLL_SCLK_LRESETN 0x00000002 +#define __APP_PLL_SCLK_ENABLE 0x00000001 +#define __ENABLE_MAC_AHB_1 0x00800000 /* ct */ +#define __ENABLE_MAC_AHB_0 0x00400000 /* ct */ +#define __ENABLE_MAC_1 0x00200000 /* ct */ +#define __ENABLE_MAC_0 0x00100000 /* ct */ + +#define HOST_SEM0_REG 0x00014230 /* cb/ct */ +#define HOST_SEM1_REG 0x00014234 /* cb/ct */ +#define HOST_SEM2_REG 0x00014238 /* cb/ct */ +#define HOST_SEM3_REG 0x0001423c /* cb/ct */ +#define HOST_SEM4_REG 0x00014610 /* cb/ct */ +#define HOST_SEM5_REG 0x00014614 /* cb/ct */ +#define HOST_SEM6_REG 0x00014618 /* cb/ct */ +#define HOST_SEM7_REG 0x0001461c /* cb/ct */ +#define HOST_SEM0_INFO_REG 0x00014240 /* cb/ct */ +#define HOST_SEM1_INFO_REG 0x00014244 /* cb/ct */ +#define HOST_SEM2_INFO_REG 0x00014248 /* cb/ct */ +#define HOST_SEM3_INFO_REG 0x0001424c /* cb/ct */ +#define HOST_SEM4_INFO_REG 0x00014620 /* cb/ct */ +#define HOST_SEM5_INFO_REG 0x00014624 /* cb/ct */ +#define HOST_SEM6_INFO_REG 0x00014628 /* cb/ct */ +#define HOST_SEM7_INFO_REG 0x0001462c /* cb/ct */ + +#define HOSTFN0_LPU0_CMD_STAT 0x00019000 /* cb/ct */ +#define HOSTFN0_LPU1_CMD_STAT 0x00019004 /* cb/ct */ +#define HOSTFN1_LPU0_CMD_STAT 0x00019010 /* cb/ct */ +#define HOSTFN1_LPU1_CMD_STAT 0x00019014 /* cb/ct */ +#define HOSTFN2_LPU0_CMD_STAT 0x00019150 /* ct */ +#define HOSTFN2_LPU1_CMD_STAT 0x00019154 /* ct */ +#define HOSTFN3_LPU0_CMD_STAT 0x00019160 /* ct */ +#define HOSTFN3_LPU1_CMD_STAT 0x00019164 /* ct */ +#define LPU0_HOSTFN0_CMD_STAT 0x00019008 /* cb/ct */ +#define LPU1_HOSTFN0_CMD_STAT 0x0001900c /* cb/ct */ +#define LPU0_HOSTFN1_CMD_STAT 0x00019018 /* cb/ct */ +#define LPU1_HOSTFN1_CMD_STAT 0x0001901c /* cb/ct */ +#define LPU0_HOSTFN2_CMD_STAT 0x00019158 /* ct */ +#define LPU1_HOSTFN2_CMD_STAT 0x0001915c /* ct */ +#define LPU0_HOSTFN3_CMD_STAT 0x00019168 /* ct */ +#define LPU1_HOSTFN3_CMD_STAT 0x0001916c /* ct */ + +#define PSS_CTL_REG 0x00018800 /* cb/ct */ +#define __PSS_I2C_CLK_DIV_MK 0x007f0000 +#define __PSS_I2C_CLK_DIV_SH 16 +#define __PSS_I2C_CLK_DIV(_v) ((_v) << __PSS_I2C_CLK_DIV_SH) +#define __PSS_LMEM_INIT_DONE 0x00001000 +#define __PSS_LMEM_RESET 0x00000200 +#define __PSS_LMEM_INIT_EN 0x00000100 +#define __PSS_LPU1_RESET 0x00000002 +#define __PSS_LPU0_RESET 0x00000001 +#define PSS_ERR_STATUS_REG 0x00018810 /* cb/ct */ +#define ERR_SET_REG 0x00018818 /* cb/ct */ +#define PSS_GPIO_OUT_REG 0x000188c0 /* cb/ct */ +#define __PSS_GPIO_OUT_REG 0x00000fff +#define PSS_GPIO_OE_REG 0x000188c8 /* cb/ct */ +#define __PSS_GPIO_OE_REG 0x000000ff + +#define HOSTFN0_LPU_MBOX0_0 0x00019200 /* cb/ct */ +#define HOSTFN1_LPU_MBOX0_8 0x00019260 /* cb/ct */ +#define LPU_HOSTFN0_MBOX0_0 0x00019280 /* cb/ct */ +#define LPU_HOSTFN1_MBOX0_8 0x000192e0 /* cb/ct */ +#define HOSTFN2_LPU_MBOX0_0 0x00019400 /* ct */ +#define HOSTFN3_LPU_MBOX0_8 0x00019460 /* ct */ +#define LPU_HOSTFN2_MBOX0_0 0x00019480 /* ct */ +#define LPU_HOSTFN3_MBOX0_8 0x000194e0 /* ct */ + +#define HOST_MSIX_ERR_INDEX_FN0 0x0001400c /* ct */ +#define HOST_MSIX_ERR_INDEX_FN1 0x0001410c /* ct */ +#define HOST_MSIX_ERR_INDEX_FN2 0x0001430c /* ct */ +#define HOST_MSIX_ERR_INDEX_FN3 0x0001440c /* ct */ + +#define MBIST_CTL_REG 0x00014220 /* ct */ +#define __EDRAM_BISTR_START 0x00000004 +#define MBIST_STAT_REG 0x00014224 /* ct */ +#define ETH_MAC_SER_REG 0x00014288 /* ct */ +#define __APP_EMS_CKBUFAMPIN 0x00000020 +#define __APP_EMS_REFCLKSEL 0x00000010 +#define __APP_EMS_CMLCKSEL 0x00000008 +#define __APP_EMS_REFCKBUFEN2 0x00000004 +#define __APP_EMS_REFCKBUFEN1 0x00000002 +#define __APP_EMS_CHANNEL_SEL 0x00000001 +#define FNC_PERS_REG 0x00014604 /* ct */ +#define __F3_FUNCTION_ACTIVE 0x80000000 +#define __F3_FUNCTION_MODE 0x40000000 +#define __F3_PORT_MAP_MK 0x30000000 +#define __F3_PORT_MAP_SH 28 +#define __F3_PORT_MAP(_v) ((_v) << __F3_PORT_MAP_SH) +#define __F3_VM_MODE 0x08000000 +#define __F3_INTX_STATUS_MK 0x07000000 +#define __F3_INTX_STATUS_SH 24 +#define __F3_INTX_STATUS(_v) ((_v) << __F3_INTX_STATUS_SH) +#define __F2_FUNCTION_ACTIVE 0x00800000 +#define __F2_FUNCTION_MODE 0x00400000 +#define __F2_PORT_MAP_MK 0x00300000 +#define __F2_PORT_MAP_SH 20 +#define __F2_PORT_MAP(_v) ((_v) << __F2_PORT_MAP_SH) +#define __F2_VM_MODE 0x00080000 +#define __F2_INTX_STATUS_MK 0x00070000 +#define __F2_INTX_STATUS_SH 16 +#define __F2_INTX_STATUS(_v) ((_v) << __F2_INTX_STATUS_SH) +#define __F1_FUNCTION_ACTIVE 0x00008000 +#define __F1_FUNCTION_MODE 0x00004000 +#define __F1_PORT_MAP_MK 0x00003000 +#define __F1_PORT_MAP_SH 12 +#define __F1_PORT_MAP(_v) ((_v) << __F1_PORT_MAP_SH) +#define __F1_VM_MODE 0x00000800 +#define __F1_INTX_STATUS_MK 0x00000700 +#define __F1_INTX_STATUS_SH 8 +#define __F1_INTX_STATUS(_v) ((_v) << __F1_INTX_STATUS_SH) +#define __F0_FUNCTION_ACTIVE 0x00000080 +#define __F0_FUNCTION_MODE 0x00000040 +#define __F0_PORT_MAP_MK 0x00000030 +#define __F0_PORT_MAP_SH 4 +#define __F0_PORT_MAP(_v) ((_v) << __F0_PORT_MAP_SH) +#define __F0_VM_MODE 0x00000008 +#define __F0_INTX_STATUS 0x00000007 +enum { + __F0_INTX_STATUS_MSIX = 0x0, + __F0_INTX_STATUS_INTA = 0x1, + __F0_INTX_STATUS_INTB = 0x2, + __F0_INTX_STATUS_INTC = 0x3, + __F0_INTX_STATUS_INTD = 0x4, +}; + +#define OP_MODE 0x0001460c +#define __APP_ETH_CLK_LOWSPEED 0x00000004 +#define __GLOBAL_CORECLK_HALFSPEED 0x00000002 +#define __GLOBAL_FCOE_MODE 0x00000001 +#define FW_INIT_HALT_P0 0x000191ac +#define __FW_INIT_HALT_P 0x00000001 +#define FW_INIT_HALT_P1 0x000191bc +#define PMM_1T_RESET_REG_P0 0x0002381c +#define __PMM_1T_RESET_P 0x00000001 +#define PMM_1T_RESET_REG_P1 0x00023c1c + +/** + * Brocade 1860 Adapter specific defines + */ +#define CT2_PCI_CPQ_BASE 0x00030000 +#define CT2_PCI_APP_BASE 0x00030100 +#define CT2_PCI_ETH_BASE 0x00030400 + +/* + * APP block registers + */ +#define CT2_HOSTFN_INT_STATUS (CT2_PCI_APP_BASE + 0x00) +#define CT2_HOSTFN_INTR_MASK (CT2_PCI_APP_BASE + 0x04) +#define CT2_HOSTFN_PERSONALITY0 (CT2_PCI_APP_BASE + 0x08) +#define __PME_STATUS_ 0x00200000 +#define __PF_VF_BAR_SIZE_MODE__MK 0x00180000 +#define __PF_VF_BAR_SIZE_MODE__SH 19 +#define __PF_VF_BAR_SIZE_MODE_(_v) ((_v) << __PF_VF_BAR_SIZE_MODE__SH) +#define __FC_LL_PORT_MAP__MK 0x00060000 +#define __FC_LL_PORT_MAP__SH 17 +#define __FC_LL_PORT_MAP_(_v) ((_v) << __FC_LL_PORT_MAP__SH) +#define __PF_VF_ACTIVE_ 0x00010000 +#define __PF_VF_CFG_RDY_ 0x00008000 +#define __PF_VF_ENABLE_ 0x00004000 +#define __PF_DRIVER_ACTIVE_ 0x00002000 +#define __PF_PME_SEND_ENABLE_ 0x00001000 +#define __PF_EXROM_OFFSET__MK 0x00000ff0 +#define __PF_EXROM_OFFSET__SH 4 +#define __PF_EXROM_OFFSET_(_v) ((_v) << __PF_EXROM_OFFSET__SH) +#define __FC_LL_MODE_ 0x00000008 +#define __PF_INTX_PIN_ 0x00000007 +#define CT2_HOSTFN_PERSONALITY1 (CT2_PCI_APP_BASE + 0x0C) +#define __PF_NUM_QUEUES1__MK 0xff000000 +#define __PF_NUM_QUEUES1__SH 24 +#define __PF_NUM_QUEUES1_(_v) ((_v) << __PF_NUM_QUEUES1__SH) +#define __PF_VF_QUE_OFFSET1__MK 0x00ff0000 +#define __PF_VF_QUE_OFFSET1__SH 16 +#define __PF_VF_QUE_OFFSET1_(_v) ((_v) << __PF_VF_QUE_OFFSET1__SH) +#define __PF_VF_NUM_QUEUES__MK 0x0000ff00 +#define __PF_VF_NUM_QUEUES__SH 8 +#define __PF_VF_NUM_QUEUES_(_v) ((_v) << __PF_VF_NUM_QUEUES__SH) +#define __PF_VF_QUE_OFFSET_ 0x000000ff +#define CT2_HOSTFN_PAGE_NUM (CT2_PCI_APP_BASE + 0x18) +#define CT2_HOSTFN_MSIX_VT_INDEX_MBOX_ERR (CT2_PCI_APP_BASE + 0x38) + +/* + * Brocade 1860 adapter CPQ block registers + */ +#define CT2_HOSTFN_LPU0_MBOX0 (CT2_PCI_CPQ_BASE + 0x00) +#define CT2_HOSTFN_LPU1_MBOX0 (CT2_PCI_CPQ_BASE + 0x20) +#define CT2_LPU0_HOSTFN_MBOX0 (CT2_PCI_CPQ_BASE + 0x40) +#define CT2_LPU1_HOSTFN_MBOX0 (CT2_PCI_CPQ_BASE + 0x60) +#define CT2_HOSTFN_LPU0_CMD_STAT (CT2_PCI_CPQ_BASE + 0x80) +#define CT2_HOSTFN_LPU1_CMD_STAT (CT2_PCI_CPQ_BASE + 0x84) +#define CT2_LPU0_HOSTFN_CMD_STAT (CT2_PCI_CPQ_BASE + 0x88) +#define CT2_LPU1_HOSTFN_CMD_STAT (CT2_PCI_CPQ_BASE + 0x8c) +#define CT2_HOSTFN_LPU0_READ_STAT (CT2_PCI_CPQ_BASE + 0x90) +#define CT2_HOSTFN_LPU1_READ_STAT (CT2_PCI_CPQ_BASE + 0x94) +#define CT2_LPU0_HOSTFN_MBOX0_MSK (CT2_PCI_CPQ_BASE + 0x98) +#define CT2_LPU1_HOSTFN_MBOX0_MSK (CT2_PCI_CPQ_BASE + 0x9C) +#define CT2_HOST_SEM0_REG 0x000148f0 +#define CT2_HOST_SEM1_REG 0x000148f4 +#define CT2_HOST_SEM2_REG 0x000148f8 +#define CT2_HOST_SEM3_REG 0x000148fc +#define CT2_HOST_SEM4_REG 0x00014900 +#define CT2_HOST_SEM5_REG 0x00014904 +#define CT2_HOST_SEM6_REG 0x00014908 +#define CT2_HOST_SEM7_REG 0x0001490c +#define CT2_HOST_SEM0_INFO_REG 0x000148b0 +#define CT2_HOST_SEM1_INFO_REG 0x000148b4 +#define CT2_HOST_SEM2_INFO_REG 0x000148b8 +#define CT2_HOST_SEM3_INFO_REG 0x000148bc +#define CT2_HOST_SEM4_INFO_REG 0x000148c0 +#define CT2_HOST_SEM5_INFO_REG 0x000148c4 +#define CT2_HOST_SEM6_INFO_REG 0x000148c8 +#define CT2_HOST_SEM7_INFO_REG 0x000148cc + +#define CT2_APP_PLL_LCLK_CTL_REG 0x00014808 +#define __APP_LPUCLK_HALFSPEED 0x40000000 +#define __APP_PLL_LCLK_LOAD 0x20000000 +#define __APP_PLL_LCLK_FBCNT_MK 0x1fe00000 +#define __APP_PLL_LCLK_FBCNT_SH 21 +#define __APP_PLL_LCLK_FBCNT(_v) ((_v) << __APP_PLL_SCLK_FBCNT_SH) +enum { + __APP_PLL_LCLK_FBCNT_425_MHZ = 6, + __APP_PLL_LCLK_FBCNT_468_MHZ = 4, +}; +#define __APP_PLL_LCLK_EXTFB 0x00000800 +#define __APP_PLL_LCLK_ENOUTS 0x00000400 +#define __APP_PLL_LCLK_RATE 0x00000010 +#define CT2_APP_PLL_SCLK_CTL_REG 0x0001480c +#define __P_SCLK_PLL_LOCK 0x80000000 +#define __APP_PLL_SCLK_REFCLK_SEL 0x40000000 +#define __APP_PLL_SCLK_CLK_DIV2 0x20000000 +#define __APP_PLL_SCLK_LOAD 0x10000000 +#define __APP_PLL_SCLK_FBCNT_MK 0x0ff00000 +#define __APP_PLL_SCLK_FBCNT_SH 20 +#define __APP_PLL_SCLK_FBCNT(_v) ((_v) << __APP_PLL_SCLK_FBCNT_SH) +enum { + __APP_PLL_SCLK_FBCNT_NORM = 6, + __APP_PLL_SCLK_FBCNT_10G_FC = 10, +}; +#define __APP_PLL_SCLK_EXTFB 0x00000800 +#define __APP_PLL_SCLK_ENOUTS 0x00000400 +#define __APP_PLL_SCLK_RATE 0x00000010 +#define CT2_PCIE_MISC_REG 0x00014804 +#define __ETH_CLK_ENABLE_PORT1 0x00000010 +#define CT2_CHIP_MISC_PRG 0x000148a4 +#define __ETH_CLK_ENABLE_PORT0 0x00004000 +#define __APP_LPU_SPEED 0x00000002 +#define CT2_MBIST_STAT_REG 0x00014818 +#define CT2_MBIST_CTL_REG 0x0001481c +#define CT2_PMM_1T_CONTROL_REG_P0 0x0002381c +#define __PMM_1T_PNDB_P 0x00000002 +#define CT2_PMM_1T_CONTROL_REG_P1 0x00023c1c +#define CT2_WGN_STATUS 0x00014990 +#define __A2T_AHB_LOAD 0x00000800 +#define __WGN_READY 0x00000400 +#define __GLBL_PF_VF_CFG_RDY 0x00000200 +#define CT2_NFC_CSR_SET_REG 0x00027424 +#define __HALT_NFC_CONTROLLER 0x00000002 +#define __NFC_CONTROLLER_HALTED 0x00001000 + +#define CT2_CSI_MAC0_CONTROL_REG 0x000270d0 +#define __CSI_MAC_RESET 0x00000010 +#define __CSI_MAC_AHB_RESET 0x00000008 +#define CT2_CSI_MAC1_CONTROL_REG 0x000270d4 +#define CT2_CSI_MAC_CONTROL_REG(__n) \ + (CT2_CSI_MAC0_CONTROL_REG + \ + (__n) * (CT2_CSI_MAC1_CONTROL_REG - CT2_CSI_MAC0_CONTROL_REG)) + +/* + * Name semaphore registers based on usage + */ +#define BFA_IOC0_HBEAT_REG HOST_SEM0_INFO_REG +#define BFA_IOC0_STATE_REG HOST_SEM1_INFO_REG +#define BFA_IOC1_HBEAT_REG HOST_SEM2_INFO_REG +#define BFA_IOC1_STATE_REG HOST_SEM3_INFO_REG +#define BFA_FW_USE_COUNT HOST_SEM4_INFO_REG +#define BFA_IOC_FAIL_SYNC HOST_SEM5_INFO_REG + +/* + * CT2 semaphore register locations changed + */ +#define CT2_BFA_IOC0_HBEAT_REG CT2_HOST_SEM0_INFO_REG +#define CT2_BFA_IOC0_STATE_REG CT2_HOST_SEM1_INFO_REG +#define CT2_BFA_IOC1_HBEAT_REG CT2_HOST_SEM2_INFO_REG +#define CT2_BFA_IOC1_STATE_REG CT2_HOST_SEM3_INFO_REG +#define CT2_BFA_FW_USE_COUNT CT2_HOST_SEM4_INFO_REG +#define CT2_BFA_IOC_FAIL_SYNC CT2_HOST_SEM5_INFO_REG + +#define CPE_Q_NUM(__fn, __q) (((__fn) << 2) + (__q)) +#define RME_Q_NUM(__fn, __q) (((__fn) << 2) + (__q)) + +/* + * And corresponding host interrupt status bit field defines + */ +#define __HFN_INT_CPE_Q0 0x00000001U +#define __HFN_INT_CPE_Q1 0x00000002U +#define __HFN_INT_CPE_Q2 0x00000004U +#define __HFN_INT_CPE_Q3 0x00000008U +#define __HFN_INT_CPE_Q4 0x00000010U +#define __HFN_INT_CPE_Q5 0x00000020U +#define __HFN_INT_CPE_Q6 0x00000040U +#define __HFN_INT_CPE_Q7 0x00000080U +#define __HFN_INT_RME_Q0 0x00000100U +#define __HFN_INT_RME_Q1 0x00000200U +#define __HFN_INT_RME_Q2 0x00000400U +#define __HFN_INT_RME_Q3 0x00000800U +#define __HFN_INT_RME_Q4 0x00001000U +#define __HFN_INT_RME_Q5 0x00002000U +#define __HFN_INT_RME_Q6 0x00004000U +#define __HFN_INT_RME_Q7 0x00008000U +#define __HFN_INT_ERR_EMC 0x00010000U +#define __HFN_INT_ERR_LPU0 0x00020000U +#define __HFN_INT_ERR_LPU1 0x00040000U +#define __HFN_INT_ERR_PSS 0x00080000U +#define __HFN_INT_MBOX_LPU0 0x00100000U +#define __HFN_INT_MBOX_LPU1 0x00200000U +#define __HFN_INT_MBOX1_LPU0 0x00400000U +#define __HFN_INT_MBOX1_LPU1 0x00800000U +#define __HFN_INT_LL_HALT 0x01000000U +#define __HFN_INT_CPE_MASK 0x000000ffU +#define __HFN_INT_RME_MASK 0x0000ff00U +#define __HFN_INT_ERR_MASK \ + (__HFN_INT_ERR_EMC | __HFN_INT_ERR_LPU0 | __HFN_INT_ERR_LPU1 | \ + __HFN_INT_ERR_PSS | __HFN_INT_LL_HALT) +#define __HFN_INT_FN0_MASK \ + (__HFN_INT_CPE_Q0 | __HFN_INT_CPE_Q1 | __HFN_INT_CPE_Q2 | \ + __HFN_INT_CPE_Q3 | __HFN_INT_RME_Q0 | __HFN_INT_RME_Q1 | \ + __HFN_INT_RME_Q2 | __HFN_INT_RME_Q3 | __HFN_INT_MBOX_LPU0) +#define __HFN_INT_FN1_MASK \ + (__HFN_INT_CPE_Q4 | __HFN_INT_CPE_Q5 | __HFN_INT_CPE_Q6 | \ + __HFN_INT_CPE_Q7 | __HFN_INT_RME_Q4 | __HFN_INT_RME_Q5 | \ + __HFN_INT_RME_Q6 | __HFN_INT_RME_Q7 | __HFN_INT_MBOX_LPU1) + +/* + * Host interrupt status defines for 1860 + */ +#define __HFN_INT_MBOX_LPU0_CT2 0x00010000U +#define __HFN_INT_MBOX_LPU1_CT2 0x00020000U +#define __HFN_INT_ERR_PSS_CT2 0x00040000U +#define __HFN_INT_ERR_LPU0_CT2 0x00080000U +#define __HFN_INT_ERR_LPU1_CT2 0x00100000U +#define __HFN_INT_CPQ_HALT_CT2 0x00200000U +#define __HFN_INT_ERR_WGN_CT2 0x00400000U +#define __HFN_INT_ERR_LEHRX_CT2 0x00800000U +#define __HFN_INT_ERR_LEHTX_CT2 0x01000000U +#define __HFN_INT_ERR_MASK_CT2 \ + (__HFN_INT_ERR_PSS_CT2 | __HFN_INT_ERR_LPU0_CT2 | \ + __HFN_INT_ERR_LPU1_CT2 | __HFN_INT_CPQ_HALT_CT2 | \ + __HFN_INT_ERR_WGN_CT2 | __HFN_INT_ERR_LEHRX_CT2 | \ + __HFN_INT_ERR_LEHTX_CT2) +#define __HFN_INT_FN0_MASK_CT2 \ + (__HFN_INT_CPE_Q0 | __HFN_INT_CPE_Q1 | __HFN_INT_CPE_Q2 | \ + __HFN_INT_CPE_Q3 | __HFN_INT_RME_Q0 | __HFN_INT_RME_Q1 | \ + __HFN_INT_RME_Q2 | __HFN_INT_RME_Q3 | __HFN_INT_MBOX_LPU0_CT2) +#define __HFN_INT_FN1_MASK_CT2 \ + (__HFN_INT_CPE_Q4 | __HFN_INT_CPE_Q5 | __HFN_INT_CPE_Q6 | \ + __HFN_INT_CPE_Q7 | __HFN_INT_RME_Q4 | __HFN_INT_RME_Q5 | \ + __HFN_INT_RME_Q6 | __HFN_INT_RME_Q7 | __HFN_INT_MBOX_LPU1_CT2) + +/* + * asic memory map. + */ +#define PSS_SMEM_PAGE_START 0x8000 +#define PSS_SMEM_PGNUM(_pg0, _ma) ((_pg0) + ((_ma) >> 15)) +#define PSS_SMEM_PGOFF(_ma) ((_ma) & 0x7fff) + +#endif /* __BFI_REG_H__ */ diff --git a/drivers/net/bna/bna_hw.h b/drivers/net/bna/bna_hw.h index cad233da843a..16a5eed4a03b 100644 --- a/drivers/net/bna/bna_hw.h +++ b/drivers/net/bna/bna_hw.h @@ -14,14 +14,16 @@ * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. * All rights reserved * www.brocade.com - * + */ + +/** * File for interrupt macros and functions */ #ifndef __BNA_HW_H__ #define __BNA_HW_H__ -#include "bfi_ctreg.h" +#include "bfi_reg.h" /** * diff --git a/drivers/net/bna/bnad_ethtool.c b/drivers/net/bna/bnad_ethtool.c index fea07f19a5db..49174f87f4d1 100644 --- a/drivers/net/bna/bnad_ethtool.c +++ b/drivers/net/bna/bnad_ethtool.c @@ -288,323 +288,6 @@ bnad_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) strncpy(drvinfo->bus_info, pci_name(bnad->pcidev), ETHTOOL_BUSINFO_LEN); } -static int -get_regs(struct bnad *bnad, u32 * regs) -{ - int num = 0, i; - u32 reg_addr; - unsigned long flags; - -#define BNAD_GET_REG(addr) \ -do { \ - if (regs) \ - regs[num++] = readl(bnad->bar0 + (addr)); \ - else \ - num++; \ -} while (0) - - spin_lock_irqsave(&bnad->bna_lock, flags); - - /* DMA Block Internal Registers */ - BNAD_GET_REG(DMA_CTRL_REG0); - BNAD_GET_REG(DMA_CTRL_REG1); - BNAD_GET_REG(DMA_ERR_INT_STATUS); - BNAD_GET_REG(DMA_ERR_INT_ENABLE); - BNAD_GET_REG(DMA_ERR_INT_STATUS_SET); - - /* APP Block Register Address Offset from BAR0 */ - BNAD_GET_REG(HOSTFN0_INT_STATUS); - BNAD_GET_REG(HOSTFN0_INT_MASK); - BNAD_GET_REG(HOST_PAGE_NUM_FN0); - BNAD_GET_REG(HOST_MSIX_ERR_INDEX_FN0); - BNAD_GET_REG(FN0_PCIE_ERR_REG); - BNAD_GET_REG(FN0_ERR_TYPE_STATUS_REG); - BNAD_GET_REG(FN0_ERR_TYPE_MSK_STATUS_REG); - - BNAD_GET_REG(HOSTFN1_INT_STATUS); - BNAD_GET_REG(HOSTFN1_INT_MASK); - BNAD_GET_REG(HOST_PAGE_NUM_FN1); - BNAD_GET_REG(HOST_MSIX_ERR_INDEX_FN1); - BNAD_GET_REG(FN1_PCIE_ERR_REG); - BNAD_GET_REG(FN1_ERR_TYPE_STATUS_REG); - BNAD_GET_REG(FN1_ERR_TYPE_MSK_STATUS_REG); - - BNAD_GET_REG(PCIE_MISC_REG); - - BNAD_GET_REG(HOST_SEM0_INFO_REG); - BNAD_GET_REG(HOST_SEM1_INFO_REG); - BNAD_GET_REG(HOST_SEM2_INFO_REG); - BNAD_GET_REG(HOST_SEM3_INFO_REG); - - BNAD_GET_REG(TEMPSENSE_CNTL_REG); - BNAD_GET_REG(TEMPSENSE_STAT_REG); - - BNAD_GET_REG(APP_LOCAL_ERR_STAT); - BNAD_GET_REG(APP_LOCAL_ERR_MSK); - - BNAD_GET_REG(PCIE_LNK_ERR_STAT); - BNAD_GET_REG(PCIE_LNK_ERR_MSK); - - BNAD_GET_REG(FCOE_FIP_ETH_TYPE); - BNAD_GET_REG(RESV_ETH_TYPE); - - BNAD_GET_REG(HOSTFN2_INT_STATUS); - BNAD_GET_REG(HOSTFN2_INT_MASK); - BNAD_GET_REG(HOST_PAGE_NUM_FN2); - BNAD_GET_REG(HOST_MSIX_ERR_INDEX_FN2); - BNAD_GET_REG(FN2_PCIE_ERR_REG); - BNAD_GET_REG(FN2_ERR_TYPE_STATUS_REG); - BNAD_GET_REG(FN2_ERR_TYPE_MSK_STATUS_REG); - - BNAD_GET_REG(HOSTFN3_INT_STATUS); - BNAD_GET_REG(HOSTFN3_INT_MASK); - BNAD_GET_REG(HOST_PAGE_NUM_FN3); - BNAD_GET_REG(HOST_MSIX_ERR_INDEX_FN3); - BNAD_GET_REG(FN3_PCIE_ERR_REG); - BNAD_GET_REG(FN3_ERR_TYPE_STATUS_REG); - BNAD_GET_REG(FN3_ERR_TYPE_MSK_STATUS_REG); - - /* Host Command Status Registers */ - reg_addr = HOST_CMDSTS0_CLR_REG; - for (i = 0; i < 16; i++) { - BNAD_GET_REG(reg_addr); - BNAD_GET_REG(reg_addr + 4); - BNAD_GET_REG(reg_addr + 8); - reg_addr += 0x10; - } - - /* Function ID register */ - BNAD_GET_REG(FNC_ID_REG); - - /* Function personality register */ - BNAD_GET_REG(FNC_PERS_REG); - - /* Operation mode register */ - BNAD_GET_REG(OP_MODE); - - /* LPU0 Registers */ - BNAD_GET_REG(LPU0_MBOX_CTL_REG); - BNAD_GET_REG(LPU0_MBOX_CMD_REG); - BNAD_GET_REG(LPU0_MBOX_LINK_0REG); - BNAD_GET_REG(LPU1_MBOX_LINK_0REG); - BNAD_GET_REG(LPU0_MBOX_STATUS_0REG); - BNAD_GET_REG(LPU1_MBOX_STATUS_0REG); - BNAD_GET_REG(LPU0_ERR_STATUS_REG); - BNAD_GET_REG(LPU0_ERR_SET_REG); - - /* LPU1 Registers */ - BNAD_GET_REG(LPU1_MBOX_CTL_REG); - BNAD_GET_REG(LPU1_MBOX_CMD_REG); - BNAD_GET_REG(LPU0_MBOX_LINK_1REG); - BNAD_GET_REG(LPU1_MBOX_LINK_1REG); - BNAD_GET_REG(LPU0_MBOX_STATUS_1REG); - BNAD_GET_REG(LPU1_MBOX_STATUS_1REG); - BNAD_GET_REG(LPU1_ERR_STATUS_REG); - BNAD_GET_REG(LPU1_ERR_SET_REG); - - /* PSS Registers */ - BNAD_GET_REG(PSS_CTL_REG); - BNAD_GET_REG(PSS_ERR_STATUS_REG); - BNAD_GET_REG(ERR_STATUS_SET); - BNAD_GET_REG(PSS_RAM_ERR_STATUS_REG); - - /* Catapult CPQ Registers */ - BNAD_GET_REG(HOSTFN0_LPU0_MBOX0_CMD_STAT); - BNAD_GET_REG(HOSTFN0_LPU1_MBOX0_CMD_STAT); - BNAD_GET_REG(LPU0_HOSTFN0_MBOX0_CMD_STAT); - BNAD_GET_REG(LPU1_HOSTFN0_MBOX0_CMD_STAT); - - BNAD_GET_REG(HOSTFN0_LPU0_MBOX1_CMD_STAT); - BNAD_GET_REG(HOSTFN0_LPU1_MBOX1_CMD_STAT); - BNAD_GET_REG(LPU0_HOSTFN0_MBOX1_CMD_STAT); - BNAD_GET_REG(LPU1_HOSTFN0_MBOX1_CMD_STAT); - - BNAD_GET_REG(HOSTFN1_LPU0_MBOX0_CMD_STAT); - BNAD_GET_REG(HOSTFN1_LPU1_MBOX0_CMD_STAT); - BNAD_GET_REG(LPU0_HOSTFN1_MBOX0_CMD_STAT); - BNAD_GET_REG(LPU1_HOSTFN1_MBOX0_CMD_STAT); - - BNAD_GET_REG(HOSTFN1_LPU0_MBOX1_CMD_STAT); - BNAD_GET_REG(HOSTFN1_LPU1_MBOX1_CMD_STAT); - BNAD_GET_REG(LPU0_HOSTFN1_MBOX1_CMD_STAT); - BNAD_GET_REG(LPU1_HOSTFN1_MBOX1_CMD_STAT); - - BNAD_GET_REG(HOSTFN2_LPU0_MBOX0_CMD_STAT); - BNAD_GET_REG(HOSTFN2_LPU1_MBOX0_CMD_STAT); - BNAD_GET_REG(LPU0_HOSTFN2_MBOX0_CMD_STAT); - BNAD_GET_REG(LPU1_HOSTFN2_MBOX0_CMD_STAT); - - BNAD_GET_REG(HOSTFN2_LPU0_MBOX1_CMD_STAT); - BNAD_GET_REG(HOSTFN2_LPU1_MBOX1_CMD_STAT); - BNAD_GET_REG(LPU0_HOSTFN2_MBOX1_CMD_STAT); - BNAD_GET_REG(LPU1_HOSTFN2_MBOX1_CMD_STAT); - - BNAD_GET_REG(HOSTFN3_LPU0_MBOX0_CMD_STAT); - BNAD_GET_REG(HOSTFN3_LPU1_MBOX0_CMD_STAT); - BNAD_GET_REG(LPU0_HOSTFN3_MBOX0_CMD_STAT); - BNAD_GET_REG(LPU1_HOSTFN3_MBOX0_CMD_STAT); - - BNAD_GET_REG(HOSTFN3_LPU0_MBOX1_CMD_STAT); - BNAD_GET_REG(HOSTFN3_LPU1_MBOX1_CMD_STAT); - BNAD_GET_REG(LPU0_HOSTFN3_MBOX1_CMD_STAT); - BNAD_GET_REG(LPU1_HOSTFN3_MBOX1_CMD_STAT); - - /* Host Function Force Parity Error Registers */ - BNAD_GET_REG(HOSTFN0_LPU_FORCE_PERR); - BNAD_GET_REG(HOSTFN1_LPU_FORCE_PERR); - BNAD_GET_REG(HOSTFN2_LPU_FORCE_PERR); - BNAD_GET_REG(HOSTFN3_LPU_FORCE_PERR); - - /* LL Port[0|1] Halt Mask Registers */ - BNAD_GET_REG(LL_HALT_MSK_P0); - BNAD_GET_REG(LL_HALT_MSK_P1); - - /* LL Port[0|1] Error Mask Registers */ - BNAD_GET_REG(LL_ERR_MSK_P0); - BNAD_GET_REG(LL_ERR_MSK_P1); - - /* EMC FLI Registers */ - BNAD_GET_REG(FLI_CMD_REG); - BNAD_GET_REG(FLI_ADDR_REG); - BNAD_GET_REG(FLI_CTL_REG); - BNAD_GET_REG(FLI_WRDATA_REG); - BNAD_GET_REG(FLI_RDDATA_REG); - BNAD_GET_REG(FLI_DEV_STATUS_REG); - BNAD_GET_REG(FLI_SIG_WD_REG); - - BNAD_GET_REG(FLI_DEV_VENDOR_REG); - BNAD_GET_REG(FLI_ERR_STATUS_REG); - - /* RxAdm 0 Registers */ - BNAD_GET_REG(RAD0_CTL_REG); - BNAD_GET_REG(RAD0_PE_PARM_REG); - BNAD_GET_REG(RAD0_BCN_REG); - BNAD_GET_REG(RAD0_DEFAULT_REG); - BNAD_GET_REG(RAD0_PROMISC_REG); - BNAD_GET_REG(RAD0_BCNQ_REG); - BNAD_GET_REG(RAD0_DEFAULTQ_REG); - - BNAD_GET_REG(RAD0_ERR_STS); - BNAD_GET_REG(RAD0_SET_ERR_STS); - BNAD_GET_REG(RAD0_ERR_INT_EN); - BNAD_GET_REG(RAD0_FIRST_ERR); - BNAD_GET_REG(RAD0_FORCE_ERR); - - BNAD_GET_REG(RAD0_MAC_MAN_1H); - BNAD_GET_REG(RAD0_MAC_MAN_1L); - BNAD_GET_REG(RAD0_MAC_MAN_2H); - BNAD_GET_REG(RAD0_MAC_MAN_2L); - BNAD_GET_REG(RAD0_MAC_MAN_3H); - BNAD_GET_REG(RAD0_MAC_MAN_3L); - BNAD_GET_REG(RAD0_MAC_MAN_4H); - BNAD_GET_REG(RAD0_MAC_MAN_4L); - - BNAD_GET_REG(RAD0_LAST4_IP); - - /* RxAdm 1 Registers */ - BNAD_GET_REG(RAD1_CTL_REG); - BNAD_GET_REG(RAD1_PE_PARM_REG); - BNAD_GET_REG(RAD1_BCN_REG); - BNAD_GET_REG(RAD1_DEFAULT_REG); - BNAD_GET_REG(RAD1_PROMISC_REG); - BNAD_GET_REG(RAD1_BCNQ_REG); - BNAD_GET_REG(RAD1_DEFAULTQ_REG); - - BNAD_GET_REG(RAD1_ERR_STS); - BNAD_GET_REG(RAD1_SET_ERR_STS); - BNAD_GET_REG(RAD1_ERR_INT_EN); - - /* TxA0 Registers */ - BNAD_GET_REG(TXA0_CTRL_REG); - /* TxA0 TSO Sequence # Registers (RO) */ - for (i = 0; i < 8; i++) { - BNAD_GET_REG(TXA0_TSO_TCP_SEQ_REG(i)); - BNAD_GET_REG(TXA0_TSO_IP_INFO_REG(i)); - } - - /* TxA1 Registers */ - BNAD_GET_REG(TXA1_CTRL_REG); - /* TxA1 TSO Sequence # Registers (RO) */ - for (i = 0; i < 8; i++) { - BNAD_GET_REG(TXA1_TSO_TCP_SEQ_REG(i)); - BNAD_GET_REG(TXA1_TSO_IP_INFO_REG(i)); - } - - /* RxA Registers */ - BNAD_GET_REG(RXA0_CTL_REG); - BNAD_GET_REG(RXA1_CTL_REG); - - /* PLB0 Registers */ - BNAD_GET_REG(PLB0_ECM_TIMER_REG); - BNAD_GET_REG(PLB0_RL_CTL); - for (i = 0; i < 8; i++) - BNAD_GET_REG(PLB0_RL_MAX_BC(i)); - BNAD_GET_REG(PLB0_RL_TU_PRIO); - for (i = 0; i < 8; i++) - BNAD_GET_REG(PLB0_RL_BYTE_CNT(i)); - BNAD_GET_REG(PLB0_RL_MIN_REG); - BNAD_GET_REG(PLB0_RL_MAX_REG); - BNAD_GET_REG(PLB0_EMS_ADD_REG); - - /* PLB1 Registers */ - BNAD_GET_REG(PLB1_ECM_TIMER_REG); - BNAD_GET_REG(PLB1_RL_CTL); - for (i = 0; i < 8; i++) - BNAD_GET_REG(PLB1_RL_MAX_BC(i)); - BNAD_GET_REG(PLB1_RL_TU_PRIO); - for (i = 0; i < 8; i++) - BNAD_GET_REG(PLB1_RL_BYTE_CNT(i)); - BNAD_GET_REG(PLB1_RL_MIN_REG); - BNAD_GET_REG(PLB1_RL_MAX_REG); - BNAD_GET_REG(PLB1_EMS_ADD_REG); - - /* HQM Control Register */ - BNAD_GET_REG(HQM0_CTL_REG); - BNAD_GET_REG(HQM0_RXQ_STOP_SEM); - BNAD_GET_REG(HQM0_TXQ_STOP_SEM); - BNAD_GET_REG(HQM1_CTL_REG); - BNAD_GET_REG(HQM1_RXQ_STOP_SEM); - BNAD_GET_REG(HQM1_TXQ_STOP_SEM); - - /* LUT Registers */ - BNAD_GET_REG(LUT0_ERR_STS); - BNAD_GET_REG(LUT0_SET_ERR_STS); - BNAD_GET_REG(LUT1_ERR_STS); - BNAD_GET_REG(LUT1_SET_ERR_STS); - - /* TRC Registers */ - BNAD_GET_REG(TRC_CTL_REG); - BNAD_GET_REG(TRC_MODS_REG); - BNAD_GET_REG(TRC_TRGC_REG); - BNAD_GET_REG(TRC_CNT1_REG); - BNAD_GET_REG(TRC_CNT2_REG); - BNAD_GET_REG(TRC_NXTS_REG); - BNAD_GET_REG(TRC_DIRR_REG); - for (i = 0; i < 10; i++) - BNAD_GET_REG(TRC_TRGM_REG(i)); - for (i = 0; i < 10; i++) - BNAD_GET_REG(TRC_NXTM_REG(i)); - for (i = 0; i < 10; i++) - BNAD_GET_REG(TRC_STRM_REG(i)); - - spin_unlock_irqrestore(&bnad->bna_lock, flags); -#undef BNAD_GET_REG - return num; -} -static int -bnad_get_regs_len(struct net_device *netdev) -{ - int ret = get_regs(netdev_priv(netdev), NULL) * sizeof(u32); - return ret; -} - -static void -bnad_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *buf) -{ - memset(buf, 0, bnad_get_regs_len(netdev)); - get_regs(netdev_priv(netdev), buf); -} - static void bnad_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wolinfo) { @@ -1192,8 +875,6 @@ static struct ethtool_ops bnad_ethtool_ops = { .get_settings = bnad_get_settings, .set_settings = bnad_set_settings, .get_drvinfo = bnad_get_drvinfo, - .get_regs_len = bnad_get_regs_len, - .get_regs = bnad_get_regs, .get_wol = bnad_get_wol, .get_link = ethtool_op_get_link, .get_coalesce = bnad_get_coalesce, diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c index d4aa40adf1e9..b470281158e9 100644 --- a/drivers/net/ipg.c +++ b/drivers/net/ipg.c @@ -20,6 +20,9 @@ * http://www.icplus.com.tw * jesse@icplus.com.tw */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/crc32.h> #include <linux/ethtool.h> #include <linux/interrupt.h> @@ -67,7 +70,7 @@ MODULE_LICENSE("GPL"); * Variable record -- index by leading revision/length * Revision/Length(=N*4), Address1, Data1, Address2, Data2,...,AddressN,DataN */ -static unsigned short DefaultPhyParam[] = { +static const unsigned short DefaultPhyParam[] = { /* 11/12/03 IP1000A v1-3 rev=0x40 */ /*-------------------------------------------------------------------------- (0x4000|(15*4)), 31, 0x0001, 27, 0x01e0, 31, 0x0002, 22, 0x85bd, 24, 0xfff2, @@ -85,7 +88,7 @@ static unsigned short DefaultPhyParam[] = { 0x0000 }; -static const char *ipg_brand_name[] = { +static const char * const ipg_brand_name[] = { "IC PLUS IP1000 1000/100/10 based NIC", "Sundance Technology ST2021 based NIC", "Tamarack Microelectronics TC9020/9021 based NIC", @@ -118,23 +121,23 @@ static void ipg_dump_rfdlist(struct net_device *dev) IPG_DEBUG_MSG("_dump_rfdlist\n"); - printk(KERN_INFO "rx_current = %2.2x\n", sp->rx_current); - printk(KERN_INFO "rx_dirty = %2.2x\n", sp->rx_dirty); - printk(KERN_INFO "RFDList start address = %16.16lx\n", - (unsigned long) sp->rxd_map); - printk(KERN_INFO "RFDListPtr register = %8.8x%8.8x\n", - ipg_r32(IPG_RFDLISTPTR1), ipg_r32(IPG_RFDLISTPTR0)); + netdev_info(dev, "rx_current = %02x\n", sp->rx_current); + netdev_info(dev, "rx_dirty = %02x\n", sp->rx_dirty); + netdev_info(dev, "RFDList start address = %016lx\n", + (unsigned long)sp->rxd_map); + netdev_info(dev, "RFDListPtr register = %08x%08x\n", + ipg_r32(IPG_RFDLISTPTR1), ipg_r32(IPG_RFDLISTPTR0)); for (i = 0; i < IPG_RFDLIST_LENGTH; i++) { offset = (u32) &sp->rxd[i].next_desc - (u32) sp->rxd; - printk(KERN_INFO "%2.2x %4.4x RFDNextPtr = %16.16lx\n", i, - offset, (unsigned long) sp->rxd[i].next_desc); + netdev_info(dev, "%02x %04x RFDNextPtr = %016lx\n", + i, offset, (unsigned long)sp->rxd[i].next_desc); offset = (u32) &sp->rxd[i].rfs - (u32) sp->rxd; - printk(KERN_INFO "%2.2x %4.4x RFS = %16.16lx\n", i, - offset, (unsigned long) sp->rxd[i].rfs); + netdev_info(dev, "%02x %04x RFS = %016lx\n", + i, offset, (unsigned long)sp->rxd[i].rfs); offset = (u32) &sp->rxd[i].frag_info - (u32) sp->rxd; - printk(KERN_INFO "%2.2x %4.4x frag_info = %16.16lx\n", i, - offset, (unsigned long) sp->rxd[i].frag_info); + netdev_info(dev, "%02x %04x frag_info = %016lx\n", + i, offset, (unsigned long)sp->rxd[i].frag_info); } } @@ -147,24 +150,24 @@ static void ipg_dump_tfdlist(struct net_device *dev) IPG_DEBUG_MSG("_dump_tfdlist\n"); - printk(KERN_INFO "tx_current = %2.2x\n", sp->tx_current); - printk(KERN_INFO "tx_dirty = %2.2x\n", sp->tx_dirty); - printk(KERN_INFO "TFDList start address = %16.16lx\n", - (unsigned long) sp->txd_map); - printk(KERN_INFO "TFDListPtr register = %8.8x%8.8x\n", - ipg_r32(IPG_TFDLISTPTR1), ipg_r32(IPG_TFDLISTPTR0)); + netdev_info(dev, "tx_current = %02x\n", sp->tx_current); + netdev_info(dev, "tx_dirty = %02x\n", sp->tx_dirty); + netdev_info(dev, "TFDList start address = %016lx\n", + (unsigned long) sp->txd_map); + netdev_info(dev, "TFDListPtr register = %08x%08x\n", + ipg_r32(IPG_TFDLISTPTR1), ipg_r32(IPG_TFDLISTPTR0)); for (i = 0; i < IPG_TFDLIST_LENGTH; i++) { offset = (u32) &sp->txd[i].next_desc - (u32) sp->txd; - printk(KERN_INFO "%2.2x %4.4x TFDNextPtr = %16.16lx\n", i, - offset, (unsigned long) sp->txd[i].next_desc); + netdev_info(dev, "%02x %04x TFDNextPtr = %016lx\n", + i, offset, (unsigned long)sp->txd[i].next_desc); offset = (u32) &sp->txd[i].tfc - (u32) sp->txd; - printk(KERN_INFO "%2.2x %4.4x TFC = %16.16lx\n", i, - offset, (unsigned long) sp->txd[i].tfc); + netdev_info(dev, "%02x %04x TFC = %016lx\n", + i, offset, (unsigned long) sp->txd[i].tfc); offset = (u32) &sp->txd[i].frag_info - (u32) sp->txd; - printk(KERN_INFO "%2.2x %4.4x frag_info = %16.16lx\n", i, - offset, (unsigned long) sp->txd[i].frag_info); + netdev_info(dev, "%02x %04x frag_info = %016lx\n", + i, offset, (unsigned long) sp->txd[i].frag_info); } } #endif @@ -480,6 +483,10 @@ static int ipg_config_autoneg(struct net_device *dev) u32 mac_ctrl_val; u32 asicctrl; u8 phyctrl; + const char *speed; + const char *duplex; + const char *tx_desc; + const char *rx_desc; IPG_DEBUG_MSG("_config_autoneg\n"); @@ -499,27 +506,27 @@ static int ipg_config_autoneg(struct net_device *dev) */ sp->tenmbpsmode = 0; - printk(KERN_INFO "%s: Link speed = ", dev->name); - /* Determine actual speed of operation. */ switch (phyctrl & IPG_PC_LINK_SPEED) { case IPG_PC_LINK_SPEED_10MBPS: - printk("10Mbps.\n"); - printk(KERN_INFO "%s: 10Mbps operational mode enabled.\n", - dev->name); + speed = "10Mbps"; sp->tenmbpsmode = 1; break; case IPG_PC_LINK_SPEED_100MBPS: - printk("100Mbps.\n"); + speed = "100Mbps"; break; case IPG_PC_LINK_SPEED_1000MBPS: - printk("1000Mbps.\n"); + speed = "1000Mbps"; break; default: - printk("undefined!\n"); + speed = "undefined!"; return 0; } + netdev_info(dev, "Link speed = %s\n", speed); + if (sp->tenmbpsmode == 1) + netdev_info(dev, "10Mbps operational mode enabled\n"); + if (phyctrl & IPG_PC_DUPLEX_STATUS) { fullduplex = 1; txflowcontrol = 1; @@ -528,38 +535,41 @@ static int ipg_config_autoneg(struct net_device *dev) /* Configure full duplex, and flow control. */ if (fullduplex == 1) { + /* Configure IPG for full duplex operation. */ - printk(KERN_INFO "%s: setting full duplex, ", dev->name); + + duplex = "full"; mac_ctrl_val |= IPG_MC_DUPLEX_SELECT_FD; if (txflowcontrol == 1) { - printk("TX flow control"); + tx_desc = ""; mac_ctrl_val |= IPG_MC_TX_FLOW_CONTROL_ENABLE; } else { - printk("no TX flow control"); + tx_desc = "no "; mac_ctrl_val &= ~IPG_MC_TX_FLOW_CONTROL_ENABLE; } if (rxflowcontrol == 1) { - printk(", RX flow control."); + rx_desc = ""; mac_ctrl_val |= IPG_MC_RX_FLOW_CONTROL_ENABLE; } else { - printk(", no RX flow control."); + rx_desc = "no "; mac_ctrl_val &= ~IPG_MC_RX_FLOW_CONTROL_ENABLE; } - - printk("\n"); } else { - /* Configure IPG for half duplex operation. */ - printk(KERN_INFO "%s: setting half duplex, " - "no TX flow control, no RX flow control.\n", dev->name); - - mac_ctrl_val &= ~IPG_MC_DUPLEX_SELECT_FD & - ~IPG_MC_TX_FLOW_CONTROL_ENABLE & - ~IPG_MC_RX_FLOW_CONTROL_ENABLE; + duplex = "half"; + tx_desc = "no "; + rx_desc = "no "; + mac_ctrl_val &= (~IPG_MC_DUPLEX_SELECT_FD & + ~IPG_MC_TX_FLOW_CONTROL_ENABLE & + ~IPG_MC_RX_FLOW_CONTROL_ENABLE); } + + netdev_info(dev, "setting %s duplex, %sTX, %sRX flow control\n", + duplex, tx_desc, rx_desc); ipg_w32(mac_ctrl_val, MAC_CTRL); + return 0; } @@ -784,14 +794,13 @@ static int init_rfdlist(struct net_device *dev) * A receive buffer was not ready, break the * RFD list here. */ - IPG_DEBUG_MSG("Cannot allocate Rx buffer.\n"); + IPG_DEBUG_MSG("Cannot allocate Rx buffer\n"); /* Just in case we cannot allocate a single RFD. * Should not occur. */ if (i == 0) { - printk(KERN_ERR "%s: No memory available" - " for RFD list.\n", dev->name); + netdev_err(dev, "No memory available for RFD list\n"); return -ENOMEM; } } @@ -838,7 +847,7 @@ static void init_tfdlist(struct net_device *dev) sp->tx_dirty = 0; /* Write the location of the TFDList to the IPG. */ - IPG_DDEBUG_MSG("Starting TFDListPtr = %8.8x\n", + IPG_DDEBUG_MSG("Starting TFDListPtr = %08x\n", (u32) sp->txd_map); ipg_w32((u32) sp->txd_map, TFD_LIST_PTR_0); ipg_w32(0x00000000, TFD_LIST_PTR_1); @@ -864,7 +873,7 @@ static void ipg_nic_txfree(struct net_device *dev) struct sk_buff *skb = sp->tx_buff[dirty]; struct ipg_tx *txfd = sp->txd + dirty; - IPG_DEBUG_MSG("TFC = %16.16lx\n", (unsigned long) txfd->tfc); + IPG_DEBUG_MSG("TFC = %016lx\n", (unsigned long) txfd->tfc); /* Look at each TFD's TFC field beginning * at the last freed TFD up to the current TFD. @@ -906,10 +915,8 @@ static void ipg_tx_timeout(struct net_device *dev) spin_lock_irq(&sp->lock); /* Re-configure after DMA reset. */ - if (ipg_io_config(dev) < 0) { - printk(KERN_INFO "%s: Error during re-configuration.\n", - dev->name); - } + if (ipg_io_config(dev) < 0) + netdev_info(dev, "Error during re-configuration\n"); init_tfdlist(dev); @@ -938,7 +945,7 @@ static void ipg_nic_txcleanup(struct net_device *dev) */ u32 txstatusdword = ipg_r32(TX_STATUS); - IPG_DEBUG_MSG("TxStatus = %8.8x\n", txstatusdword); + IPG_DEBUG_MSG("TxStatus = %08x\n", txstatusdword); /* Check for Transmit errors. Error bits only valid if * TX_COMPLETE bit in the TXSTATUS register is a 1. @@ -953,20 +960,20 @@ static void ipg_nic_txcleanup(struct net_device *dev) /* Transmit error, increment stat counters. */ if (txstatusdword & IPG_TS_TX_ERROR) { - IPG_DEBUG_MSG("Transmit error.\n"); + IPG_DEBUG_MSG("Transmit error\n"); sp->stats.tx_errors++; } /* Late collision, re-enable transmitter. */ if (txstatusdword & IPG_TS_LATE_COLLISION) { - IPG_DEBUG_MSG("Late collision on transmit.\n"); + IPG_DEBUG_MSG("Late collision on transmit\n"); ipg_w32((ipg_r32(MAC_CTRL) | IPG_MC_TX_ENABLE) & IPG_MC_RSVD_MASK, MAC_CTRL); } /* Maximum collisions, re-enable transmitter. */ if (txstatusdword & IPG_TS_TX_MAX_COLL) { - IPG_DEBUG_MSG("Maximum collisions on transmit.\n"); + IPG_DEBUG_MSG("Maximum collisions on transmit\n"); ipg_w32((ipg_r32(MAC_CTRL) | IPG_MC_TX_ENABLE) & IPG_MC_RSVD_MASK, MAC_CTRL); } @@ -975,16 +982,14 @@ static void ipg_nic_txcleanup(struct net_device *dev) * transmitter. */ if (txstatusdword & IPG_TS_TX_UNDERRUN) { - IPG_DEBUG_MSG("Transmitter underrun.\n"); + IPG_DEBUG_MSG("Transmitter underrun\n"); sp->stats.tx_fifo_errors++; ipg_reset(dev, IPG_AC_TX_RESET | IPG_AC_DMA | IPG_AC_NETWORK | IPG_AC_FIFO); /* Re-configure after DMA reset. */ if (ipg_io_config(dev) < 0) { - printk(KERN_INFO - "%s: Error during re-configuration.\n", - dev->name); + netdev_info(dev, "Error during re-configuration\n"); } init_tfdlist(dev); @@ -1063,7 +1068,7 @@ static int ipg_nic_rxrestore(struct net_device *dev) * Linux system). */ if (ipg_get_rxbuff(dev, entry) < 0) { - IPG_DEBUG_MSG("Cannot allocate new Rx buffer.\n"); + IPG_DEBUG_MSG("Cannot allocate new Rx buffer\n"); break; } @@ -1134,7 +1139,7 @@ static int ipg_nic_rx_check_error(struct net_device *dev) (IPG_RFS_RXFIFOOVERRUN | IPG_RFS_RXRUNTFRAME | IPG_RFS_RXALIGNMENTERROR | IPG_RFS_RXFCSERROR | IPG_RFS_RXOVERSIZEDFRAME | IPG_RFS_RXLENGTHERROR))) { - IPG_DEBUG_MSG("Rx error, RFS = %16.16lx\n", + IPG_DEBUG_MSG("Rx error, RFS = %016lx\n", (unsigned long) rxfd->rfs); /* Increment general receive error statistic. */ @@ -1142,13 +1147,13 @@ static int ipg_nic_rx_check_error(struct net_device *dev) /* Increment detailed receive error statistics. */ if (le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFIFOOVERRUN) { - IPG_DEBUG_MSG("RX FIFO overrun occurred.\n"); + IPG_DEBUG_MSG("RX FIFO overrun occurred\n"); sp->stats.rx_fifo_errors++; } if (le64_to_cpu(rxfd->rfs) & IPG_RFS_RXRUNTFRAME) { - IPG_DEBUG_MSG("RX runt occurred.\n"); + IPG_DEBUG_MSG("RX runt occurred\n"); sp->stats.rx_length_errors++; } @@ -1157,7 +1162,7 @@ static int ipg_nic_rx_check_error(struct net_device *dev) */ if (le64_to_cpu(rxfd->rfs) & IPG_RFS_RXALIGNMENTERROR) { - IPG_DEBUG_MSG("RX alignment error occurred.\n"); + IPG_DEBUG_MSG("RX alignment error occurred\n"); sp->stats.rx_frame_errors++; } @@ -1404,7 +1409,7 @@ static int ipg_nic_rx(struct net_device *dev) */ if (framelen > sp->rxfrag_size) { IPG_DEBUG_MSG - ("RFS FrameLen > allocated fragment size.\n"); + ("RFS FrameLen > allocated fragment size\n"); framelen = sp->rxfrag_size; } @@ -1414,7 +1419,7 @@ static int ipg_nic_rx(struct net_device *dev) IPG_RFS_RXALIGNMENTERROR | IPG_RFS_RXFCSERROR | IPG_RFS_RXOVERSIZEDFRAME | IPG_RFS_RXLENGTHERROR)))) { - IPG_DEBUG_MSG("Rx error, RFS = %16.16lx\n", + IPG_DEBUG_MSG("Rx error, RFS = %016lx\n", (unsigned long int) rxfd->rfs); /* Increment general receive error statistic. */ @@ -1422,12 +1427,12 @@ static int ipg_nic_rx(struct net_device *dev) /* Increment detailed receive error statistics. */ if (le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFIFOOVERRUN) { - IPG_DEBUG_MSG("RX FIFO overrun occurred.\n"); + IPG_DEBUG_MSG("RX FIFO overrun occurred\n"); sp->stats.rx_fifo_errors++; } if (le64_to_cpu(rxfd->rfs) & IPG_RFS_RXRUNTFRAME) { - IPG_DEBUG_MSG("RX runt occurred.\n"); + IPG_DEBUG_MSG("RX runt occurred\n"); sp->stats.rx_length_errors++; } @@ -1437,7 +1442,7 @@ static int ipg_nic_rx(struct net_device *dev) */ if (le64_to_cpu(rxfd->rfs) & IPG_RFS_RXALIGNMENTERROR) { - IPG_DEBUG_MSG("RX alignment error occurred.\n"); + IPG_DEBUG_MSG("RX alignment error occurred\n"); sp->stats.rx_frame_errors++; } @@ -1508,7 +1513,7 @@ static int ipg_nic_rx(struct net_device *dev) rxfd = sp->rxd + entry; - IPG_DEBUG_MSG("Frame requires multiple RFDs.\n"); + IPG_DEBUG_MSG("Frame requires multiple RFDs\n"); /* An unexpected event, additional code needed to handle * properly. So for the time being, just disregard the @@ -1557,8 +1562,7 @@ static void ipg_reset_after_host_error(struct work_struct *work) init_tfdlist(dev); if (ipg_io_config(dev) < 0) { - printk(KERN_INFO "%s: Cannot recover from PCI error.\n", - dev->name); + netdev_info(dev, "Cannot recover from PCI error\n"); schedule_delayed_work(&sp->task, HZ); } } @@ -1586,7 +1590,7 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst) */ status = ipg_r16(INT_STATUS_ACK); - IPG_DEBUG_MSG("IntStatusAck = %4.4x\n", status); + IPG_DEBUG_MSG("IntStatusAck = %04x\n", status); /* Shared IRQ of remove event. */ if (!(status & IPG_IS_RSVD_MASK)) @@ -1599,7 +1603,7 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst) /* If RFDListEnd interrupt, restore all used RFDs. */ if (status & IPG_IS_RFD_LIST_END) { - IPG_DEBUG_MSG("RFDListEnd Interrupt.\n"); + IPG_DEBUG_MSG("RFDListEnd Interrupt\n"); /* The RFD list end indicates an RFD was encountered * with a 0 NextPtr, or with an RFDDone bit set to 1 @@ -1661,21 +1665,20 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst) /* If LinkEvent interrupt, resolve autonegotiation. */ if (status & IPG_IS_LINK_EVENT) { if (ipg_config_autoneg(dev) < 0) - printk(KERN_INFO "%s: Auto-negotiation error.\n", - dev->name); + netdev_info(dev, "Auto-negotiation error\n"); } /* If MACCtrlFrame interrupt, do nothing. */ if (status & IPG_IS_MAC_CTRL_FRAME) - IPG_DEBUG_MSG("MACCtrlFrame interrupt.\n"); + IPG_DEBUG_MSG("MACCtrlFrame interrupt\n"); /* If RxComplete interrupt, do nothing. */ if (status & IPG_IS_RX_COMPLETE) - IPG_DEBUG_MSG("RxComplete interrupt.\n"); + IPG_DEBUG_MSG("RxComplete interrupt\n"); /* If RxEarly interrupt, do nothing. */ if (status & IPG_IS_RX_EARLY) - IPG_DEBUG_MSG("RxEarly interrupt.\n"); + IPG_DEBUG_MSG("RxEarly interrupt\n"); out_enable: /* Re-enable IPG interrupts. */ @@ -1749,8 +1752,7 @@ static int ipg_nic_open(struct net_device *dev) rc = request_irq(pdev->irq, ipg_interrupt_handler, IRQF_SHARED, dev->name, dev); if (rc < 0) { - printk(KERN_INFO "%s: Error when requesting interrupt.\n", - dev->name); + netdev_info(dev, "Error when requesting interrupt\n"); goto out; } @@ -1770,8 +1772,7 @@ static int ipg_nic_open(struct net_device *dev) rc = init_rfdlist(dev); if (rc < 0) { - printk(KERN_INFO "%s: Error during configuration.\n", - dev->name); + netdev_info(dev, "Error during configuration\n"); goto err_free_tx_2; } @@ -1779,14 +1780,13 @@ static int ipg_nic_open(struct net_device *dev) rc = ipg_io_config(dev); if (rc < 0) { - printk(KERN_INFO "%s: Error during configuration.\n", - dev->name); + netdev_info(dev, "Error during configuration\n"); goto err_release_tfdlist_3; } /* Resolve autonegotiation. */ if (ipg_config_autoneg(dev) < 0) - printk(KERN_INFO "%s: Auto-negotiation error.\n", dev->name); + netdev_info(dev, "Auto-negotiation error\n"); /* initialize JUMBO Frame control variable */ sp->jumbo.found_start = 0; @@ -1961,7 +1961,7 @@ static void ipg_set_phy_default_param(unsigned char rev, { unsigned short length; unsigned char revision; - unsigned short *phy_param; + const unsigned short *phy_param; unsigned short address, value; phy_param = &DefaultPhyParam[0]; @@ -2222,7 +2222,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev, if (rc < 0) goto out; - printk(KERN_INFO "%s: %s\n", pci_name(pdev), ipg_brand_name[i]); + pr_info("%s: %s\n", pci_name(pdev), ipg_brand_name[i]); pci_set_master(pdev); @@ -2230,8 +2230,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev, if (rc < 0) { rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (rc < 0) { - printk(KERN_ERR "%s: DMA config failed.\n", - pci_name(pdev)); + pr_err("%s: DMA config failed\n", pci_name(pdev)); goto err_disable_0; } } @@ -2241,7 +2240,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev, */ dev = alloc_etherdev(sizeof(struct ipg_nic_private)); if (!dev) { - printk(KERN_ERR "%s: alloc_etherdev failed\n", pci_name(pdev)); + pr_err("%s: alloc_etherdev failed\n", pci_name(pdev)); rc = -ENOMEM; goto err_disable_0; } @@ -2267,7 +2266,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev, ioaddr = pci_iomap(pdev, 1, pci_resource_len(pdev, 1)); if (!ioaddr) { - printk(KERN_ERR "%s cannot map MMIO\n", pci_name(pdev)); + pr_err("%s: cannot map MMIO\n", pci_name(pdev)); rc = -EIO; goto err_release_regions_2; } @@ -2289,7 +2288,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev, if (rc < 0) goto err_unmap_3; - printk(KERN_INFO "Ethernet device registered as: %s\n", dev->name); + netdev_info(dev, "Ethernet device registered\n"); out: return rc; diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index f744d291218a..196b660e1d91 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h @@ -940,6 +940,11 @@ typedef struct nx_mac_list_s { uint8_t mac_addr[ETH_ALEN+2]; } nx_mac_list_t; +struct nx_vlan_ip_list { + struct list_head list; + u32 ip_addr; +}; + /* * Interrupt coalescing defaults. The defaults are for 1500 MTU. It is * adjusted based on configured MTU. @@ -1165,6 +1170,7 @@ struct netxen_adapter { struct net_device *netdev; struct pci_dev *pdev; struct list_head mac_list; + struct list_head vlan_ip_list; spinlock_t tx_clean_lock; diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index e8993a76a080..d6c6357de6aa 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c @@ -26,6 +26,7 @@ #include <linux/netdevice.h> #include <linux/delay.h> #include <linux/slab.h> +#include <linux/if_vlan.h> #include "netxen_nic.h" #include "netxen_nic_hw.h" @@ -1619,6 +1620,7 @@ netxen_process_lro(struct netxen_adapter *adapter, int index; u16 lro_length, length, data_offset; u32 seq_number; + u8 vhdr_len; if (unlikely(ring > adapter->max_rds_rings)) return NULL; @@ -1652,8 +1654,10 @@ netxen_process_lro(struct netxen_adapter *adapter, skb_pull(skb, l2_hdr_offset); skb->protocol = eth_type_trans(skb, netdev); - iph = (struct iphdr *)skb->data; - th = (struct tcphdr *)(skb->data + (iph->ihl << 2)); + if (skb->protocol == htons(ETH_P_8021Q)) + vhdr_len = VLAN_HLEN; + iph = (struct iphdr *)(skb->data + vhdr_len); + th = (struct tcphdr *)((skb->data + vhdr_len) + (iph->ihl << 2)); length = (iph->ihl << 2) + (th->doff << 2) + lro_length; iph->tot_len = htons(length); diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index f574edff7fcb..8c7fc32d781f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c @@ -91,7 +91,8 @@ static irqreturn_t netxen_intr(int irq, void *data); static irqreturn_t netxen_msi_intr(int irq, void *data); static irqreturn_t netxen_msix_intr(int irq, void *data); -static void netxen_config_indev_addr(struct net_device *dev, unsigned long); +static void netxen_free_vlan_ip_list(struct netxen_adapter *); +static void netxen_restore_indev_addr(struct net_device *dev, unsigned long); static struct rtnl_link_stats64 *netxen_nic_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats); static int netxen_nic_set_mac(struct net_device *netdev, void *p); @@ -1359,6 +1360,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) spin_lock_init(&adapter->tx_clean_lock); INIT_LIST_HEAD(&adapter->mac_list); + INIT_LIST_HEAD(&adapter->vlan_ip_list); err = netxen_setup_pci_map(adapter); if (err) @@ -1481,6 +1483,7 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) cancel_work_sync(&adapter->tx_timeout_task); + netxen_free_vlan_ip_list(adapter); netxen_nic_detach(adapter); nx_decr_dev_ref_cnt(adapter); @@ -1563,7 +1566,7 @@ static int netxen_nic_attach_func(struct pci_dev *pdev) if (err) goto err_out_detach; - netxen_config_indev_addr(netdev, NETDEV_UP); + netxen_restore_indev_addr(netdev, NETDEV_UP); } netif_device_attach(netdev); @@ -2374,7 +2377,7 @@ netxen_attach_work(struct work_struct *work) goto done; } - netxen_config_indev_addr(netdev, NETDEV_UP); + netxen_restore_indev_addr(netdev, NETDEV_UP); } netif_device_attach(netdev); @@ -2848,10 +2851,70 @@ netxen_destip_supported(struct netxen_adapter *adapter) } static void -netxen_config_indev_addr(struct net_device *dev, unsigned long event) +netxen_free_vlan_ip_list(struct netxen_adapter *adapter) +{ + struct nx_vlan_ip_list *cur; + struct list_head *head = &adapter->vlan_ip_list; + + while (!list_empty(head)) { + cur = list_entry(head->next, struct nx_vlan_ip_list, list); + netxen_config_ipaddr(adapter, cur->ip_addr, NX_IP_DOWN); + list_del(&cur->list); + kfree(cur); + } + +} +static void +netxen_list_config_vlan_ip(struct netxen_adapter *adapter, + struct in_ifaddr *ifa, unsigned long event) +{ + struct net_device *dev; + struct nx_vlan_ip_list *cur, *tmp_cur; + struct list_head *head; + + dev = ifa->ifa_dev ? ifa->ifa_dev->dev : NULL; + + if (dev == NULL) + return; + + if (!is_vlan_dev(dev)) + return; + + switch (event) { + case NX_IP_UP: + list_for_each(head, &adapter->vlan_ip_list) { + cur = list_entry(head, struct nx_vlan_ip_list, list); + + if (cur->ip_addr == ifa->ifa_address) + return; + } + + cur = kzalloc(sizeof(struct nx_vlan_ip_list), GFP_ATOMIC); + if (cur == NULL) { + printk(KERN_ERR "%s: failed to add vlan ip to list\n", + adapter->netdev->name); + return; + } + + cur->ip_addr = ifa->ifa_address; + list_add_tail(&cur->list, &adapter->vlan_ip_list); + break; + case NX_IP_DOWN: + list_for_each_entry_safe(cur, tmp_cur, + &adapter->vlan_ip_list, list) { + if (cur->ip_addr == ifa->ifa_address) { + list_del(&cur->list); + kfree(cur); + break; + } + } + } +} +static void +netxen_config_indev_addr(struct netxen_adapter *adapter, + struct net_device *dev, unsigned long event) { struct in_device *indev; - struct netxen_adapter *adapter = netdev_priv(dev); if (!netxen_destip_supported(adapter)) return; @@ -2865,10 +2928,12 @@ netxen_config_indev_addr(struct net_device *dev, unsigned long event) case NETDEV_UP: netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP); + netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP); break; case NETDEV_DOWN: netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN); + netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN); break; default: break; @@ -2878,11 +2943,28 @@ netxen_config_indev_addr(struct net_device *dev, unsigned long event) in_dev_put(indev); } +static void +netxen_restore_indev_addr(struct net_device *netdev, unsigned long event) + +{ + struct netxen_adapter *adapter = netdev_priv(netdev); + struct nx_vlan_ip_list *pos, *tmp_pos; + unsigned long ip_event; + + ip_event = (event == NETDEV_UP) ? NX_IP_UP : NX_IP_DOWN; + netxen_config_indev_addr(adapter, netdev, event); + + list_for_each_entry_safe(pos, tmp_pos, &adapter->vlan_ip_list, list) { + netxen_config_ipaddr(adapter, pos->ip_addr, ip_event); + } +} + static int netxen_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) { struct netxen_adapter *adapter; struct net_device *dev = (struct net_device *)ptr; + struct net_device *orig_dev = dev; recheck: if (dev == NULL) @@ -2904,7 +2986,7 @@ recheck: if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) goto done; - netxen_config_indev_addr(dev, event); + netxen_config_indev_addr(adapter, orig_dev, event); done: return NOTIFY_DONE; } @@ -2921,7 +3003,7 @@ netxen_inetaddr_event(struct notifier_block *this, dev = ifa->ifa_dev ? ifa->ifa_dev->dev : NULL; recheck: - if (dev == NULL || !netif_running(dev)) + if (dev == NULL) goto done; if (dev->priv_flags & IFF_802_1Q_VLAN) { @@ -2943,9 +3025,11 @@ recheck: switch (event) { case NETDEV_UP: netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP); + netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP); break; case NETDEV_DOWN: netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN); + netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN); break; default: break; @@ -2964,7 +3048,10 @@ static struct notifier_block netxen_inetaddr_cb = { }; #else static void -netxen_config_indev_addr(struct net_device *dev, unsigned long event) +netxen_restore_indev_addr(struct net_device *dev, unsigned long event) +{ } +static void +netxen_free_vlan_ip_list(struct netxen_adapter *adapter) { } #endif diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index 2f6914025efc..ccde8061afa8 100644 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c @@ -1650,7 +1650,7 @@ static int ql_mii_setup(struct ql3_adapter *qdev) SUPPORTED_1000baseT_Half | \ SUPPORTED_1000baseT_Full | \ SUPPORTED_Autoneg | \ - SUPPORTED_TP); \ + SUPPORTED_TP) \ static u32 ql_supported_modes(struct ql3_adapter *qdev) { diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index baf646d98fa0..53c6e5dcf26c 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h @@ -36,8 +36,8 @@ #define _QLCNIC_LINUX_MAJOR 5 #define _QLCNIC_LINUX_MINOR 0 -#define _QLCNIC_LINUX_SUBVERSION 21 -#define QLCNIC_LINUX_VERSIONID "5.0.21" +#define _QLCNIC_LINUX_SUBVERSION 22 +#define QLCNIC_LINUX_VERSIONID "5.0.22" #define QLCNIC_DRV_IDC_VER 0x01 #define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\ (_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION)) @@ -911,6 +911,7 @@ struct qlcnic_ipaddr { #define QLCNIC_PROMISC_DISABLED 0x800 #define QLCNIC_NEED_FLR 0x1000 #define QLCNIC_FW_RESET_OWNER 0x2000 +#define QLCNIC_FW_HANG 0x4000 #define QLCNIC_IS_MSI_FAMILY(adapter) \ ((adapter)->flags & (QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED)) @@ -1344,6 +1345,7 @@ enum op_codes { #define QLCNIC_FORCE_FW_DUMP_KEY 0xdeadfeed #define QLCNIC_ENABLE_FW_DUMP 0xaddfeed #define QLCNIC_DISABLE_FW_DUMP 0xbadfeed +#define QLCNIC_FORCE_FW_RESET 0xdeaddead struct qlcnic_dump_operations { enum op_codes opcode; diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c index 72a723d5c988..7c64f2ffc219 100644 --- a/drivers/net/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/qlcnic/qlcnic_ethtool.c @@ -1105,7 +1105,10 @@ qlcnic_get_dump_flag(struct net_device *netdev, struct ethtool_dump *dump) struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump; - dump->len = fw_dump->tmpl_hdr->size + fw_dump->size; + if (fw_dump->clr) + dump->len = fw_dump->tmpl_hdr->size + fw_dump->size; + else + dump->len = 0; dump->flag = fw_dump->tmpl_hdr->drv_cap_mask; dump->version = adapter->fw_version; return 0; @@ -1152,7 +1155,8 @@ qlcnic_set_dump(struct net_device *netdev, struct ethtool_dump *val) struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump; - if (val->flag == QLCNIC_FORCE_FW_DUMP_KEY) { + switch (val->flag) { + case QLCNIC_FORCE_FW_DUMP_KEY: if (!fw_dump->enable) { netdev_info(netdev, "FW dump not enabled\n"); return ret; @@ -1164,17 +1168,25 @@ qlcnic_set_dump(struct net_device *netdev, struct ethtool_dump *val) } netdev_info(netdev, "Forcing a FW dump\n"); qlcnic_dev_request_reset(adapter); - } else if (val->flag == QLCNIC_DISABLE_FW_DUMP) { + break; + case QLCNIC_DISABLE_FW_DUMP: if (fw_dump->enable) { netdev_info(netdev, "Disabling FW dump\n"); fw_dump->enable = 0; } - } else if (val->flag == QLCNIC_ENABLE_FW_DUMP) { + break; + case QLCNIC_ENABLE_FW_DUMP: if (!fw_dump->enable && fw_dump->tmpl_hdr) { netdev_info(netdev, "Enabling FW dump\n"); fw_dump->enable = 1; } - } else { + break; + case QLCNIC_FORCE_FW_RESET: + netdev_info(netdev, "Forcing a FW reset\n"); + qlcnic_dev_request_reset(adapter); + adapter->flags &= ~QLCNIC_FW_RESET_OWNER; + break; + default: if (val->flag > QLCNIC_DUMP_MASK_MAX || val->flag < QLCNIC_DUMP_MASK_MIN) { netdev_info(netdev, diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c index 4055c218ef2a..74e9d7b94965 100644 --- a/drivers/net/qlcnic/qlcnic_hw.c +++ b/drivers/net/qlcnic/qlcnic_hw.c @@ -1773,8 +1773,8 @@ int qlcnic_dump_fw(struct qlcnic_adapter *adapter) goto error; } else { fw_dump->clr = 1; - snprintf(mesg, sizeof(mesg), "FW dump for device: %d\n", - adapter->pdev->devfn); + snprintf(mesg, sizeof(mesg), "FW_DUMP=%s", + adapter->netdev->name); dev_info(&adapter->pdev->dev, "Dump data, %d bytes captured\n", fw_dump->size); /* Send a udev event to notify availability of FW dump */ diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c index ee8a3982395e..3b6741e4754d 100644 --- a/drivers/net/qlcnic/qlcnic_init.c +++ b/drivers/net/qlcnic/qlcnic_init.c @@ -1056,7 +1056,8 @@ qlcnic_check_fw_hearbeat(struct qlcnic_adapter *adapter) int qlcnic_need_fw_reset(struct qlcnic_adapter *adapter) { - if (qlcnic_check_fw_hearbeat(adapter)) { + if ((adapter->flags & QLCNIC_FW_HANG) || + qlcnic_check_fw_hearbeat(adapter)) { qlcnic_rom_lock_recovery(adapter); return 1; } diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 5ca1b562443c..ec8ef72d38d3 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c @@ -643,8 +643,11 @@ static void get_brd_name(struct qlcnic_adapter *adapter, char *name) static void qlcnic_check_options(struct qlcnic_adapter *adapter) { - u32 fw_major, fw_minor, fw_build; + u32 fw_major, fw_minor, fw_build, prev_fw_version; struct pci_dev *pdev = adapter->pdev; + struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump; + + prev_fw_version = adapter->fw_version; fw_major = QLCRD32(adapter, QLCNIC_FW_VERSION_MAJOR); fw_minor = QLCRD32(adapter, QLCNIC_FW_VERSION_MINOR); @@ -652,6 +655,17 @@ qlcnic_check_options(struct qlcnic_adapter *adapter) adapter->fw_version = QLCNIC_VERSION_CODE(fw_major, fw_minor, fw_build); + if (adapter->op_mode != QLCNIC_NON_PRIV_FUNC) { + if (fw_dump->tmpl_hdr == NULL || + adapter->fw_version > prev_fw_version) { + if (fw_dump->tmpl_hdr) + vfree(fw_dump->tmpl_hdr); + if (!qlcnic_fw_cmd_get_minidump_temp(adapter)) + dev_info(&pdev->dev, + "Supports FW dump capability\n"); + } + } + dev_info(&pdev->dev, "firmware v%d.%d.%d\n", fw_major, fw_minor, fw_build); if (adapter->ahw->port_type == QLCNIC_XGBE) { @@ -1610,12 +1624,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_decr_ref; } - /* Get FW dump template and store it */ - if (adapter->op_mode != QLCNIC_NON_PRIV_FUNC) - if (!qlcnic_fw_cmd_get_minidump_temp(adapter)) - dev_info(&pdev->dev, - "Supports FW dump capability\n"); - if (qlcnic_read_mac_addr(adapter)) dev_warn(&pdev->dev, "failed to read mac addr\n"); @@ -2682,6 +2690,7 @@ qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter, u8 failed) qlcnic_api_unlock(adapter); err: adapter->fw_fail_cnt = 0; + adapter->flags &= ~QLCNIC_FW_HANG; clear_bit(__QLCNIC_START_FW, &adapter->state); clear_bit(__QLCNIC_RESETTING, &adapter->state); } @@ -2859,6 +2868,7 @@ skip_ack_check: (adapter->flags & QLCNIC_FW_RESET_OWNER)) { QLCDB(adapter, DRV, "Take FW dump\n"); qlcnic_dump_fw(adapter); + adapter->flags |= QLCNIC_FW_HANG; } rtnl_unlock(); @@ -3046,6 +3056,7 @@ attach: done: netif_device_attach(netdev); adapter->fw_fail_cnt = 0; + adapter->flags &= ~QLCNIC_FW_HANG; clear_bit(__QLCNIC_RESETTING, &adapter->state); if (!qlcnic_clr_drv_state(adapter)) @@ -3090,13 +3101,26 @@ qlcnic_check_health(struct qlcnic_adapter *adapter) if (++adapter->fw_fail_cnt < FW_FAIL_THRESH) return 0; + adapter->flags |= QLCNIC_FW_HANG; + qlcnic_dev_request_reset(adapter); if (auto_fw_reset) clear_bit(__QLCNIC_FW_ATTACHED, &adapter->state); dev_info(&netdev->dev, "firmware hang detected\n"); - + dev_info(&adapter->pdev->dev, "Dumping hw/fw registers\n" + "PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,\n" + "PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,\n" + "PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n" + "PEG_NET_4_PC: 0x%x\n", + QLCRD32(adapter, QLCNIC_PEG_HALT_STATUS1), + QLCRD32(adapter, QLCNIC_PEG_HALT_STATUS2), + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_0 + 0x3c), + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_1 + 0x3c), + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_2 + 0x3c), + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_3 + 0x3c), + QLCRD32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c)); detach: adapter->dev_state = (state == QLCNIC_DEV_NEED_QUISCENT) ? state : QLCNIC_DEV_NEED_RESET; diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 4c617534f937..ba08341fb92c 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -562,34 +562,33 @@ static struct rtnl_link_stats64 * sl_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) { struct net_device_stats *devstats = &dev->stats; - unsigned long c_rx_dropped = 0; #ifdef SL_INCLUDE_CSLIP - unsigned long c_rx_fifo_errors = 0; - unsigned long c_tx_fifo_errors = 0; - unsigned long c_collisions = 0; struct slip *sl = netdev_priv(dev); struct slcompress *comp = sl->slcomp; - - if (comp) { - c_rx_fifo_errors = comp->sls_i_compressed; - c_rx_dropped = comp->sls_i_tossed; - c_tx_fifo_errors = comp->sls_o_compressed; - c_collisions = comp->sls_o_misses; - } - stats->rx_fifo_errors = sl->rx_compressed + c_rx_fifo_errors; - stats->tx_fifo_errors = sl->tx_compressed + c_tx_fifo_errors; - stats->collisions = sl->tx_misses + c_collisions; #endif stats->rx_packets = devstats->rx_packets; stats->tx_packets = devstats->tx_packets; stats->rx_bytes = devstats->rx_bytes; stats->tx_bytes = devstats->tx_bytes; - stats->rx_dropped = devstats->rx_dropped + c_rx_dropped; + stats->rx_dropped = devstats->rx_dropped; stats->tx_dropped = devstats->tx_dropped; stats->tx_errors = devstats->tx_errors; stats->rx_errors = devstats->rx_errors; stats->rx_over_errors = devstats->rx_over_errors; +#ifdef SL_INCLUDE_CSLIP + if (comp) { + /* Generic compressed statistics */ + stats->rx_compressed = comp->sls_i_compressed; + stats->tx_compressed = comp->sls_o_compressed; + + /* Are we really still needs this? */ + stats->rx_fifo_errors += comp->sls_i_compressed; + stats->rx_dropped += comp->sls_i_tossed; + stats->tx_fifo_errors += comp->sls_o_compressed; + stats->collisions += comp->sls_o_misses; + } +#endif return stats; } diff --git a/drivers/net/slip.h b/drivers/net/slip.h index aa0764ce2342..67673cf1266b 100644 --- a/drivers/net/slip.h +++ b/drivers/net/slip.h @@ -65,15 +65,6 @@ struct slip { unsigned char *xbuff; /* transmitter buffer */ unsigned char *xhead; /* pointer to next byte to XMIT */ int xleft; /* bytes left in XMIT queue */ - - /* SLIP interface statistics. */ -#ifdef SL_INCLUDE_CSLIP - unsigned long tx_compressed; - unsigned long rx_compressed; - unsigned long tx_misses; -#endif - /* Detailed SLIP statistics. */ - int mtu; /* Our mtu (to spot changes!) */ int buffsize; /* Max buffers sizes */ diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index b9016a30cdc5..75c08a55582c 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c @@ -53,6 +53,10 @@ #include <linux/phy.h> #include <linux/smsc911x.h> #include <linux/device.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/of_gpio.h> +#include <linux/of_net.h> #include "smsc911x.h" #define SMSC_CHIPNAME "smsc911x" @@ -2095,8 +2099,58 @@ static const struct smsc911x_ops shifted_smsc911x_ops = { .tx_writefifo = smsc911x_tx_writefifo_shift, }; +#ifdef CONFIG_OF +static int __devinit smsc911x_probe_config_dt( + struct smsc911x_platform_config *config, + struct device_node *np) +{ + const char *mac; + u32 width = 0; + + if (!np) + return -ENODEV; + + config->phy_interface = of_get_phy_mode(np); + + mac = of_get_mac_address(np); + if (mac) + memcpy(config->mac, mac, ETH_ALEN); + + of_property_read_u32(np, "reg-shift", &config->shift); + + of_property_read_u32(np, "reg-io-width", &width); + if (width == 4) + config->flags |= SMSC911X_USE_32BIT; + + if (of_get_property(np, "smsc,irq-active-high", NULL)) + config->irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH; + + if (of_get_property(np, "smsc,irq-push-pull", NULL)) + config->irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL; + + if (of_get_property(np, "smsc,force-internal-phy", NULL)) + config->flags |= SMSC911X_FORCE_INTERNAL_PHY; + + if (of_get_property(np, "smsc,force-external-phy", NULL)) + config->flags |= SMSC911X_FORCE_EXTERNAL_PHY; + + if (of_get_property(np, "smsc,save-mac-address", NULL)) + config->flags |= SMSC911X_SAVE_MAC_ADDRESS; + + return 0; +} +#else +static inline int smsc911x_probe_config_dt( + struct smsc911x_platform_config *config, + struct device_node *np) +{ + return -ENODEV; +} +#endif /* CONFIG_OF */ + static int __devinit smsc911x_drv_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; struct net_device *dev; struct smsc911x_data *pdata; struct smsc911x_platform_config *config = pdev->dev.platform_data; @@ -2107,13 +2161,6 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) pr_info("Driver version %s\n", SMSC_DRV_VERSION); - /* platform data specifies irq & dynamic bus configuration */ - if (!pdev->dev.platform_data) { - pr_warn("platform_data not provided\n"); - retval = -ENODEV; - goto out_0; - } - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smsc911x-memory"); if (!res) @@ -2152,9 +2199,6 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; pdata->ioaddr = ioremap_nocache(res->start, res_size); - /* copy config parameters across to pdata */ - memcpy(&pdata->config, config, sizeof(pdata->config)); - pdata->dev = dev; pdata->msg_enable = ((1 << debug) - 1); @@ -2164,10 +2208,22 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) goto out_free_netdev_2; } + retval = smsc911x_probe_config_dt(&pdata->config, np); + if (retval && config) { + /* copy config parameters across to pdata */ + memcpy(&pdata->config, config, sizeof(pdata->config)); + retval = 0; + } + + if (retval) { + SMSC_WARN(pdata, probe, "Error smsc911x config not found"); + goto out_unmap_io_3; + } + /* assume standard, non-shifted, access to HW registers */ pdata->ops = &standard_smsc911x_ops; /* apply the right access if shifting is needed */ - if (config->shift) + if (pdata->config.shift) pdata->ops = &shifted_smsc911x_ops; retval = smsc911x_init(dev); @@ -2314,6 +2370,12 @@ static const struct dev_pm_ops smsc911x_pm_ops = { #define SMSC911X_PM_OPS NULL #endif +static const struct of_device_id smsc911x_dt_ids[] = { + { .compatible = "smsc,lan9115", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, smsc911x_dt_ids); + static struct platform_driver smsc911x_driver = { .probe = smsc911x_drv_probe, .remove = __devexit_p(smsc911x_drv_remove), @@ -2321,6 +2383,7 @@ static struct platform_driver smsc911x_driver = { .name = SMSC_CHIPNAME, .owner = THIS_MODULE, .pm = SMSC911X_PM_OPS, + .of_match_table = smsc911x_dt_ids, }, }; diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index d3465ab50e56..42f8e31b0bbb 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -1761,10 +1761,12 @@ static int init_phy(struct net_device *dev) if (priv->phy_interface == PHY_INTERFACE_MODE_SGMII) uec_configure_serdes(dev); - phydev->supported &= (ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full); + phydev->supported &= (SUPPORTED_MII | + SUPPORTED_Autoneg | + ADVERTISED_10baseT_Half | + ADVERTISED_10baseT_Full | + ADVERTISED_100baseT_Half | + ADVERTISED_100baseT_Full); if (priv->max_speed == SPEED_1000) phydev->supported |= ADVERTISED_1000baseT_Full; diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c index 1d83ccfd7277..1e7221951056 100644 --- a/drivers/net/usb/lg-vl600.c +++ b/drivers/net/usb/lg-vl600.c @@ -89,6 +89,8 @@ static int vl600_bind(struct usbnet *dev, struct usb_interface *intf) * addresses have no meaning, the destination and the source of every * packet depend only on whether it is on the IN or OUT endpoint. */ dev->net->flags |= IFF_NOARP; + /* IPv6 NDP relies on multicast. Enable it by default. */ + dev->net->flags |= IFF_MULTICAST; return ret; } @@ -200,6 +202,14 @@ static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb) } else { memset(ethhdr->h_source, 0, ETH_ALEN); memcpy(ethhdr->h_dest, dev->net->dev_addr, ETH_ALEN); + + /* Inbound IPv6 packets have an IPv4 ethertype (0x800) + * for some reason. Peek at the L3 header to check + * for IPv6 packets, and set the ethertype to IPv6 + * (0x86dd) so Linux can understand it. + */ + if ((buf->data[sizeof(*ethhdr)] & 0xf0) == 0x60) + ethhdr->h_proto = __constant_htons(ETH_P_IPV6); } if (count) { @@ -297,6 +307,15 @@ encapsulate: if (skb->len < full_len) /* Pad */ skb_put(skb, full_len - skb->len); + /* The VL600 wants IPv6 packets to have an IPv4 ethertype + * Check if this is an IPv6 packet, and set the ethertype + * to 0x800 + */ + if ((skb->data[sizeof(struct vl600_pkt_hdr *) + 0x22] & 0xf0) == 0x60) { + skb->data[sizeof(struct vl600_pkt_hdr *) + 0x20] = 0x08; + skb->data[sizeof(struct vl600_pkt_hdr *) + 0x21] = 0; + } + return skb; } diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index deb1eca13c9f..490ec5b2775a 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c @@ -42,7 +42,6 @@ * */ - #include <linux/module.h> #include <linux/types.h> #include <linux/bitops.h> @@ -112,7 +111,6 @@ static void mac_get_cam_mask(struct mac_regs __iomem *regs, u8 *mask) BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, ®s->CAMCR); } - /** * mac_set_cam_mask - Set a CAM mask * @regs: register block for this velocity @@ -700,7 +698,6 @@ static int velocity_mii_read(struct mac_regs __iomem *regs, u8 index, u16 *data) return 0; } - /** * mii_check_media_mode - check media state * @regs: velocity registers @@ -866,8 +863,6 @@ static u32 check_connection_type(struct mac_regs __iomem *regs) return status; } - - /** * velocity_set_media_mode - set media mode * @mii_status: old MII link state @@ -1262,6 +1257,7 @@ static void setup_queue_timers(struct velocity_info *vptr) writeb(rxqueue_timer, &vptr->mac_regs->RQETMR); } } + /** * setup_adaptive_interrupts - Setup interrupt suppression * @@ -1601,8 +1597,6 @@ static void velocity_free_rd_ring(struct velocity_info *vptr) vptr->rx.info = NULL; } - - /** * velocity_init_rd_ring - set up receive ring * @vptr: velocity to configure @@ -1676,7 +1670,6 @@ static void velocity_free_dma_rings(struct velocity_info *vptr) pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma); } - static int velocity_init_rings(struct velocity_info *vptr, int mtu) { int ret; @@ -1739,7 +1732,6 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, tdinfo->skb = NULL; } - /* * FIXME: could we merge this with velocity_free_tx_buf ? */ @@ -1787,7 +1779,6 @@ static void velocity_free_td_ring(struct velocity_info *vptr) } } - static void velocity_free_rings(struct velocity_info *vptr) { velocity_free_td_ring(vptr); @@ -2025,7 +2016,6 @@ static inline void velocity_iph_realign(struct velocity_info *vptr, } } - /** * velocity_receive_frame - received packet processor * @vptr: velocity we are handling @@ -2092,11 +2082,11 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx) netif_rx(skb); stats->rx_bytes += pkt_len; + stats->rx_packets++; return 0; } - /** * velocity_rx_srv - service RX interrupt * @vptr: velocity @@ -2404,7 +2394,6 @@ static int velocity_mii_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd return 0; } - /** * velocity_ioctl - ioctl entry point * @dev: network device @@ -2619,14 +2608,13 @@ out: return NETDEV_TX_OK; } - static const struct net_device_ops velocity_netdev_ops = { .ndo_open = velocity_open, .ndo_stop = velocity_close, .ndo_start_xmit = velocity_xmit, .ndo_get_stats = velocity_get_stats, .ndo_validate_addr = eth_validate_addr, - .ndo_set_mac_address = eth_mac_addr, + .ndo_set_mac_address = eth_mac_addr, .ndo_set_multicast_list = velocity_set_multi, .ndo_change_mtu = velocity_change_mtu, .ndo_do_ioctl = velocity_ioctl, @@ -2717,7 +2705,6 @@ static u32 velocity_get_link(struct net_device *dev) return BYTE_REG_BITS_IS_ON(PHYSR0_LINKGD, ®s->PHYSR0) ? 1 : 0; } - /** * velocity_found1 - set up discovered velocity card * @pdev: PCI device @@ -2864,7 +2851,6 @@ err_free_dev: goto out; } - #ifdef CONFIG_PM /** * wol_calc_crc - WOL CRC @@ -3035,7 +3021,7 @@ static int velocity_suspend(struct pci_dev *pdev, pm_message_t state) spin_lock_irqsave(&vptr->lock, flags); pci_save_state(pdev); -#ifdef ETHTOOL_GWOL + if (vptr->flags & VELOCITY_FLAGS_WOL_ENABLED) { velocity_get_ip(vptr); velocity_save_context(vptr, &vptr->context); @@ -3049,9 +3035,7 @@ static int velocity_suspend(struct pci_dev *pdev, pm_message_t state) pci_disable_device(pdev); pci_set_power_state(pdev, pci_choose_state(pdev, state)); } -#else - pci_set_power_state(pdev, pci_choose_state(pdev, state)); -#endif + spin_unlock_irqrestore(&vptr->lock, flags); return 0; } @@ -3132,13 +3116,13 @@ static int velocity_resume(struct pci_dev *pdev) * uses this to handle all our card discover and plugging */ static struct pci_driver velocity_driver = { - .name = VELOCITY_NAME, - .id_table = velocity_id_table, - .probe = velocity_found1, - .remove = __devexit_p(velocity_remove1), + .name = VELOCITY_NAME, + .id_table = velocity_id_table, + .probe = velocity_found1, + .remove = __devexit_p(velocity_remove1), #ifdef CONFIG_PM - .suspend = velocity_suspend, - .resume = velocity_resume, + .suspend = velocity_suspend, + .resume = velocity_resume, #endif }; @@ -3448,26 +3432,99 @@ static int velocity_set_coalesce(struct net_device *dev, return 0; } +static const char velocity_gstrings[][ETH_GSTRING_LEN] = { + "rx_all", + "rx_ok", + "tx_ok", + "rx_error", + "rx_runt_ok", + "rx_runt_err", + "rx_64", + "tx_64", + "rx_65_to_127", + "tx_65_to_127", + "rx_128_to_255", + "tx_128_to_255", + "rx_256_to_511", + "tx_256_to_511", + "rx_512_to_1023", + "tx_512_to_1023", + "rx_1024_to_1518", + "tx_1024_to_1518", + "tx_ether_collisions", + "rx_crc_errors", + "rx_jumbo", + "tx_jumbo", + "rx_mac_control_frames", + "tx_mac_control_frames", + "rx_frame_alignement_errors", + "rx_long_ok", + "rx_long_err", + "tx_sqe_errors", + "rx_no_buf", + "rx_symbol_errors", + "in_range_length_errors", + "late_collisions" +}; + +static void velocity_get_strings(struct net_device *dev, u32 sset, u8 *data) +{ + switch (sset) { + case ETH_SS_STATS: + memcpy(data, *velocity_gstrings, sizeof(velocity_gstrings)); + break; + } +} + +static int velocity_get_sset_count(struct net_device *dev, int sset) +{ + switch (sset) { + case ETH_SS_STATS: + return ARRAY_SIZE(velocity_gstrings); + default: + return -EOPNOTSUPP; + } +} + +static void velocity_get_ethtool_stats(struct net_device *dev, + struct ethtool_stats *stats, u64 *data) +{ + if (netif_running(dev)) { + struct velocity_info *vptr = netdev_priv(dev); + u32 *p = vptr->mib_counter; + int i; + + spin_lock_irq(&vptr->lock); + velocity_update_hw_mibs(vptr); + spin_unlock_irq(&vptr->lock); + + for (i = 0; i < ARRAY_SIZE(velocity_gstrings); i++) + *data++ = *p++; + } +} + static const struct ethtool_ops velocity_ethtool_ops = { - .get_settings = velocity_get_settings, - .set_settings = velocity_set_settings, - .get_drvinfo = velocity_get_drvinfo, - .get_wol = velocity_ethtool_get_wol, - .set_wol = velocity_ethtool_set_wol, - .get_msglevel = velocity_get_msglevel, - .set_msglevel = velocity_set_msglevel, - .get_link = velocity_get_link, - .get_coalesce = velocity_get_coalesce, - .set_coalesce = velocity_set_coalesce, - .begin = velocity_ethtool_up, - .complete = velocity_ethtool_down + .get_settings = velocity_get_settings, + .set_settings = velocity_set_settings, + .get_drvinfo = velocity_get_drvinfo, + .get_wol = velocity_ethtool_get_wol, + .set_wol = velocity_ethtool_set_wol, + .get_msglevel = velocity_get_msglevel, + .set_msglevel = velocity_set_msglevel, + .get_link = velocity_get_link, + .get_strings = velocity_get_strings, + .get_sset_count = velocity_get_sset_count, + .get_ethtool_stats = velocity_get_ethtool_stats, + .get_coalesce = velocity_get_coalesce, + .set_coalesce = velocity_set_coalesce, + .begin = velocity_ethtool_up, + .complete = velocity_ethtool_down }; -#ifdef CONFIG_PM -#ifdef CONFIG_INET +#if defined(CONFIG_PM) && defined(CONFIG_INET) static int velocity_netdev_event(struct notifier_block *nb, unsigned long notification, void *ptr) { - struct in_ifaddr *ifa = (struct in_ifaddr *) ptr; + struct in_ifaddr *ifa = ptr; struct net_device *dev = ifa->ifa_dev->dev; if (dev_net(dev) == &init_net && @@ -3476,12 +3533,9 @@ static int velocity_netdev_event(struct notifier_block *nb, unsigned long notifi return NOTIFY_DONE; } -#endif /* CONFIG_INET */ -#endif /* CONFIG_PM */ -#if defined(CONFIG_PM) && defined(CONFIG_INET) static struct notifier_block velocity_inetaddr_notifier = { - .notifier_call = velocity_netdev_event, + .notifier_call = velocity_netdev_event, }; static void velocity_register_notifier(void) |