/* * Copyright (c) 2005-2008 Chelsio, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
*/ #ifndef __CHELSIO_COMMON_H #define __CHELSIO_COMMON_H
/* * More powerful macro that selectively prints messages based on msg_enable. * For info and debugging messages.
*/ #define CH_MSG(adapter, level, category, fmt, ...) do { \ if ((adapter)->msg_enable & NETIF_MSG_##category) \
dev_printk(KERN_##level, &adapter->pdev->dev, fmt, \ ## __VA_ARGS__); \
} while (0)
enum {
SGE_QSETS = 8, /* # of SGE Tx/Rx/RspQ sets */
SGE_RXQ_PER_SET = 2, /* # of Rx queues per set */
SGE_TXQ_PER_SET = 3 /* # of Tx queues per set */
};
struct mdio_ops { int (*read)(struct net_device *dev, int phy_addr, int mmd_addr,
u16 reg_addr); int (*write)(struct net_device *dev, int phy_addr, int mmd_addr,
u16 reg_addr, u16 val); unsigned mode_support;
};
struct mac_stats {
u64 tx_octets; /* total # of octets in good frames */
u64 tx_octets_bad; /* total # of octets in error frames */
u64 tx_frames; /* all good frames */
u64 tx_mcast_frames; /* good multicast frames */
u64 tx_bcast_frames; /* good broadcast frames */
u64 tx_pause; /* # of transmitted pause frames */
u64 tx_deferred; /* frames with deferred transmissions */
u64 tx_late_collisions; /* # of late collisions */
u64 tx_total_collisions; /* # of total collisions */
u64 tx_excess_collisions; /* frame errors from excessive collissions */
u64 tx_underrun; /* # of Tx FIFO underruns */
u64 tx_len_errs; /* # of Tx length errors */
u64 tx_mac_internal_errs; /* # of internal MAC errors on Tx */
u64 tx_excess_deferral; /* # of frames with excessive deferral */
u64 tx_fcs_errs; /* # of frames with bad FCS */
u64 tx_frames_64; /* # of Tx frames in a particular range */
u64 tx_frames_65_127;
u64 tx_frames_128_255;
u64 tx_frames_256_511;
u64 tx_frames_512_1023;
u64 tx_frames_1024_1518;
u64 tx_frames_1519_max;
u64 rx_octets; /* total # of octets in good frames */
u64 rx_octets_bad; /* total # of octets in error frames */
u64 rx_frames; /* all good frames */
u64 rx_mcast_frames; /* good multicast frames */
u64 rx_bcast_frames; /* good broadcast frames */
u64 rx_pause; /* # of received pause frames */
u64 rx_fcs_errs; /* # of received frames with bad FCS */
u64 rx_align_errs; /* alignment errors */
u64 rx_symbol_errs; /* symbol errors */
u64 rx_data_errs; /* data errors */
u64 rx_sequence_errs; /* sequence errors */
u64 rx_runt; /* # of runt frames */
u64 rx_jabber; /* # of jabber frames */
u64 rx_short; /* # of short frames */
u64 rx_too_long; /* # of oversized frames */
u64 rx_mac_internal_errs; /* # of internal MAC errors on Rx */
u64 rx_frames_64; /* # of Rx frames in a particular range */
u64 rx_frames_65_127;
u64 rx_frames_128_255;
u64 rx_frames_256_511;
u64 rx_frames_512_1023;
u64 rx_frames_1024_1518;
u64 rx_frames_1519_max;
u64 rx_cong_drops; /* # of Rx drops due to SGE congestion */
struct mc5_params { unsignedint mode; /* selects MC5 width */ unsignedint nservers; /* size of server region */ unsignedint nfilters; /* size of filter region */ unsignedint nroutes; /* size of routing region */
};
struct link_config { unsignedint supported; /* link capabilities */ unsignedint advertising; /* advertised capabilities */ unsignedshort requested_speed; /* speed user has requested */ unsignedshort speed; /* actual link speed */ unsignedchar requested_duplex; /* duplex user has requested */ unsignedchar duplex; /* actual link duplex */ unsignedchar requested_fc; /* flow control user has requested */ unsignedchar fc; /* actual link flow control */ unsignedchar autoneg; /* autonegotiating? */ unsignedint link_ok; /* link up? */
};
/* PHY operations */ struct cphy_ops { int (*reset)(struct cphy *phy, int wait);
int (*intr_enable)(struct cphy *phy); int (*intr_disable)(struct cphy *phy); int (*intr_clear)(struct cphy *phy); int (*intr_handler)(struct cphy *phy);
int (*autoneg_enable)(struct cphy *phy); int (*autoneg_restart)(struct cphy *phy);
int (*advertise)(struct cphy *phy, unsignedint advertise_map); int (*set_loopback)(struct cphy *phy, int mmd, int dir, int enable); int (*set_speed_duplex)(struct cphy *phy, int speed, int duplex); int (*get_link_status)(struct cphy *phy, int *link_ok, int *speed, int *duplex, int *fc); int (*power_down)(struct cphy *phy, int enable);
void t3_set_reg_field(struct adapter *adap, unsignedint addr, u32 mask,
u32 val); void t3_write_regs(struct adapter *adapter, conststruct addr_val_pair *p, int n, unsignedint offset); int t3_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, int polarity, int attempts, int delay, u32 *valp); staticinlineint t3_wait_op_done(struct adapter *adapter, int reg, u32 mask, int polarity, int attempts, int delay)
{ return t3_wait_op_done_val(adapter, reg, mask, polarity, attempts,
delay, NULL);
} int t3_mdio_change_bits(struct cphy *phy, int mmd, int reg, unsignedint clear, unsignedint set); int t3_phy_reset(struct cphy *phy, int mmd, int wait); int t3_phy_advertise(struct cphy *phy, unsignedint advert); int t3_phy_advertise_fiber(struct cphy *phy, unsignedint advert); int t3_set_phy_speed_duplex(struct cphy *phy, int speed, int duplex); int t3_phy_lasi_intr_enable(struct cphy *phy); int t3_phy_lasi_intr_disable(struct cphy *phy); int t3_phy_lasi_intr_clear(struct cphy *phy); int t3_phy_lasi_intr_handler(struct cphy *phy);
void t3_intr_enable(struct adapter *adapter); void t3_intr_disable(struct adapter *adapter); void t3_intr_clear(struct adapter *adapter); void t3_xgm_intr_enable(struct adapter *adapter, int idx); void t3_xgm_intr_disable(struct adapter *adapter, int idx); void t3_port_intr_enable(struct adapter *adapter, int idx); void t3_port_intr_disable(struct adapter *adapter, int idx); int t3_slow_intr_handler(struct adapter *adapter); int t3_phy_intr_handler(struct adapter *adapter);
void t3_link_changed(struct adapter *adapter, int port_id); void t3_link_fault(struct adapter *adapter, int port_id); int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); conststruct adapter_info *t3_get_adapter_info(unsignedint board_id); int t3_seeprom_wp(struct adapter *adapter, int enable); int t3_get_tp_version(struct adapter *adapter, u32 *vers); int t3_check_tpsram_version(struct adapter *adapter); int t3_check_tpsram(struct adapter *adapter, const u8 *tp_ram, unsignedint size); int t3_set_proto_sram(struct adapter *adap, const u8 *data); int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsignedint size); int t3_get_fw_version(struct adapter *adapter, u32 *vers); int t3_check_fw_version(struct adapter *adapter); int t3_init_hw(struct adapter *adapter, u32 fw_params); int t3_reset_adapter(struct adapter *adapter); int t3_prep_adapter(struct adapter *adapter, conststruct adapter_info *ai, int reset); int t3_replay_prep_adapter(struct adapter *adapter); void t3_led_ready(struct adapter *adapter); void t3_fatal_err(struct adapter *adapter); void t3_set_vlan_accel(struct adapter *adapter, unsignedint ports, int on); void t3_config_rss(struct adapter *adapter, unsignedint rss_config, const u8 * cpus, const u16 *rspq); int t3_cim_ctl_blk_read(struct adapter *adap, unsignedint addr, unsignedint n, unsignedint *valp); int t3_mc7_bd_read(struct mc7 *mc7, unsignedint start, unsignedint n,
u64 *buf);
int t3_mac_reset(struct cmac *mac); void t3b_pcs_reset(struct cmac *mac); void t3_mac_disable_exact_filters(struct cmac *mac); void t3_mac_enable_exact_filters(struct cmac *mac); int t3_mac_enable(struct cmac *mac, int which); int t3_mac_disable(struct cmac *mac, int which); int t3_mac_set_mtu(struct cmac *mac, unsignedint mtu); int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev); int t3_mac_set_address(struct cmac *mac, unsignedint idx, const u8 addr[6]); int t3_mac_set_num_ucast(struct cmac *mac, int n); conststruct mac_stats *t3_mac_update_stats(struct cmac *mac); int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc); int t3b2_mac_watchdog_task(struct cmac *mac);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.