14d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* 2a02d44a02bd2b3f3848f30e335adc3c076b3f905Divy Le Ray * Copyright (c) 2005-2008 Chelsio, Inc. All rights reserved. 34d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray * 41d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * This software is available to you under a choice of one of two 51d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * licenses. You may choose to be licensed under the terms of the GNU 61d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * General Public License (GPL) Version 2, available from the file 71d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * COPYING in the main directory of this source tree, or the 81d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * OpenIB.org BSD license below: 94d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray * 101d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * Redistribution and use in source and binary forms, with or 111d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * without modification, are permitted provided that the following 121d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * conditions are met: 131d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * 141d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * - Redistributions of source code must retain the above 151d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * copyright notice, this list of conditions and the following 161d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * disclaimer. 171d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * 181d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * - Redistributions in binary form must reproduce the above 191d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * copyright notice, this list of conditions and the following 201d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * disclaimer in the documentation and/or other materials 211d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * provided with the distribution. 221d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * 231d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 241d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 251d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 261d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 271d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 281d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 291d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 301d68e93d65d63814388d1a0b3de028de6dc27ae0Divy Le Ray * SOFTWARE. 314d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray */ 324d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#ifndef __CHELSIO_COMMON_H 334d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define __CHELSIO_COMMON_H 344d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 354d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#include <linux/kernel.h> 364d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#include <linux/types.h> 374d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#include <linux/ctype.h> 384d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#include <linux/delay.h> 394d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#include <linux/netdevice.h> 404d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#include <linux/ethtool.h> 410f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings#include <linux/mdio.h> 424d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#include "version.h" 434d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 44f7b4fb22b838f895ce9fa994f0ef4f7f541f5266Joe Perches#define CH_ERR(adap, fmt, ...) dev_err(&adap->pdev->dev, fmt, ##__VA_ARGS__) 45f7b4fb22b838f895ce9fa994f0ef4f7f541f5266Joe Perches#define CH_WARN(adap, fmt, ...) dev_warn(&adap->pdev->dev, fmt, ##__VA_ARGS__) 46f7b4fb22b838f895ce9fa994f0ef4f7f541f5266Joe Perches#define CH_ALERT(adap, fmt, ...) dev_alert(&adap->pdev->dev, fmt, ##__VA_ARGS__) 474d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 484d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* 494d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray * More powerful macro that selectively prints messages based on msg_enable. 504d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray * For info and debugging messages. 514d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray */ 524d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define CH_MSG(adapter, level, category, fmt, ...) do { \ 534d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray if ((adapter)->msg_enable & NETIF_MSG_##category) \ 544d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray dev_printk(KERN_##level, &adapter->pdev->dev, fmt, \ 554d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray ## __VA_ARGS__); \ 564d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} while (0) 574d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 584d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#ifdef DEBUG 594d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray# define CH_DBG(adapter, category, fmt, ...) \ 604d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray CH_MSG(adapter, DEBUG, category, fmt, ## __VA_ARGS__) 614d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#else 624d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray# define CH_DBG(adapter, category, fmt, ...) 634d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#endif 644d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 654d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* Additional NETIF_MSG_* categories */ 664d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define NETIF_MSG_MMIO 0x8000000 674d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 684d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 694d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray MAX_NPORTS = 2, /* max # of ports */ 704d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray MAX_FRAME_SIZE = 10240, /* max MAC frame size, including header + FCS */ 714d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray EEPROMSIZE = 8192, /* Serial EEPROM size */ 72167cdf5fbc64ab8f4eae2cd6d9d0892478d569d7Divy Le Ray SERNUM_LEN = 16, /* Serial # length */ 734d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray RSS_TABLE_SIZE = 64, /* size of RSS lookup and mapping tables */ 744d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray TCB_SIZE = 128, /* TCB size */ 754d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray NMTUS = 16, /* size of MTU table */ 764d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray NCCTRL_WIN = 32, /* # of congestion control windows */ 77480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray PROTO_SRAM_LINES = 128, /* size of TP sram */ 784d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 794d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 8052b810d3055f0a49472d05500c6fea5aeabd01a6Divy Le Ray#define MAX_RX_COALESCING_LEN 12288U 814d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 824d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 834d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PAUSE_RX = 1 << 0, 844d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PAUSE_TX = 1 << 1, 854d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PAUSE_AUTONEG = 1 << 2 864d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 874d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 884d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 898ac3ba68e25a73594646ec30b7c482b364644c92Divy Le Ray SUPPORTED_IRQ = 1 << 24 904d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 914d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 924d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { /* adapter interrupt-maintained statistics */ 934d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray STAT_ULP_CH0_PBL_OOB, 944d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray STAT_ULP_CH1_PBL_OOB, 954d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray STAT_PCI_CORR_ECC, 964d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 974d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray IRQ_NUM_STATS /* keep last */ 984d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 994d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 10034336ec032878d1a32e7df881f16ce2145e53f83Ben Hutchings#define TP_VERSION_MAJOR 1 10134336ec032878d1a32e7df881f16ce2145e53f83Ben Hutchings#define TP_VERSION_MINOR 1 10234336ec032878d1a32e7df881f16ce2145e53f83Ben Hutchings#define TP_VERSION_MICRO 0 103480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray 104480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define S_TP_VERSION_MAJOR 16 105480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define M_TP_VERSION_MAJOR 0xFF 106480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define V_TP_VERSION_MAJOR(x) ((x) << S_TP_VERSION_MAJOR) 107480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define G_TP_VERSION_MAJOR(x) \ 108480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray (((x) >> S_TP_VERSION_MAJOR) & M_TP_VERSION_MAJOR) 109480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray 110480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define S_TP_VERSION_MINOR 8 111480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define M_TP_VERSION_MINOR 0xFF 112480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define V_TP_VERSION_MINOR(x) ((x) << S_TP_VERSION_MINOR) 113480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define G_TP_VERSION_MINOR(x) \ 114480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray (((x) >> S_TP_VERSION_MINOR) & M_TP_VERSION_MINOR) 115480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray 116480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define S_TP_VERSION_MICRO 0 117480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define M_TP_VERSION_MICRO 0xFF 118480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define V_TP_VERSION_MICRO(x) ((x) << S_TP_VERSION_MICRO) 119480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray#define G_TP_VERSION_MICRO(x) \ 120480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray (((x) >> S_TP_VERSION_MICRO) & M_TP_VERSION_MICRO) 121480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Ray 122480fe1a31c662ef4ff0598a7cacefa21f98335f1Divy Le Rayenum { 1234d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray SGE_QSETS = 8, /* # of SGE Tx/Rx/RspQ sets */ 1244d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray SGE_RXQ_PER_SET = 2, /* # of Rx queues per set */ 1254d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray SGE_TXQ_PER_SET = 3 /* # of Tx queues per set */ 1264d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 1274d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1284d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum sge_context_type { /* SGE egress context types */ 1294d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray SGE_CNTXT_RDMA = 0, 1304d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray SGE_CNTXT_ETH = 2, 1314d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray SGE_CNTXT_OFLD = 4, 1324d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray SGE_CNTXT_CTRL = 5 1334d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 1344d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1354d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 1364d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray AN_PKT_SIZE = 32, /* async notification packet size */ 1374d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray IMMED_PKT_SIZE = 48 /* packet size for immediate data */ 1384d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 1394d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1404d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct sg_ent { /* SGE scatter/gather entry */ 141fb8e4444cc8c7719d9947e21a93e2e84bb1b36ebAl Viro __be32 len[2]; 142fb8e4444cc8c7719d9947e21a93e2e84bb1b36ebAl Viro __be64 addr[2]; 1434d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 1444d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1454d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#ifndef SGE_NUM_GENBITS 1464d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* Must be 1 or 2 */ 1474d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray# define SGE_NUM_GENBITS 2 1484d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#endif 1494d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1504d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define TX_DESC_FLITS 16U 1514d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define WR_FLITS (TX_DESC_FLITS + 1 - SGE_NUM_GENBITS) 1524d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1534d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct cphy; 1544d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct adapter; 1554d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1564d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct mdio_ops { 1570f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings int (*read)(struct net_device *dev, int phy_addr, int mmd_addr, 1580f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings u16 reg_addr); 1590f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings int (*write)(struct net_device *dev, int phy_addr, int mmd_addr, 1600f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings u16 reg_addr, u16 val); 1610f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings unsigned mode_support; 1624d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 1634d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1644d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct adapter_info { 165952cdf333f9d1b0b71f1b9a3c5e421a2673ed7deDivy Le Ray unsigned char nports0; /* # of ports on channel 0 */ 166952cdf333f9d1b0b71f1b9a3c5e421a2673ed7deDivy Le Ray unsigned char nports1; /* # of ports on channel 1 */ 1674d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char phy_base_addr; /* MDIO PHY base address */ 1684d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int gpio_out; /* GPIO output settings */ 169f231e0a5a2d01da40515c24f1daa689fe8cfd8d7Divy Le Ray unsigned char gpio_intr[MAX_NPORTS]; /* GPIO PHY IRQ pins */ 1704d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long caps; /* adapter capabilities */ 1714d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray const struct mdio_ops *mdio_ops; /* MDIO operations */ 1724d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray const char *desc; /* product description */ 1734d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 1744d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1754d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct mc5_stats { 1764d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long parity_err; 1774d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long active_rgn_full; 1784d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long nfa_srch_err; 1794d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long unknown_cmd; 1804d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long reqq_parity_err; 1814d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long dispq_parity_err; 1824d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long del_act_empty; 1834d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 1844d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1854d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct mc7_stats { 1864d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long corr_err; 1874d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long uncorr_err; 1884d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long parity_err; 1894d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long addr_err; 1904d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 1914d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 1924d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct mac_stats { 1934d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_octets; /* total # of octets in good frames */ 1944d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_octets_bad; /* total # of octets in error frames */ 1954d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_frames; /* all good frames */ 1964d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_mcast_frames; /* good multicast frames */ 1974d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_bcast_frames; /* good broadcast frames */ 1984d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_pause; /* # of transmitted pause frames */ 1994d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_deferred; /* frames with deferred transmissions */ 2004d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_late_collisions; /* # of late collisions */ 2014d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_total_collisions; /* # of total collisions */ 2024d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_excess_collisions; /* frame errors from excessive collissions */ 2034d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_underrun; /* # of Tx FIFO underruns */ 2044d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_len_errs; /* # of Tx length errors */ 2054d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_mac_internal_errs; /* # of internal MAC errors on Tx */ 2064d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_excess_deferral; /* # of frames with excessive deferral */ 2074d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_fcs_errs; /* # of frames with bad FCS */ 2084d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 2094d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_frames_64; /* # of Tx frames in a particular range */ 2104d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_frames_65_127; 2114d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_frames_128_255; 2124d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_frames_256_511; 2134d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_frames_512_1023; 2144d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_frames_1024_1518; 2154d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 tx_frames_1519_max; 2164d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 2174d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_octets; /* total # of octets in good frames */ 2184d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_octets_bad; /* total # of octets in error frames */ 2194d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_frames; /* all good frames */ 2204d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_mcast_frames; /* good multicast frames */ 2214d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_bcast_frames; /* good broadcast frames */ 2224d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_pause; /* # of received pause frames */ 2234d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_fcs_errs; /* # of received frames with bad FCS */ 2244d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_align_errs; /* alignment errors */ 2254d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_symbol_errs; /* symbol errors */ 2264d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_data_errs; /* data errors */ 2274d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_sequence_errs; /* sequence errors */ 2284d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_runt; /* # of runt frames */ 2294d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_jabber; /* # of jabber frames */ 2304d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_short; /* # of short frames */ 2314d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_too_long; /* # of oversized frames */ 2324d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_mac_internal_errs; /* # of internal MAC errors on Rx */ 2334d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 2344d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_frames_64; /* # of Rx frames in a particular range */ 2354d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_frames_65_127; 2364d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_frames_128_255; 2374d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_frames_256_511; 2384d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_frames_512_1023; 2394d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_frames_1024_1518; 2404d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_frames_1519_max; 2414d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 2424d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 rx_cong_drops; /* # of Rx drops due to SGE congestion */ 2434d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 2444d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long tx_fifo_parity_err; 2454d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long rx_fifo_parity_err; 2464d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long tx_fifo_urun; 2474d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long rx_fifo_ovfl; 2484d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long serdes_signal_loss; 2494d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long xaui_pcs_ctc_err; 2504d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long xaui_pcs_align_change; 251fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray 252fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray unsigned long num_toggled; /* # times toggled TxEn due to stuck TX */ 253fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray unsigned long num_resets; /* # times reset due to stuck TX */ 254fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray 255bf792094ef830117312b3990b63474320ec864c0Divy Le Ray unsigned long link_faults; /* # detected link faults */ 2564d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 2574d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 2584d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct tp_mib_stats { 2594d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInReceive_hi; 2604d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInReceive_lo; 2614d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInHdrErrors_hi; 2624d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInHdrErrors_lo; 2634d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInAddrErrors_hi; 2644d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInAddrErrors_lo; 2654d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInUnknownProtos_hi; 2664d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInUnknownProtos_lo; 2674d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInDiscards_hi; 2684d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInDiscards_lo; 2694d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInDelivers_hi; 2704d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipInDelivers_lo; 2714d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipOutRequests_hi; 2724d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipOutRequests_lo; 2734d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipOutDiscards_hi; 2744d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipOutDiscards_lo; 2754d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipOutNoRoutes_hi; 2764d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipOutNoRoutes_lo; 2774d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipReasmTimeout; 2784d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipReasmReqds; 2794d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipReasmOKs; 2804d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 ipReasmFails; 2814d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 2824d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 reserved[8]; 2834d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 2844d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpActiveOpens; 2854d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpPassiveOpens; 2864d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpAttemptFails; 2874d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpEstabResets; 2884d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpOutRsts; 2894d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpCurrEstab; 2904d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpInSegs_hi; 2914d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpInSegs_lo; 2924d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpOutSegs_hi; 2934d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpOutSegs_lo; 2944d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpRetransSeg_hi; 2954d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpRetransSeg_lo; 2964d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpInErrs_hi; 2974d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpInErrs_lo; 2984d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpRtoMin; 2994d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 tcpRtoMax; 3004d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3014d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3024d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct tp_params { 3034d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int nchan; /* # of channels */ 3044d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int pmrx_size; /* total PMRX capacity */ 3054d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int pmtx_size; /* total PMTX capacity */ 3064d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int cm_size; /* total CM capacity */ 3074d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int chan_rx_size; /* per channel Rx size */ 3084d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int chan_tx_size; /* per channel Tx size */ 3094d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int rx_pg_size; /* Rx page size */ 3104d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int tx_pg_size; /* Tx page size */ 3114d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int rx_num_pgs; /* # of Rx pages */ 3124d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int tx_num_pgs; /* # of Tx pages */ 3134d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int ntimer_qs; /* # of timer queues */ 3144d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3154d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3164d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct qset_params { /* SGE queue set parameters */ 3174d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int polling; /* polling/interrupt service for rspq */ 3184d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int coalesce_usecs; /* irq coalescing timer */ 3194d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int rspq_size; /* # of entries in response queue */ 3204d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int fl_size; /* # of entries in regular free list */ 3214d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int jumbo_size; /* # of entries in jumbo free list */ 3224d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int txq_size[SGE_TXQ_PER_SET]; /* Tx queue sizes */ 3234d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int cong_thres; /* FL congestion threshold */ 3248c26376112fb4b8dfea42069b602c03d53366052Divy Le Ray unsigned int vector; /* Interrupt (line or vector) number */ 3254d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3264d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3274d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct sge_params { 3284d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int max_pkt_size; /* max offload pkt size */ 3294d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct qset_params qset[SGE_QSETS]; 3304d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3314d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3324d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct mc5_params { 3334d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int mode; /* selects MC5 width */ 3344d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int nservers; /* size of server region */ 3354d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int nfilters; /* size of filter region */ 3364d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int nroutes; /* size of routing region */ 3374d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3384d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3394d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* Default MC5 region sizes */ 3404d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 3414d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray DEFAULT_NSERVERS = 512, 3424d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray DEFAULT_NFILTERS = 128 3434d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3444d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3454d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* MC5 modes, these must be non-0 */ 3464d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 3474d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray MC5_MODE_144_BIT = 1, 3484d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray MC5_MODE_72_BIT = 2 3494d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3504d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3519f238486f5438b2e44f760b11fa3a08714c1ddb6Divy Le Ray/* MC5 min active region size */ 3529f238486f5438b2e44f760b11fa3a08714c1ddb6Divy Le Rayenum { MC5_MIN_TIDS = 16 }; 3539f238486f5438b2e44f760b11fa3a08714c1ddb6Divy Le Ray 3544d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct vpd_params { 3554d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int cclk; 3564d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int mclk; 3574d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int uclk; 3584d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int mdc; 3594d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int mem_timing; 360167cdf5fbc64ab8f4eae2cd6d9d0892478d569d7Divy Le Ray u8 sn[SERNUM_LEN + 1]; 3614d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u8 eth_base[6]; 3624d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u8 port_type[MAX_NPORTS]; 3634d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned short xauicfg[2]; 3644d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3654d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3664d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct pci_params { 3674d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int vpd_cap_addr; 3684d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned short speed; 3694d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char width; 3704d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char variant; 3714d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3724d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3734d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 3744d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PCI_VARIANT_PCI, 3754d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PCI_VARIANT_PCIX_MODE1_PARITY, 3764d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PCI_VARIANT_PCIX_MODE1_ECC, 3774d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PCI_VARIANT_PCIX_266_MODE2, 3784d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PCI_VARIANT_PCIE 3794d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 3804d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3814d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct adapter_params { 3824d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct sge_params sge; 3834d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct mc5_params mc5; 3844d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct tp_params tp; 3854d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct vpd_params vpd; 3864d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct pci_params pci; 3874d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3884d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray const struct adapter_info *info; 3894d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3904d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned short mtus[NMTUS]; 3914d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned short a_wnd[NCCTRL_WIN]; 3924d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned short b_wnd[NCCTRL_WIN]; 3934d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 3944d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int nports; /* # of ethernet ports */ 395952cdf333f9d1b0b71f1b9a3c5e421a2673ed7deDivy Le Ray unsigned int chan_map; /* bitmap of in-use Tx channels */ 3964d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int stats_update_period; /* MAC stats accumulation period */ 3974d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int linkpoll_period; /* link poll period in 0.1s */ 3984d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int rev; /* chip revision */ 3998ac3ba68e25a73594646ec30b7c482b364644c92Divy Le Ray unsigned int offload; 4004d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 4014d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 402fc90664e3438c990d280f179ccb0642711d5c553Divy Le Rayenum { /* chip revisions */ 403fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray T3_REV_A = 0, 404fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray T3_REV_B = 2, 405fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray T3_REV_B2 = 3, 4061aafee265723818d903766212015b6116885bc6fDivy Le Ray T3_REV_C = 4, 407fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray}; 408fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray 4094d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct trace_params { 4104d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 sip; 4114d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 sip_mask; 4124d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 dip; 4134d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 dip_mask; 4144d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u16 sport; 4154d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u16 sport_mask; 4164d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u16 dport; 4174d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u16 dport_mask; 4184d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 vlan:12; 4194d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 vlan_mask:12; 4204d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 intf:4; 4214d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 intf_mask:4; 4224d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u8 proto; 4234d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u8 proto_mask; 4244d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 4254d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4264d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct link_config { 4274d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int supported; /* link capabilities */ 4284d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int advertising; /* advertised capabilities */ 4294d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned short requested_speed; /* speed user has requested */ 4304d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned short speed; /* actual link speed */ 4314d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char requested_duplex; /* duplex user has requested */ 4324d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char duplex; /* actual link duplex */ 4334d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char requested_fc; /* flow control user has requested */ 4344d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char fc; /* actual link flow control */ 4354d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char autoneg; /* autonegotiating? */ 4364d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int link_ok; /* link up? */ 4374d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 4384d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4394d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define SPEED_INVALID 0xffff 4404d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define DUPLEX_INVALID 0xff 4414d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4424d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct mc5 { 4434d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct adapter *adapter; 4444d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int tcam_size; 4454d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char part_type; 4464d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char parity_enabled; 4474d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned char mode; 4484d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct mc5_stats stats; 4494d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 4504d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4514d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystatic inline unsigned int t3_mc5_size(const struct mc5 *p) 4524d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 4534d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray return p->tcam_size; 4544d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 4554d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4564d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct mc7 { 4574d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct adapter *adapter; /* backpointer to adapter */ 4584d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int size; /* memory size in bytes */ 4594d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int width; /* MC7 interface width */ 4604d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int offset; /* register address offset for MC7 instance */ 4614d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray const char *name; /* name of MC7 instance */ 4624d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct mc7_stats stats; /* MC7 statistics */ 4634d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 4644d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4654d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystatic inline unsigned int t3_mc7_size(const struct mc7 *p) 4664d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 4674d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray return p->size; 4684d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 4694d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4704d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct cmac { 4714d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct adapter *adapter; 4724d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int offset; 4734d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int nucast; /* # of address filters for unicast MACs */ 47459cf81076a85e1df273155298c462574b49cc0feDivy Le Ray unsigned int tx_tcnt; 47559cf81076a85e1df273155298c462574b49cc0feDivy Le Ray unsigned int tx_xcnt; 47659cf81076a85e1df273155298c462574b49cc0feDivy Le Ray u64 tx_mcnt; 47759cf81076a85e1df273155298c462574b49cc0feDivy Le Ray unsigned int rx_xcnt; 478b1c9e0f7806d1f627f534fd0f83f235087496f7aDivy Le Ray unsigned int rx_ocnt; 47959cf81076a85e1df273155298c462574b49cc0feDivy Le Ray u64 rx_mcnt; 480fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray unsigned int toggle_cnt; 481fc90664e3438c990d280f179ccb0642711d5c553Divy Le Ray unsigned int txen; 482b4687ff753c2c5c330989efed7cdf1a6bc6b512eDivy Le Ray u64 rx_pause; 4834d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct mac_stats stats; 4844d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 4854d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4864d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 4874d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray MAC_DIRECTION_RX = 1, 4884d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray MAC_DIRECTION_TX = 2, 4894d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray MAC_RXFIFO_SIZE = 32768 4904d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 4914d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4924d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* PHY loopback direction */ 4934d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 4944d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PHY_LOOPBACK_TX = 1, 4954d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray PHY_LOOPBACK_RX = 2 4964d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 4974d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 4984d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* PHY interrupt types */ 4994d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayenum { 5004d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray cphy_cause_link_change = 1, 5011e8820256f9921370cd7423396871e2d850e0323Divy Le Ray cphy_cause_fifo_error = 2, 5021e8820256f9921370cd7423396871e2d850e0323Divy Le Ray cphy_cause_module_change = 4, 5031e8820256f9921370cd7423396871e2d850e0323Divy Le Ray}; 5041e8820256f9921370cd7423396871e2d850e0323Divy Le Ray 5051e8820256f9921370cd7423396871e2d850e0323Divy Le Ray/* PHY module types */ 5061e8820256f9921370cd7423396871e2d850e0323Divy Le Rayenum { 5071e8820256f9921370cd7423396871e2d850e0323Divy Le Ray phy_modtype_none, 5081e8820256f9921370cd7423396871e2d850e0323Divy Le Ray phy_modtype_sr, 5091e8820256f9921370cd7423396871e2d850e0323Divy Le Ray phy_modtype_lr, 5101e8820256f9921370cd7423396871e2d850e0323Divy Le Ray phy_modtype_lrm, 5111e8820256f9921370cd7423396871e2d850e0323Divy Le Ray phy_modtype_twinax, 5121e8820256f9921370cd7423396871e2d850e0323Divy Le Ray phy_modtype_twinax_long, 5131e8820256f9921370cd7423396871e2d850e0323Divy Le Ray phy_modtype_unknown 5144d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 5154d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5164d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* PHY operations */ 5174d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct cphy_ops { 5184d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*reset)(struct cphy *phy, int wait); 5194d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5204d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*intr_enable)(struct cphy *phy); 5214d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*intr_disable)(struct cphy *phy); 5224d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*intr_clear)(struct cphy *phy); 5234d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*intr_handler)(struct cphy *phy); 5244d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5254d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*autoneg_enable)(struct cphy *phy); 5264d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*autoneg_restart)(struct cphy *phy); 5274d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5284d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*advertise)(struct cphy *phy, unsigned int advertise_map); 5294d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*set_loopback)(struct cphy *phy, int mmd, int dir, int enable); 5304d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*set_speed_duplex)(struct cphy *phy, int speed, int duplex); 5314d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*get_link_status)(struct cphy *phy, int *link_ok, int *speed, 5324d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int *duplex, int *fc); 5334d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int (*power_down)(struct cphy *phy, int enable); 5340f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings 5350f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings u32 mmds; 5364d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 5372e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Rayenum { 5382e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Ray EDC_OPT_AEL2005 = 0, 5392e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Ray EDC_OPT_AEL2005_SIZE = 1084, 5402e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Ray EDC_TWX_AEL2005 = 1, 5412e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Ray EDC_TWX_AEL2005_SIZE = 1464, 5422e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Ray EDC_TWX_AEL2020 = 2, 5432e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Ray EDC_TWX_AEL2020_SIZE = 1628, 5442e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Ray EDC_MAX_SIZE = EDC_TWX_AEL2020_SIZE, /* Max cache size */ 5452e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Ray}; 5464d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5474d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* A PHY instance */ 5484d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct cphy { 5491e8820256f9921370cd7423396871e2d850e0323Divy Le Ray u8 modtype; /* PHY module type */ 5501e8820256f9921370cd7423396871e2d850e0323Divy Le Ray short priv; /* scratch pad */ 551044979827eda13675abab99879ebe3ea535d59faDivy Le Ray unsigned int caps; /* PHY capabilities */ 5524d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray struct adapter *adapter; /* associated adapter */ 553044979827eda13675abab99879ebe3ea535d59faDivy Le Ray const char *desc; /* PHY description */ 5544d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned long fifo_errors; /* FIFO over/under-flows */ 5554d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray const struct cphy_ops *ops; /* PHY operations */ 5560f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings struct mdio_if_info mdio; 5572e8c07c35b3ffee7689406be61fd1448ee45d3cdDivy Le Ray u16 phy_cache[EDC_MAX_SIZE]; /* EDC cache */ 5584d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 5594d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5604d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* Convenience MDIO read/write wrappers */ 5610f07c4ee8c800923ae7918c231532a9256233eedBen Hutchingsstatic inline int t3_mdio_read(struct cphy *phy, int mmd, int reg, 5620f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings unsigned int *valp) 5634d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 5640f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings int rc = phy->mdio.mdio_read(phy->mdio.dev, phy->mdio.prtad, mmd, reg); 5650f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings *valp = (rc >= 0) ? rc : -1; 5660f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings return (rc >= 0) ? 0 : rc; 5674d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 5684d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5690f07c4ee8c800923ae7918c231532a9256233eedBen Hutchingsstatic inline int t3_mdio_write(struct cphy *phy, int mmd, int reg, 5700f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings unsigned int val) 5714d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 5720f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings return phy->mdio.mdio_write(phy->mdio.dev, phy->mdio.prtad, mmd, 5730f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings reg, val); 5744d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 5754d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5764d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* Convenience initializer */ 5774d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystatic inline void cphy_init(struct cphy *phy, struct adapter *adapter, 5784d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int phy_addr, struct cphy_ops *phy_ops, 579044979827eda13675abab99879ebe3ea535d59faDivy Le Ray const struct mdio_ops *mdio_ops, 580044979827eda13675abab99879ebe3ea535d59faDivy Le Ray unsigned int caps, const char *desc) 5814d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 582044979827eda13675abab99879ebe3ea535d59faDivy Le Ray phy->caps = caps; 583044979827eda13675abab99879ebe3ea535d59faDivy Le Ray phy->adapter = adapter; 584044979827eda13675abab99879ebe3ea535d59faDivy Le Ray phy->desc = desc; 5854d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray phy->ops = phy_ops; 5864d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray if (mdio_ops) { 5870f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings phy->mdio.prtad = phy_addr; 5880f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings phy->mdio.mmds = phy_ops->mmds; 5890f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings phy->mdio.mode_support = mdio_ops->mode_support; 5900f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings phy->mdio.mdio_read = mdio_ops->read; 5910f07c4ee8c800923ae7918c231532a9256233eedBen Hutchings phy->mdio.mdio_write = mdio_ops->write; 5924d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray } 5934d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 5944d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5954d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray/* Accumulate MAC statistics every 180 seconds. For 1G we multiply by 10. */ 5964d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define MAC_STATS_ACCUM_SECS 180 5974d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 5984d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define XGM_REG(reg_addr, idx) \ 5994d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray ((reg_addr) + (idx) * (XGMAC0_1_BASE_ADDR - XGMAC0_0_BASE_ADDR)) 6004d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6014d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystruct addr_val_pair { 6024d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int reg_addr; 6034d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int val; 6044d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray}; 6054d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6064d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#include "adapter.h" 6074d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6084d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#ifndef PCI_VENDOR_ID_CHELSIO 6094d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray# define PCI_VENDOR_ID_CHELSIO 0x1425 6104d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#endif 6114d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6124d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define for_each_port(adapter, iter) \ 6134d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray for (iter = 0; iter < (adapter)->params.nports; ++iter) 6144d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6154d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#define adapter_info(adap) ((adap)->params.info) 6164d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6174d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystatic inline int uses_xaui(const struct adapter *adap) 6184d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 6194d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray return adapter_info(adap)->caps & SUPPORTED_AUI; 6204d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 6214d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6224d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystatic inline int is_10G(const struct adapter *adap) 6234d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 6244d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray return adapter_info(adap)->caps & SUPPORTED_10000baseT_Full; 6254d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 6264d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6274d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystatic inline int is_offload(const struct adapter *adap) 6284d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 6298ac3ba68e25a73594646ec30b7c482b364644c92Divy Le Ray return adap->params.offload; 6304d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 6314d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6324d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystatic inline unsigned int core_ticks_per_usec(const struct adapter *adap) 6334d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 6344d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray return adap->params.vpd.cclk / 1000; 6354d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 6364d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6374d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystatic inline unsigned int is_pcie(const struct adapter *adap) 6384d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 6394d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray return adap->params.pci.variant == PCI_VARIANT_PCIE; 6404d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 6414d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6424d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, 6434d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u32 val); 6444d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_write_regs(struct adapter *adapter, const struct addr_val_pair *p, 6454d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int n, unsigned int offset); 6464d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, 6474d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int polarity, int attempts, int delay, u32 *valp); 6484d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Raystatic inline int t3_wait_op_done(struct adapter *adapter, int reg, u32 mask, 6494d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int polarity, int attempts, int delay) 6504d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray{ 6514d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray return t3_wait_op_done_val(adapter, reg, mask, polarity, attempts, 6524d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray delay, NULL); 6534d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray} 6544d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mdio_change_bits(struct cphy *phy, int mmd, int reg, unsigned int clear, 6554d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int set); 6564d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_phy_reset(struct cphy *phy, int mmd, int wait); 6574d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_phy_advertise(struct cphy *phy, unsigned int advert); 6580ce2f03bade2046d6eb6184d52d065688382d7bdDivy Le Rayint t3_phy_advertise_fiber(struct cphy *phy, unsigned int advert); 6594d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_set_phy_speed_duplex(struct cphy *phy, int speed, int duplex); 6609b1e36566c5fafbcc732c971acfcf8580332931aDivy Le Rayint t3_phy_lasi_intr_enable(struct cphy *phy); 6619b1e36566c5fafbcc732c971acfcf8580332931aDivy Le Rayint t3_phy_lasi_intr_disable(struct cphy *phy); 6629b1e36566c5fafbcc732c971acfcf8580332931aDivy Le Rayint t3_phy_lasi_intr_clear(struct cphy *phy); 6639b1e36566c5fafbcc732c971acfcf8580332931aDivy Le Rayint t3_phy_lasi_intr_handler(struct cphy *phy); 6644d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6654d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_intr_enable(struct adapter *adapter); 6664d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_intr_disable(struct adapter *adapter); 6674d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_intr_clear(struct adapter *adapter); 668bf792094ef830117312b3990b63474320ec864c0Divy Le Rayvoid t3_xgm_intr_enable(struct adapter *adapter, int idx); 669bf792094ef830117312b3990b63474320ec864c0Divy Le Rayvoid t3_xgm_intr_disable(struct adapter *adapter, int idx); 6704d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_port_intr_enable(struct adapter *adapter, int idx); 6714d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_port_intr_disable(struct adapter *adapter, int idx); 6724d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_slow_intr_handler(struct adapter *adapter); 6734d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_phy_intr_handler(struct adapter *adapter); 6744d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 6754d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_link_changed(struct adapter *adapter, int port_id); 676bf792094ef830117312b3990b63474320ec864c0Divy Le Rayvoid t3_link_fault(struct adapter *adapter, int port_id); 6774d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); 6784d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayconst struct adapter_info *t3_get_adapter_info(unsigned int board_id); 67905e5c1165393a2d6044b01288f089d2e74a49d58Al Viroint t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data); 68005e5c1165393a2d6044b01288f089d2e74a49d58Al Viroint t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data); 6814d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_seeprom_wp(struct adapter *adapter, int enable); 68247330077650a25d417155848516b2cba97999602Divy Le Rayint t3_get_tp_version(struct adapter *adapter, u32 *vers); 6838207befa199c9ade670d1cf9a5bcdc76310751bdDivy Le Rayint t3_check_tpsram_version(struct adapter *adapter); 6842c733a16784021c7c6a0c10e800937f0645d0a36David Woodhouseint t3_check_tpsram(struct adapter *adapter, const u8 *tp_ram, 6852c733a16784021c7c6a0c10e800937f0645d0a36David Woodhouse unsigned int size); 6862c733a16784021c7c6a0c10e800937f0645d0a36David Woodhouseint t3_set_proto_sram(struct adapter *adap, const u8 *data); 6874d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size); 6884d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_get_fw_version(struct adapter *adapter, u32 *vers); 6898207befa199c9ade670d1cf9a5bcdc76310751bdDivy Le Rayint t3_check_fw_version(struct adapter *adapter); 6904d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_init_hw(struct adapter *adapter, u32 fw_params); 69120d3fc11505a2706a33b4c9a932af036d836727fDivy Le Rayint t3_reset_adapter(struct adapter *adapter); 6924d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, 6934d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int reset); 694204e2f98c2d13f869b8541f3c57c7314f75cab11Divy Le Rayint t3_replay_prep_adapter(struct adapter *adapter); 6954d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_led_ready(struct adapter *adapter); 6964d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_fatal_err(struct adapter *adapter); 6974d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_set_vlan_accel(struct adapter *adapter, unsigned int ports, int on); 6984d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_config_rss(struct adapter *adapter, unsigned int rss_config, 6994d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray const u8 * cpus, const u16 *rspq); 7004d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_cim_ctl_blk_read(struct adapter *adap, unsigned int addr, 7014d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int n, unsigned int *valp); 7024d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mc7_bd_read(struct mc7 *mc7, unsigned int start, unsigned int n, 7034d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray u64 *buf); 7044d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 7054d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mac_reset(struct cmac *mac); 7064d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3b_pcs_reset(struct cmac *mac); 707bf792094ef830117312b3990b63474320ec864c0Divy Le Rayvoid t3_mac_disable_exact_filters(struct cmac *mac); 708bf792094ef830117312b3990b63474320ec864c0Divy Le Rayvoid t3_mac_enable_exact_filters(struct cmac *mac); 7094d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mac_enable(struct cmac *mac, int which); 7104d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mac_disable(struct cmac *mac, int which); 7114d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mac_set_mtu(struct cmac *mac, unsigned int mtu); 7120988d26978561d568efed45cc5576d85ea7b609dJiri Pirkoint t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev); 7134d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]); 7144d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mac_set_num_ucast(struct cmac *mac, int n); 7154d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayconst struct mac_stats *t3_mac_update_stats(struct cmac *mac); 7164d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc); 717fc90664e3438c990d280f179ccb0642711d5c553Divy Le Rayint t3b2_mac_watchdog_task(struct cmac *mac); 7184d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 7194d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode); 7204d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, 7214d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int nroutes); 7224d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_mc5_intr_handler(struct mc5 *mc5); 7234d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 7244d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_tp_set_offload_mode(struct adapter *adap, int enable); 7254d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_tp_get_mib_stats(struct adapter *adap, struct tp_mib_stats *tps); 7264d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_load_mtus(struct adapter *adap, unsigned short mtus[NMTUS], 7274d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned short alpha[NCCTRL_WIN], 7284d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned short beta[NCCTRL_WIN], unsigned short mtu_cap); 7294d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_config_trace_filter(struct adapter *adapter, 7304d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray const struct trace_params *tp, int filter_index, 7314d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int invert, int enable); 7324d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_config_sched(struct adapter *adap, unsigned int kbps, int sched); 7334d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 7344d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_sge_prep(struct adapter *adap, struct sge_params *p); 7354d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayvoid t3_sge_init(struct adapter *adap, struct sge_params *p); 7364d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_sge_init_ecntxt(struct adapter *adapter, unsigned int id, int gts_enable, 7374d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray enum sge_context_type type, int respq, u64 base_addr, 7384d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int size, unsigned int token, int gen, 7394d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int cidx); 7404d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_sge_init_flcntxt(struct adapter *adapter, unsigned int id, 7414d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int gts_enable, u64 base_addr, unsigned int size, 7424d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int esize, unsigned int cong_thres, int gen, 7434d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int cidx); 7444d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_sge_init_rspcntxt(struct adapter *adapter, unsigned int id, 7454d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray int irq_vec_idx, u64 base_addr, unsigned int size, 7464d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int fl_thres, int gen, unsigned int cidx); 7474d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_sge_init_cqcntxt(struct adapter *adapter, unsigned int id, u64 base_addr, 7484d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int size, int rspq, int ovfl_mode, 7494d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int credits, unsigned int credit_thres); 7504d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_sge_enable_ecntxt(struct adapter *adapter, unsigned int id, int enable); 7514d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_sge_disable_fl(struct adapter *adapter, unsigned int id); 7524d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_sge_disable_rspcntxt(struct adapter *adapter, unsigned int id); 7534d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_sge_disable_cqcntxt(struct adapter *adapter, unsigned int id); 7544d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Rayint t3_sge_cqcntxt_op(struct adapter *adapter, unsigned int id, unsigned int op, 7554d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray unsigned int credits); 7564d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray 75778e4689e908adc8334272756c32c9218d1967408Divy Le Rayint t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter, 75878e4689e908adc8334272756c32c9218d1967408Divy Le Ray int phy_addr, const struct mdio_ops *mdio_ops); 75978e4689e908adc8334272756c32c9218d1967408Divy Le Rayint t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter, 76078e4689e908adc8334272756c32c9218d1967408Divy Le Ray int phy_addr, const struct mdio_ops *mdio_ops); 76178e4689e908adc8334272756c32c9218d1967408Divy Le Rayint t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter, 76278e4689e908adc8334272756c32c9218d1967408Divy Le Ray int phy_addr, const struct mdio_ops *mdio_ops); 7631e8820256f9921370cd7423396871e2d850e0323Divy Le Rayint t3_ael2005_phy_prep(struct cphy *phy, struct adapter *adapter, 7641e8820256f9921370cd7423396871e2d850e0323Divy Le Ray int phy_addr, const struct mdio_ops *mdio_ops); 765744514249f0656e2d50bb57585241670c2d4f32bDivy Le Rayint t3_ael2020_phy_prep(struct cphy *phy, struct adapter *adapter, 766744514249f0656e2d50bb57585241670c2d4f32bDivy Le Ray int phy_addr, const struct mdio_ops *mdio_ops); 76778e4689e908adc8334272756c32c9218d1967408Divy Le Rayint t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr, 76878e4689e908adc8334272756c32c9218d1967408Divy Le Ray const struct mdio_ops *mdio_ops); 76978e4689e908adc8334272756c32c9218d1967408Divy Le Rayint t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter, 77078e4689e908adc8334272756c32c9218d1967408Divy Le Ray int phy_addr, const struct mdio_ops *mdio_ops); 771f22a563b0a4c2a84b6ff8831306532b64c9c1747Divy Le Rayint t3_aq100x_phy_prep(struct cphy *phy, struct adapter *adapter, 772f22a563b0a4c2a84b6ff8831306532b64c9c1747Divy Le Ray int phy_addr, const struct mdio_ops *mdio_ops); 7734d22de3e6cc4a09c369b504cd8bcde3385a974cdDivy Le Ray#endif /* __CHELSIO_COMMON_H */ 774