#define pr_fmt(fmt) …
#include <linux/bitmap.h>
#include <linux/crc32.h>
#include <linux/ctype.h>
#include <linux/debugfs.h>
#include <linux/err.h>
#include <linux/etherdevice.h>
#include <linux/firmware.h>
#include <linux/if.h>
#include <linux/if_vlan.h>
#include <linux/init.h>
#include <linux/log2.h>
#include <linux/mdio.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/pci.h>
#include <linux/rtnetlink.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/sockios.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <net/neighbour.h>
#include <net/netevent.h>
#include <net/addrconf.h>
#include <net/bonding.h>
#include <linux/uaccess.h>
#include <linux/crash_dump.h>
#include <net/udp_tunnel.h>
#include <net/xfrm.h>
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
#include <net/tls.h>
#endif
#include "cxgb4.h"
#include "cxgb4_filter.h"
#include "t4_regs.h"
#include "t4_values.h"
#include "t4_msg.h"
#include "t4fw_api.h"
#include "t4fw_version.h"
#include "cxgb4_dcb.h"
#include "srq.h"
#include "cxgb4_debugfs.h"
#include "clip_tbl.h"
#include "l2t.h"
#include "smt.h"
#include "sched.h"
#include "cxgb4_tc_u32.h"
#include "cxgb4_tc_flower.h"
#include "cxgb4_tc_mqprio.h"
#include "cxgb4_tc_matchall.h"
#include "cxgb4_ptp.h"
#include "cxgb4_cudbg.h"
char cxgb4_driver_name[] = …;
#define DRV_DESC …
#define DFLT_MSG_ENABLE …
#define CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN …
#define CXGB4_UNIFIED_PF …
#define CH_PCI_DEVICE_ID_FUNCTION …
#define CH_PCI_DEVICE_ID_FUNCTION2 …
#define CH_PCI_ID_TABLE_ENTRY(devid) …
#define CH_PCI_DEVICE_ID_TABLE_DEFINE_END …
#include "t4_pci_id_tbl.h"
#define FW4_FNAME …
#define FW5_FNAME …
#define FW6_FNAME …
#define FW4_CFNAME …
#define FW5_CFNAME …
#define FW6_CFNAME …
#define PHY_AQ1202_FIRMWARE …
#define PHY_BCM84834_FIRMWARE …
#define PHY_AQ1202_DEVICEID …
#define PHY_BCM84834_DEVICEID …
MODULE_DESCRIPTION(…);
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_DEVICE_TABLE(pci, cxgb4_pci_tbl);
MODULE_FIRMWARE(…);
MODULE_FIRMWARE(…);
MODULE_FIRMWARE(…);
static int msi = …;
module_param(msi, int, 0644);
MODULE_PARM_DESC(…) …;
static int rx_dma_offset = …;
static int select_queue;
module_param(select_queue, int, 0644);
MODULE_PARM_DESC(…) …;
static struct dentry *cxgb4_debugfs_root;
LIST_HEAD(…);
DEFINE_MUTEX(…) …;
LIST_HEAD(…);
static int cfg_queues(struct adapter *adap);
static void link_report(struct net_device *dev)
{ … }
#ifdef CONFIG_CHELSIO_T4_DCB
static void dcb_tx_queue_prio_enable(struct net_device *dev, int enable)
{ … }
int cxgb4_dcb_enabled(const struct net_device *dev)
{ … }
#endif
void t4_os_link_changed(struct adapter *adapter, int port_id, int link_stat)
{ … }
void t4_os_portmod_changed(struct adapter *adap, int port_id)
{ … }
int dbfifo_int_thresh = …;
module_param(dbfifo_int_thresh, int, 0644);
MODULE_PARM_DESC(…) …;
static int dbfifo_drain_delay = …;
module_param(dbfifo_drain_delay, int, 0644);
MODULE_PARM_DESC(…) …;
static inline int cxgb4_set_addr_hash(struct port_info *pi)
{ … }
static int cxgb4_mac_sync(struct net_device *netdev, const u8 *mac_addr)
{ … }
static int cxgb4_mac_unsync(struct net_device *netdev, const u8 *mac_addr)
{ … }
static int set_rxmode(struct net_device *dev, int mtu, bool sleep_ok)
{ … }
int cxgb4_change_mac(struct port_info *pi, unsigned int viid,
int *tcam_idx, const u8 *addr, bool persist,
u8 *smt_idx)
{ … }
static int link_start(struct net_device *dev)
{ … }
#ifdef CONFIG_CHELSIO_T4_DCB
static void dcb_rpl(struct adapter *adap, const struct fw_port_cmd *pcmd)
{ … }
#endif
static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp,
const struct pkt_gl *gl)
{ … }
static void disable_msi(struct adapter *adapter)
{ … }
static irqreturn_t t4_nondata_intr(int irq, void *cookie)
{ … }
int cxgb4_set_msix_aff(struct adapter *adap, unsigned short vec,
cpumask_var_t *aff_mask, int idx)
{ … }
void cxgb4_clear_msix_aff(unsigned short vec, cpumask_var_t aff_mask)
{ … }
static int request_msix_queue_irqs(struct adapter *adap)
{ … }
static void free_msix_queue_irqs(struct adapter *adap)
{ … }
static int setup_ppod_edram(struct adapter *adap)
{ … }
static void adap_config_hpfilter(struct adapter *adapter)
{ … }
static int cxgb4_config_rss(const struct port_info *pi, u16 *rss,
u16 rss_size, u16 viid)
{ … }
int cxgb4_write_rss(const struct port_info *pi, const u16 *queues)
{ … }
static int setup_rss(struct adapter *adap)
{ … }
static unsigned int rxq_to_chan(const struct sge *p, unsigned int qid)
{ … }
void cxgb4_quiesce_rx(struct sge_rspq *q)
{ … }
static void quiesce_rx(struct adapter *adap)
{ … }
static void disable_interrupts(struct adapter *adap)
{ … }
void cxgb4_enable_rx(struct adapter *adap, struct sge_rspq *q)
{ … }
static void enable_rx(struct adapter *adap)
{ … }
static int setup_non_data_intr(struct adapter *adap)
{ … }
static int setup_fw_sge_queues(struct adapter *adap)
{ … }
static int setup_sge_queues(struct adapter *adap)
{ … }
static u16 cxgb_select_queue(struct net_device *dev, struct sk_buff *skb,
struct net_device *sb_dev)
{ … }
static int closest_timer(const struct sge *s, int time)
{ … }
static int closest_thres(const struct sge *s, int thres)
{ … }
int cxgb4_set_rspq_intr_params(struct sge_rspq *q,
unsigned int us, unsigned int cnt)
{ … }
static int cxgb_set_features(struct net_device *dev, netdev_features_t features)
{ … }
static int setup_debugfs(struct adapter *adap)
{ … }
static void cxgb4_port_mirror_free_rxq(struct adapter *adap,
struct sge_eth_rxq *mirror_rxq)
{ … }
static int cxgb4_port_mirror_alloc_queues(struct net_device *dev)
{ … }
static void cxgb4_port_mirror_free_queues(struct net_device *dev)
{ … }
static int cxgb4_port_mirror_start(struct net_device *dev)
{ … }
static void cxgb4_port_mirror_stop(struct net_device *dev)
{ … }
int cxgb4_port_mirror_alloc(struct net_device *dev)
{ … }
void cxgb4_port_mirror_free(struct net_device *dev)
{ … }
int cxgb4_alloc_atid(struct tid_info *t, void *data)
{ … }
EXPORT_SYMBOL(…);
void cxgb4_free_atid(struct tid_info *t, unsigned int atid)
{ … }
EXPORT_SYMBOL(…);
int cxgb4_alloc_stid(struct tid_info *t, int family, void *data)
{ … }
EXPORT_SYMBOL(…);
int cxgb4_alloc_sftid(struct tid_info *t, int family, void *data)
{ … }
EXPORT_SYMBOL(…);
void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family)
{ … }
EXPORT_SYMBOL(…);
static void mk_tid_release(struct sk_buff *skb, unsigned int chan,
unsigned int tid)
{ … }
static void cxgb4_queue_tid_release(struct tid_info *t, unsigned int chan,
unsigned int tid)
{ … }
static void process_tid_release_list(struct work_struct *work)
{ … }
void cxgb4_remove_tid(struct tid_info *t, unsigned int chan, unsigned int tid,
unsigned short family)
{ … }
EXPORT_SYMBOL(…);
static int tid_init(struct tid_info *t)
{ … }
int cxgb4_create_server(const struct net_device *dev, unsigned int stid,
__be32 sip, __be16 sport, __be16 vlan,
unsigned int queue)
{ … }
EXPORT_SYMBOL(…);
int cxgb4_create_server6(const struct net_device *dev, unsigned int stid,
const struct in6_addr *sip, __be16 sport,
unsigned int queue)
{ … }
EXPORT_SYMBOL(…);
int cxgb4_remove_server(const struct net_device *dev, unsigned int stid,
unsigned int queue, bool ipv6)
{ … }
EXPORT_SYMBOL(…);
unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu,
unsigned int *idx)
{ … }
EXPORT_SYMBOL(…);
unsigned int cxgb4_best_aligned_mtu(const unsigned short *mtus,
unsigned short header_size,
unsigned short data_size_max,
unsigned short data_size_align,
unsigned int *mtu_idxp)
{ … }
EXPORT_SYMBOL(…);
unsigned int cxgb4_port_chan(const struct net_device *dev)
{ … }
EXPORT_SYMBOL(…);
unsigned int cxgb4_port_e2cchan(const struct net_device *dev)
{ … }
EXPORT_SYMBOL(…);
unsigned int cxgb4_dbfifo_count(const struct net_device *dev, int lpfifo)
{ … }
EXPORT_SYMBOL(…);
unsigned int cxgb4_port_viid(const struct net_device *dev)
{ … }
EXPORT_SYMBOL(…);
unsigned int cxgb4_port_idx(const struct net_device *dev)
{ … }
EXPORT_SYMBOL(…);
void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4,
struct tp_tcp_stats *v6)
{ … }
EXPORT_SYMBOL(…);
void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask,
const unsigned int *pgsz_order)
{ … }
EXPORT_SYMBOL(…);
int cxgb4_flush_eq_cache(struct net_device *dev)
{ … }
EXPORT_SYMBOL(…);
static int read_eq_indices(struct adapter *adap, u16 qid, u16 *pidx, u16 *cidx)
{ … }
int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx,
u16 size)
{ … }
EXPORT_SYMBOL(…);
int cxgb4_read_tpte(struct net_device *dev, u32 stag, __be32 *tpte)
{ … }
EXPORT_SYMBOL(…);
u64 cxgb4_read_sge_timestamp(struct net_device *dev)
{ … }
EXPORT_SYMBOL(…);
int cxgb4_bar2_sge_qregs(struct net_device *dev,
unsigned int qid,
enum cxgb4_bar2_qtype qtype,
int user,
u64 *pbar2_qoffset,
unsigned int *pbar2_qid)
{ … }
EXPORT_SYMBOL(…);
static struct pci_driver cxgb4_driver;
static void check_neigh_update(struct neighbour *neigh)
{ … }
static int netevent_cb(struct notifier_block *nb, unsigned long event,
void *data)
{ … }
static bool netevent_registered;
static struct notifier_block cxgb4_netevent_nb = …;
static void drain_db_fifo(struct adapter *adap, int usecs)
{ … }
static void disable_txq_db(struct sge_txq *q)
{ … }
static void enable_txq_db(struct adapter *adap, struct sge_txq *q)
{ … }
static void disable_dbs(struct adapter *adap)
{ … }
static void enable_dbs(struct adapter *adap)
{ … }
static void notify_rdma_uld(struct adapter *adap, enum cxgb4_control cmd)
{ … }
static void process_db_full(struct work_struct *work)
{ … }
static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q)
{ … }
static void recover_all_queues(struct adapter *adap)
{ … }
static void process_db_drop(struct work_struct *work)
{ … }
void t4_db_full(struct adapter *adap)
{ … }
void t4_db_dropped(struct adapter *adap)
{ … }
void t4_register_netevent_notifier(void)
{ … }
static void detach_ulds(struct adapter *adap)
{ … }
static void notify_ulds(struct adapter *adap, enum cxgb4_state new_state)
{ … }
#if IS_ENABLED(CONFIG_IPV6)
static int cxgb4_inet6addr_handler(struct notifier_block *this,
unsigned long event, void *data)
{ … }
static bool inet6addr_registered;
static struct notifier_block cxgb4_inet6addr_notifier = …;
static void update_clip(const struct adapter *adap)
{ … }
#endif
static int cxgb_up(struct adapter *adap)
{ … }
static void cxgb_down(struct adapter *adapter)
{ … }
static int cxgb_open(struct net_device *dev)
{ … }
static int cxgb_close(struct net_device *dev)
{ … }
int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid,
__be32 sip, __be16 sport, __be16 vlan,
unsigned int queue, unsigned char port, unsigned char mask)
{ … }
EXPORT_SYMBOL(…);
int cxgb4_remove_server_filter(const struct net_device *dev, unsigned int stid,
unsigned int queue, bool ipv6)
{ … }
EXPORT_SYMBOL(…);
static void cxgb_get_stats(struct net_device *dev,
struct rtnl_link_stats64 *ns)
{ … }
static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
{ … }
static void cxgb_set_rxmode(struct net_device *dev)
{ … }
static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
{ … }
#ifdef CONFIG_PCI_IOV
static int cxgb4_mgmt_open(struct net_device *dev)
{ … }
static void cxgb4_mgmt_fill_vf_station_mac_addr(struct adapter *adap)
{ … }
static int cxgb4_mgmt_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
{ … }
static int cxgb4_mgmt_get_vf_config(struct net_device *dev,
int vf, struct ifla_vf_info *ivi)
{ … }
static int cxgb4_mgmt_get_phys_port_id(struct net_device *dev,
struct netdev_phys_item_id *ppid)
{ … }
static int cxgb4_mgmt_set_vf_rate(struct net_device *dev, int vf,
int min_tx_rate, int max_tx_rate)
{ … }
static int cxgb4_mgmt_set_vf_vlan(struct net_device *dev, int vf,
u16 vlan, u8 qos, __be16 vlan_proto)
{ … }
static int cxgb4_mgmt_set_vf_link_state(struct net_device *dev, int vf,
int link)
{ … }
#endif
static int cxgb_set_mac_addr(struct net_device *dev, void *p)
{ … }
#ifdef CONFIG_NET_POLL_CONTROLLER
static void cxgb_netpoll(struct net_device *dev)
{ … }
#endif
static int cxgb_set_tx_maxrate(struct net_device *dev, int index, u32 rate)
{ … }
static int cxgb_setup_tc_flower(struct net_device *dev,
struct flow_cls_offload *cls_flower)
{ … }
static int cxgb_setup_tc_cls_u32(struct net_device *dev,
struct tc_cls_u32_offload *cls_u32)
{ … }
static int cxgb_setup_tc_matchall(struct net_device *dev,
struct tc_cls_matchall_offload *cls_matchall,
bool ingress)
{ … }
static int cxgb_setup_tc_block_ingress_cb(enum tc_setup_type type,
void *type_data, void *cb_priv)
{ … }
static int cxgb_setup_tc_block_egress_cb(enum tc_setup_type type,
void *type_data, void *cb_priv)
{ … }
static int cxgb_setup_tc_mqprio(struct net_device *dev,
struct tc_mqprio_qopt_offload *mqprio)
{ … }
static LIST_HEAD(cxgb_block_cb_list);
static int cxgb_setup_tc_block(struct net_device *dev,
struct flow_block_offload *f)
{ … }
static int cxgb_setup_tc(struct net_device *dev, enum tc_setup_type type,
void *type_data)
{ … }
static int cxgb_udp_tunnel_unset_port(struct net_device *netdev,
unsigned int table, unsigned int entry,
struct udp_tunnel_info *ti)
{ … }
static int cxgb_udp_tunnel_set_port(struct net_device *netdev,
unsigned int table, unsigned int entry,
struct udp_tunnel_info *ti)
{ … }
static const struct udp_tunnel_nic_info cxgb_udp_tunnels = …;
static netdev_features_t cxgb_features_check(struct sk_buff *skb,
struct net_device *dev,
netdev_features_t features)
{ … }
static netdev_features_t cxgb_fix_features(struct net_device *dev,
netdev_features_t features)
{ … }
static const struct net_device_ops cxgb4_netdev_ops = …;
#ifdef CONFIG_PCI_IOV
static const struct net_device_ops cxgb4_mgmt_netdev_ops = …;
static void cxgb4_mgmt_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{ … }
static const struct ethtool_ops cxgb4_mgmt_ethtool_ops = …;
#endif
static void notify_fatal_err(struct work_struct *work)
{ … }
void t4_fatal_err(struct adapter *adap)
{ … }
static void setup_memwin(struct adapter *adap)
{ … }
static void setup_memwin_rdma(struct adapter *adap)
{ … }
#define HMA_MAX_ADDR_IN_CMD …
#define HMA_PAGE_SIZE …
#define HMA_MAX_NO_FW_ADDRESS …
#define HMA_PAGE_ORDER …
#define HMA_MIN_TOTAL_SIZE …
#define HMA_MAX_TOTAL_SIZE …
static void adap_free_hma_mem(struct adapter *adapter)
{ … }
static int adap_config_hma(struct adapter *adapter)
{ … }
static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c)
{ … }
#define MAX_ATIDS …
static int adap_init0_tweaks(struct adapter *adapter)
{ … }
static int phy_aq1202_version(const u8 *phy_fw_data,
size_t phy_fw_size)
{ … }
static struct info_10gbt_phy_fw { … } phy_info_array[] = …;
static struct info_10gbt_phy_fw *find_phy_info(int devid)
{ … }
static int adap_init0_phy(struct adapter *adap)
{ … }
static int adap_init0_config(struct adapter *adapter, int reset)
{ … }
static struct fw_info fw_info_array[] = …;
static struct fw_info *find_fw_info(int chip)
{ … }
static int adap_init0(struct adapter *adap, int vpd_skip)
{ … }
static pci_ers_result_t eeh_err_detected(struct pci_dev *pdev,
pci_channel_state_t state)
{ … }
static pci_ers_result_t eeh_slot_reset(struct pci_dev *pdev)
{ … }
static void eeh_resume(struct pci_dev *pdev)
{ … }
static void eeh_reset_prepare(struct pci_dev *pdev)
{ … }
static void eeh_reset_done(struct pci_dev *pdev)
{ … }
static const struct pci_error_handlers cxgb4_eeh = …;
static inline bool is_x_10g_port(const struct link_config *lc)
{ … }
static int cfg_queues(struct adapter *adap)
{ … }
static void reduce_ethqs(struct adapter *adap, int n)
{ … }
static int alloc_msix_info(struct adapter *adap, u32 num_vec)
{ … }
static void free_msix_info(struct adapter *adap)
{ … }
int cxgb4_get_msix_idx_from_bmap(struct adapter *adap)
{ … }
void cxgb4_free_msix_idx_in_bmap(struct adapter *adap,
unsigned int msix_idx)
{ … }
#define EXTRA_VECS …
static int enable_msix(struct adapter *adap)
{ … }
#undef EXTRA_VECS
static int init_rss(struct adapter *adap)
{ … }
static void print_adapter_info(struct adapter *adapter)
{ … }
static void print_port_info(const struct net_device *dev)
{ … }
static void free_some_resources(struct adapter *adapter)
{ … }
#define TSO_FLAGS …
#define VLAN_FEAT …
#define SEGMENT_SIZE …
static int t4_get_chip_type(struct adapter *adap, int ver)
{ … }
#ifdef CONFIG_PCI_IOV
static void cxgb4_mgmt_setup(struct net_device *dev)
{ … }
static int cxgb4_iov_configure(struct pci_dev *pdev, int num_vfs)
{ … }
#endif
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE) || IS_ENABLED(CONFIG_CHELSIO_IPSEC_INLINE)
static int chcr_offload_state(struct adapter *adap,
enum cxgb4_netdev_tls_ops op_val)
{ … }
#endif
#if IS_ENABLED(CONFIG_CHELSIO_TLS_DEVICE)
static int cxgb4_ktls_dev_add(struct net_device *netdev, struct sock *sk,
enum tls_offload_ctx_dir direction,
struct tls_crypto_info *crypto_info,
u32 tcp_sn)
{ … }
static void cxgb4_ktls_dev_del(struct net_device *netdev,
struct tls_context *tls_ctx,
enum tls_offload_ctx_dir direction)
{ … }
static const struct tlsdev_ops cxgb4_ktls_ops = …;
#endif
#if IS_ENABLED(CONFIG_CHELSIO_IPSEC_INLINE)
static int cxgb4_xfrm_add_state(struct xfrm_state *x,
struct netlink_ext_ack *extack)
{ … }
static void cxgb4_xfrm_del_state(struct xfrm_state *x)
{ … }
static void cxgb4_xfrm_free_state(struct xfrm_state *x)
{ … }
static bool cxgb4_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
{ … }
static void cxgb4_advance_esn_state(struct xfrm_state *x)
{ … }
static const struct xfrmdev_ops cxgb4_xfrmdev_ops = …;
#endif
static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{ … }
static void remove_one(struct pci_dev *pdev)
{ … }
static void shutdown_one(struct pci_dev *pdev)
{ … }
static struct pci_driver cxgb4_driver = …;
static int __init cxgb4_init_module(void)
{ … }
static void __exit cxgb4_cleanup_module(void)
{ … }
module_init(…) …;
module_exit(cxgb4_cleanup_module);