mirror of
https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
synced 2025-11-01 08:38:52 +01:00
Fixed MTP to work with TWRP
This commit is contained in:
commit
f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions
8
drivers/net/ethernet/chelsio/cxgb4/Makefile
Normal file
8
drivers/net/ethernet/chelsio/cxgb4/Makefile
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#
|
||||
# Chelsio T4 driver
|
||||
#
|
||||
|
||||
obj-$(CONFIG_CHELSIO_T4) += cxgb4.o
|
||||
|
||||
cxgb4-objs := cxgb4_main.o l2t.o t4_hw.o sge.o
|
||||
cxgb4-$(CONFIG_CHELSIO_T4_DCB) += cxgb4_dcb.o
|
||||
1088
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
Normal file
1088
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
Normal file
File diff suppressed because it is too large
Load diff
1149
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
Normal file
1149
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
Normal file
File diff suppressed because it is too large
Load diff
151
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
Normal file
151
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.h
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
* Copyright (C) 2013-2014 Chelsio Communications. All rights reserved.
|
||||
*
|
||||
* Written by Anish Bhatt (anish@chelsio.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* The full GNU General Public License is included in this distribution in
|
||||
* the file called "COPYING".
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CXGB4_DCB_H
|
||||
#define __CXGB4_DCB_H
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/dcbnl.h>
|
||||
#include <net/dcbnl.h>
|
||||
|
||||
#ifdef CONFIG_CHELSIO_T4_DCB
|
||||
|
||||
#define CXGB4_DCBX_FW_SUPPORT \
|
||||
(DCB_CAP_DCBX_VER_CEE | \
|
||||
DCB_CAP_DCBX_VER_IEEE | \
|
||||
DCB_CAP_DCBX_LLD_MANAGED)
|
||||
#define CXGB4_DCBX_HOST_SUPPORT \
|
||||
(DCB_CAP_DCBX_VER_CEE | \
|
||||
DCB_CAP_DCBX_VER_IEEE | \
|
||||
DCB_CAP_DCBX_HOST)
|
||||
|
||||
#define CXGB4_MAX_PRIORITY CXGB4_MAX_DCBX_APP_SUPPORTED
|
||||
#define CXGB4_MAX_TCS CXGB4_MAX_DCBX_APP_SUPPORTED
|
||||
|
||||
#define INIT_PORT_DCB_CMD(__pcmd, __port, __op, __action) \
|
||||
do { \
|
||||
memset(&(__pcmd), 0, sizeof(__pcmd)); \
|
||||
(__pcmd).op_to_portid = \
|
||||
cpu_to_be32(FW_CMD_OP(FW_PORT_CMD) | \
|
||||
FW_CMD_REQUEST | \
|
||||
FW_CMD_##__op | \
|
||||
FW_PORT_CMD_PORTID(__port)); \
|
||||
(__pcmd).action_to_len16 = \
|
||||
cpu_to_be32(FW_PORT_CMD_ACTION(__action) | \
|
||||
FW_LEN16(pcmd)); \
|
||||
} while (0)
|
||||
|
||||
#define INIT_PORT_DCB_READ_PEER_CMD(__pcmd, __port) \
|
||||
INIT_PORT_DCB_CMD(__pcmd, __port, READ, FW_PORT_ACTION_DCB_READ_RECV)
|
||||
|
||||
#define INIT_PORT_DCB_READ_LOCAL_CMD(__pcmd, __port) \
|
||||
INIT_PORT_DCB_CMD(__pcmd, __port, READ, FW_PORT_ACTION_DCB_READ_TRANS)
|
||||
|
||||
#define INIT_PORT_DCB_READ_SYNC_CMD(__pcmd, __port) \
|
||||
INIT_PORT_DCB_CMD(__pcmd, __port, READ, FW_PORT_ACTION_DCB_READ_DET)
|
||||
|
||||
#define INIT_PORT_DCB_WRITE_CMD(__pcmd, __port) \
|
||||
INIT_PORT_DCB_CMD(__pcmd, __port, EXEC, FW_PORT_ACTION_L2_DCB_CFG)
|
||||
|
||||
#define IEEE_FAUX_SYNC(__dev, __dcb) \
|
||||
do { \
|
||||
if ((__dcb)->dcb_version == FW_PORT_DCB_VER_IEEE) \
|
||||
cxgb4_dcb_state_fsm((__dev), \
|
||||
CXGB4_DCB_STATE_FW_ALLSYNCED); \
|
||||
} while (0)
|
||||
|
||||
/* States we can be in for a port's Data Center Bridging.
|
||||
*/
|
||||
enum cxgb4_dcb_state {
|
||||
CXGB4_DCB_STATE_START, /* initial unknown state */
|
||||
CXGB4_DCB_STATE_HOST, /* we're using Host DCB (if at all) */
|
||||
CXGB4_DCB_STATE_FW_INCOMPLETE, /* using firmware DCB, incomplete */
|
||||
CXGB4_DCB_STATE_FW_ALLSYNCED, /* using firmware DCB, all sync'ed */
|
||||
};
|
||||
|
||||
/* Data Center Bridging state input for the Finite State Machine.
|
||||
*/
|
||||
enum cxgb4_dcb_state_input {
|
||||
/* Input from the firmware.
|
||||
*/
|
||||
CXGB4_DCB_INPUT_FW_DISABLED, /* firmware DCB disabled */
|
||||
CXGB4_DCB_INPUT_FW_ENABLED, /* firmware DCB enabled */
|
||||
CXGB4_DCB_INPUT_FW_INCOMPLETE, /* firmware reports incomplete DCB */
|
||||
CXGB4_DCB_INPUT_FW_ALLSYNCED, /* firmware reports all sync'ed */
|
||||
|
||||
};
|
||||
|
||||
/* Firmware DCB messages that we've received so far ...
|
||||
*/
|
||||
enum cxgb4_dcb_fw_msgs {
|
||||
CXGB4_DCB_FW_PGID = 0x01,
|
||||
CXGB4_DCB_FW_PGRATE = 0x02,
|
||||
CXGB4_DCB_FW_PRIORATE = 0x04,
|
||||
CXGB4_DCB_FW_PFC = 0x08,
|
||||
CXGB4_DCB_FW_APP_ID = 0x10,
|
||||
};
|
||||
|
||||
#define CXGB4_MAX_DCBX_APP_SUPPORTED 8
|
||||
|
||||
/* Data Center Bridging support;
|
||||
*/
|
||||
struct port_dcb_info {
|
||||
enum cxgb4_dcb_state state; /* DCB State Machine */
|
||||
enum cxgb4_dcb_fw_msgs msgs; /* DCB Firmware messages received */
|
||||
unsigned int supported; /* OS DCB capabilities supported */
|
||||
bool enabled; /* OS Enabled state */
|
||||
|
||||
/* Cached copies of DCB information sent by the firmware (in Host
|
||||
* Native Endian format).
|
||||
*/
|
||||
u32 pgid; /* Priority Group[0..7] */
|
||||
u8 dcb_version; /* Running DCBx version */
|
||||
u8 pfcen; /* Priority Flow Control[0..7] */
|
||||
u8 pg_num_tcs_supported; /* max PG Traffic Classes */
|
||||
u8 pfc_num_tcs_supported; /* max PFC Traffic Classes */
|
||||
u8 pgrate[8]; /* Priority Group Rate[0..7] */
|
||||
u8 priorate[8]; /* Priority Rate[0..7] */
|
||||
u8 tsa[8]; /* TSA Algorithm[0..7] */
|
||||
struct app_priority { /* Application Information */
|
||||
u8 user_prio_map; /* Priority Map bitfield */
|
||||
u8 sel_field; /* Protocol ID interpretation */
|
||||
u16 protocolid; /* Protocol ID */
|
||||
} app_priority[CXGB4_MAX_DCBX_APP_SUPPORTED];
|
||||
};
|
||||
|
||||
void cxgb4_dcb_state_init(struct net_device *);
|
||||
void cxgb4_dcb_version_init(struct net_device *);
|
||||
void cxgb4_dcb_state_fsm(struct net_device *, enum cxgb4_dcb_state_input);
|
||||
void cxgb4_dcb_handle_fw_update(struct adapter *, const struct fw_port_cmd *);
|
||||
void cxgb4_dcb_set_caps(struct adapter *, const struct fw_port_cmd *);
|
||||
extern const struct dcbnl_rtnl_ops cxgb4_dcb_ops;
|
||||
|
||||
#define CXGB4_DCB_ENABLED true
|
||||
|
||||
#else /* !CONFIG_CHELSIO_T4_DCB */
|
||||
|
||||
static inline void cxgb4_dcb_state_init(struct net_device *dev)
|
||||
{
|
||||
}
|
||||
|
||||
#define CXGB4_DCB_ENABLED false
|
||||
|
||||
#endif /* !CONFIG_CHELSIO_T4_DCB */
|
||||
|
||||
#endif /* __CXGB4_DCB_H */
|
||||
6902
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
Normal file
6902
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
Normal file
File diff suppressed because it is too large
Load diff
307
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
Normal file
307
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
/*
|
||||
* This file is part of the Chelsio T4 Ethernet driver for Linux.
|
||||
*
|
||||
* Copyright (c) 2003-2014 Chelsio Communications, 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 __CXGB4_OFLD_H
|
||||
#define __CXGB4_OFLD_H
|
||||
|
||||
#include <linux/cache.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/inetdevice.h>
|
||||
#include <linux/atomic.h>
|
||||
|
||||
/* CPL message priority levels */
|
||||
enum {
|
||||
CPL_PRIORITY_DATA = 0, /* data messages */
|
||||
CPL_PRIORITY_SETUP = 1, /* connection setup messages */
|
||||
CPL_PRIORITY_TEARDOWN = 0, /* connection teardown messages */
|
||||
CPL_PRIORITY_LISTEN = 1, /* listen start/stop messages */
|
||||
CPL_PRIORITY_ACK = 1, /* RX ACK messages */
|
||||
CPL_PRIORITY_CONTROL = 1 /* control messages */
|
||||
};
|
||||
|
||||
#define INIT_TP_WR(w, tid) do { \
|
||||
(w)->wr.wr_hi = htonl(FW_WR_OP(FW_TP_WR) | \
|
||||
FW_WR_IMMDLEN(sizeof(*w) - sizeof(w->wr))); \
|
||||
(w)->wr.wr_mid = htonl(FW_WR_LEN16(DIV_ROUND_UP(sizeof(*w), 16)) | \
|
||||
FW_WR_FLOWID(tid)); \
|
||||
(w)->wr.wr_lo = cpu_to_be64(0); \
|
||||
} while (0)
|
||||
|
||||
#define INIT_TP_WR_CPL(w, cpl, tid) do { \
|
||||
INIT_TP_WR(w, tid); \
|
||||
OPCODE_TID(w) = htonl(MK_OPCODE_TID(cpl, tid)); \
|
||||
} while (0)
|
||||
|
||||
#define INIT_ULPTX_WR(w, wrlen, atomic, tid) do { \
|
||||
(w)->wr.wr_hi = htonl(FW_WR_OP(FW_ULPTX_WR) | FW_WR_ATOMIC(atomic)); \
|
||||
(w)->wr.wr_mid = htonl(FW_WR_LEN16(DIV_ROUND_UP(wrlen, 16)) | \
|
||||
FW_WR_FLOWID(tid)); \
|
||||
(w)->wr.wr_lo = cpu_to_be64(0); \
|
||||
} while (0)
|
||||
|
||||
/* Special asynchronous notification message */
|
||||
#define CXGB4_MSG_AN ((void *)1)
|
||||
|
||||
struct serv_entry {
|
||||
void *data;
|
||||
};
|
||||
|
||||
union aopen_entry {
|
||||
void *data;
|
||||
union aopen_entry *next;
|
||||
};
|
||||
|
||||
/*
|
||||
* Holds the size, base address, free list start, etc of the TID, server TID,
|
||||
* and active-open TID tables. The tables themselves are allocated dynamically.
|
||||
*/
|
||||
struct tid_info {
|
||||
void **tid_tab;
|
||||
unsigned int ntids;
|
||||
|
||||
struct serv_entry *stid_tab;
|
||||
unsigned long *stid_bmap;
|
||||
unsigned int nstids;
|
||||
unsigned int stid_base;
|
||||
|
||||
union aopen_entry *atid_tab;
|
||||
unsigned int natids;
|
||||
unsigned int atid_base;
|
||||
|
||||
struct filter_entry *ftid_tab;
|
||||
unsigned int nftids;
|
||||
unsigned int ftid_base;
|
||||
unsigned int aftid_base;
|
||||
unsigned int aftid_end;
|
||||
/* Server filter region */
|
||||
unsigned int sftid_base;
|
||||
unsigned int nsftids;
|
||||
|
||||
spinlock_t atid_lock ____cacheline_aligned_in_smp;
|
||||
union aopen_entry *afree;
|
||||
unsigned int atids_in_use;
|
||||
|
||||
spinlock_t stid_lock;
|
||||
unsigned int stids_in_use;
|
||||
|
||||
atomic_t tids_in_use;
|
||||
};
|
||||
|
||||
static inline void *lookup_tid(const struct tid_info *t, unsigned int tid)
|
||||
{
|
||||
return tid < t->ntids ? t->tid_tab[tid] : NULL;
|
||||
}
|
||||
|
||||
static inline void *lookup_atid(const struct tid_info *t, unsigned int atid)
|
||||
{
|
||||
return atid < t->natids ? t->atid_tab[atid].data : NULL;
|
||||
}
|
||||
|
||||
static inline void *lookup_stid(const struct tid_info *t, unsigned int stid)
|
||||
{
|
||||
/* Is it a server filter TID? */
|
||||
if (t->nsftids && (stid >= t->sftid_base)) {
|
||||
stid -= t->sftid_base;
|
||||
stid += t->nstids;
|
||||
} else {
|
||||
stid -= t->stid_base;
|
||||
}
|
||||
|
||||
return stid < (t->nstids + t->nsftids) ? t->stid_tab[stid].data : NULL;
|
||||
}
|
||||
|
||||
static inline void cxgb4_insert_tid(struct tid_info *t, void *data,
|
||||
unsigned int tid)
|
||||
{
|
||||
t->tid_tab[tid] = data;
|
||||
atomic_inc(&t->tids_in_use);
|
||||
}
|
||||
|
||||
int cxgb4_alloc_atid(struct tid_info *t, void *data);
|
||||
int cxgb4_alloc_stid(struct tid_info *t, int family, void *data);
|
||||
int cxgb4_alloc_sftid(struct tid_info *t, int family, void *data);
|
||||
void cxgb4_free_atid(struct tid_info *t, unsigned int atid);
|
||||
void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family);
|
||||
void cxgb4_remove_tid(struct tid_info *t, unsigned int qid, unsigned int tid);
|
||||
|
||||
struct in6_addr;
|
||||
|
||||
int cxgb4_create_server(const struct net_device *dev, unsigned int stid,
|
||||
__be32 sip, __be16 sport, __be16 vlan,
|
||||
unsigned int queue);
|
||||
int cxgb4_create_server6(const struct net_device *dev, unsigned int stid,
|
||||
const struct in6_addr *sip, __be16 sport,
|
||||
unsigned int queue);
|
||||
int cxgb4_remove_server(const struct net_device *dev, unsigned int stid,
|
||||
unsigned int queue, bool ipv6);
|
||||
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);
|
||||
int cxgb4_remove_server_filter(const struct net_device *dev, unsigned int stid,
|
||||
unsigned int queue, bool ipv6);
|
||||
int cxgb4_clip_get(const struct net_device *dev, const struct in6_addr *lip);
|
||||
int cxgb4_clip_release(const struct net_device *dev,
|
||||
const struct in6_addr *lip);
|
||||
|
||||
static inline void set_wr_txq(struct sk_buff *skb, int prio, int queue)
|
||||
{
|
||||
skb_set_queue_mapping(skb, (queue << 1) | prio);
|
||||
}
|
||||
|
||||
enum cxgb4_uld {
|
||||
CXGB4_ULD_RDMA,
|
||||
CXGB4_ULD_ISCSI,
|
||||
CXGB4_ULD_MAX
|
||||
};
|
||||
|
||||
enum cxgb4_state {
|
||||
CXGB4_STATE_UP,
|
||||
CXGB4_STATE_START_RECOVERY,
|
||||
CXGB4_STATE_DOWN,
|
||||
CXGB4_STATE_DETACH
|
||||
};
|
||||
|
||||
enum cxgb4_control {
|
||||
CXGB4_CONTROL_DB_FULL,
|
||||
CXGB4_CONTROL_DB_EMPTY,
|
||||
CXGB4_CONTROL_DB_DROP,
|
||||
};
|
||||
|
||||
struct pci_dev;
|
||||
struct l2t_data;
|
||||
struct net_device;
|
||||
struct pkt_gl;
|
||||
struct tp_tcp_stats;
|
||||
|
||||
struct cxgb4_range {
|
||||
unsigned int start;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
struct cxgb4_virt_res { /* virtualized HW resources */
|
||||
struct cxgb4_range ddp;
|
||||
struct cxgb4_range iscsi;
|
||||
struct cxgb4_range stag;
|
||||
struct cxgb4_range rq;
|
||||
struct cxgb4_range pbl;
|
||||
struct cxgb4_range qp;
|
||||
struct cxgb4_range cq;
|
||||
struct cxgb4_range ocq;
|
||||
};
|
||||
|
||||
#define OCQ_WIN_OFFSET(pdev, vres) \
|
||||
(pci_resource_len((pdev), 2) - roundup_pow_of_two((vres)->ocq.size))
|
||||
|
||||
/*
|
||||
* Block of information the LLD provides to ULDs attaching to a device.
|
||||
*/
|
||||
struct cxgb4_lld_info {
|
||||
struct pci_dev *pdev; /* associated PCI device */
|
||||
struct l2t_data *l2t; /* L2 table */
|
||||
struct tid_info *tids; /* TID table */
|
||||
struct net_device **ports; /* device ports */
|
||||
const struct cxgb4_virt_res *vr; /* assorted HW resources */
|
||||
const unsigned short *mtus; /* MTU table */
|
||||
const unsigned short *rxq_ids; /* the ULD's Rx queue ids */
|
||||
const unsigned short *ciq_ids; /* the ULD's concentrator IQ ids */
|
||||
unsigned short nrxq; /* # of Rx queues */
|
||||
unsigned short ntxq; /* # of Tx queues */
|
||||
unsigned short nciq; /* # of concentrator IQ */
|
||||
unsigned char nchan:4; /* # of channels */
|
||||
unsigned char nports:4; /* # of ports */
|
||||
unsigned char wr_cred; /* WR 16-byte credits */
|
||||
unsigned char adapter_type; /* type of adapter */
|
||||
unsigned char fw_api_ver; /* FW API version */
|
||||
unsigned int fw_vers; /* FW version */
|
||||
unsigned int iscsi_iolen; /* iSCSI max I/O length */
|
||||
unsigned int cclk_ps; /* Core clock period in psec */
|
||||
unsigned short udb_density; /* # of user DB/page */
|
||||
unsigned short ucq_density; /* # of user CQs/page */
|
||||
unsigned short filt_mode; /* filter optional components */
|
||||
unsigned short tx_modq[NCHAN]; /* maps each tx channel to a */
|
||||
/* scheduler queue */
|
||||
void __iomem *gts_reg; /* address of GTS register */
|
||||
void __iomem *db_reg; /* address of kernel doorbell */
|
||||
int dbfifo_int_thresh; /* doorbell fifo int threshold */
|
||||
unsigned int sge_ingpadboundary; /* SGE ingress padding boundary */
|
||||
unsigned int sge_egrstatuspagesize; /* SGE egress status page size */
|
||||
unsigned int sge_pktshift; /* Padding between CPL and */
|
||||
/* packet data */
|
||||
unsigned int pf; /* Physical Function we're using */
|
||||
bool enable_fw_ofld_conn; /* Enable connection through fw */
|
||||
/* WR */
|
||||
unsigned int max_ordird_qp; /* Max ORD/IRD depth per RDMA QP */
|
||||
unsigned int max_ird_adapter; /* Max IRD memory per adapter */
|
||||
bool ulptx_memwrite_dsgl; /* use of T5 DSGL allowed */
|
||||
};
|
||||
|
||||
struct cxgb4_uld_info {
|
||||
const char *name;
|
||||
void *(*add)(const struct cxgb4_lld_info *p);
|
||||
int (*rx_handler)(void *handle, const __be64 *rsp,
|
||||
const struct pkt_gl *gl);
|
||||
int (*state_change)(void *handle, enum cxgb4_state new_state);
|
||||
int (*control)(void *handle, enum cxgb4_control control, ...);
|
||||
};
|
||||
|
||||
int cxgb4_register_uld(enum cxgb4_uld type, const struct cxgb4_uld_info *p);
|
||||
int cxgb4_unregister_uld(enum cxgb4_uld type);
|
||||
int cxgb4_ofld_send(struct net_device *dev, struct sk_buff *skb);
|
||||
unsigned int cxgb4_dbfifo_count(const struct net_device *dev, int lpfifo);
|
||||
unsigned int cxgb4_port_chan(const struct net_device *dev);
|
||||
unsigned int cxgb4_port_viid(const struct net_device *dev);
|
||||
unsigned int cxgb4_port_idx(const struct net_device *dev);
|
||||
unsigned int cxgb4_best_mtu(const unsigned short *mtus, unsigned short mtu,
|
||||
unsigned int *idx);
|
||||
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);
|
||||
void cxgb4_get_tcp_stats(struct pci_dev *pdev, struct tp_tcp_stats *v4,
|
||||
struct tp_tcp_stats *v6);
|
||||
void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask,
|
||||
const unsigned int *pgsz_order);
|
||||
struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl,
|
||||
unsigned int skb_len, unsigned int pull_len);
|
||||
int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx, u16 size);
|
||||
int cxgb4_flush_eq_cache(struct net_device *dev);
|
||||
void cxgb4_disable_db_coalescing(struct net_device *dev);
|
||||
void cxgb4_enable_db_coalescing(struct net_device *dev);
|
||||
int cxgb4_read_tpte(struct net_device *dev, u32 stag, __be32 *tpte);
|
||||
u64 cxgb4_read_sge_timestamp(struct net_device *dev);
|
||||
|
||||
#endif /* !__CXGB4_OFLD_H */
|
||||
665
drivers/net/ethernet/chelsio/cxgb4/l2t.c
Normal file
665
drivers/net/ethernet/chelsio/cxgb4/l2t.c
Normal file
|
|
@ -0,0 +1,665 @@
|
|||
/*
|
||||
* This file is part of the Chelsio T4 Ethernet driver for Linux.
|
||||
*
|
||||
* Copyright (c) 2003-2014 Chelsio Communications, 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.
|
||||
*/
|
||||
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/jhash.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <net/neighbour.h>
|
||||
#include "cxgb4.h"
|
||||
#include "l2t.h"
|
||||
#include "t4_msg.h"
|
||||
#include "t4fw_api.h"
|
||||
#include "t4_regs.h"
|
||||
|
||||
#define VLAN_NONE 0xfff
|
||||
|
||||
/* identifies sync vs async L2T_WRITE_REQs */
|
||||
#define F_SYNC_WR (1 << 12)
|
||||
|
||||
enum {
|
||||
L2T_STATE_VALID, /* entry is up to date */
|
||||
L2T_STATE_STALE, /* entry may be used but needs revalidation */
|
||||
L2T_STATE_RESOLVING, /* entry needs address resolution */
|
||||
L2T_STATE_SYNC_WRITE, /* synchronous write of entry underway */
|
||||
|
||||
/* when state is one of the below the entry is not hashed */
|
||||
L2T_STATE_SWITCHING, /* entry is being used by a switching filter */
|
||||
L2T_STATE_UNUSED /* entry not in use */
|
||||
};
|
||||
|
||||
struct l2t_data {
|
||||
rwlock_t lock;
|
||||
atomic_t nfree; /* number of free entries */
|
||||
struct l2t_entry *rover; /* starting point for next allocation */
|
||||
struct l2t_entry l2tab[L2T_SIZE];
|
||||
};
|
||||
|
||||
static inline unsigned int vlan_prio(const struct l2t_entry *e)
|
||||
{
|
||||
return e->vlan >> 13;
|
||||
}
|
||||
|
||||
static inline void l2t_hold(struct l2t_data *d, struct l2t_entry *e)
|
||||
{
|
||||
if (atomic_add_return(1, &e->refcnt) == 1) /* 0 -> 1 transition */
|
||||
atomic_dec(&d->nfree);
|
||||
}
|
||||
|
||||
/*
|
||||
* To avoid having to check address families we do not allow v4 and v6
|
||||
* neighbors to be on the same hash chain. We keep v4 entries in the first
|
||||
* half of available hash buckets and v6 in the second.
|
||||
*/
|
||||
enum {
|
||||
L2T_SZ_HALF = L2T_SIZE / 2,
|
||||
L2T_HASH_MASK = L2T_SZ_HALF - 1
|
||||
};
|
||||
|
||||
static inline unsigned int arp_hash(const u32 *key, int ifindex)
|
||||
{
|
||||
return jhash_2words(*key, ifindex, 0) & L2T_HASH_MASK;
|
||||
}
|
||||
|
||||
static inline unsigned int ipv6_hash(const u32 *key, int ifindex)
|
||||
{
|
||||
u32 xor = key[0] ^ key[1] ^ key[2] ^ key[3];
|
||||
|
||||
return L2T_SZ_HALF + (jhash_2words(xor, ifindex, 0) & L2T_HASH_MASK);
|
||||
}
|
||||
|
||||
static unsigned int addr_hash(const u32 *addr, int addr_len, int ifindex)
|
||||
{
|
||||
return addr_len == 4 ? arp_hash(addr, ifindex) :
|
||||
ipv6_hash(addr, ifindex);
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if an L2T entry is for the given IP/IPv6 address. It does not check
|
||||
* whether the L2T entry and the address are of the same address family.
|
||||
* Callers ensure an address is only checked against L2T entries of the same
|
||||
* family, something made trivial by the separation of IP and IPv6 hash chains
|
||||
* mentioned above. Returns 0 if there's a match,
|
||||
*/
|
||||
static int addreq(const struct l2t_entry *e, const u32 *addr)
|
||||
{
|
||||
if (e->v6)
|
||||
return (e->addr[0] ^ addr[0]) | (e->addr[1] ^ addr[1]) |
|
||||
(e->addr[2] ^ addr[2]) | (e->addr[3] ^ addr[3]);
|
||||
return e->addr[0] ^ addr[0];
|
||||
}
|
||||
|
||||
static void neigh_replace(struct l2t_entry *e, struct neighbour *n)
|
||||
{
|
||||
neigh_hold(n);
|
||||
if (e->neigh)
|
||||
neigh_release(e->neigh);
|
||||
e->neigh = n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write an L2T entry. Must be called with the entry locked.
|
||||
* The write may be synchronous or asynchronous.
|
||||
*/
|
||||
static int write_l2e(struct adapter *adap, struct l2t_entry *e, int sync)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct cpl_l2t_write_req *req;
|
||||
|
||||
skb = alloc_skb(sizeof(*req), GFP_ATOMIC);
|
||||
if (!skb)
|
||||
return -ENOMEM;
|
||||
|
||||
req = (struct cpl_l2t_write_req *)__skb_put(skb, sizeof(*req));
|
||||
INIT_TP_WR(req, 0);
|
||||
|
||||
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ,
|
||||
e->idx | (sync ? F_SYNC_WR : 0) |
|
||||
TID_QID(adap->sge.fw_evtq.abs_id)));
|
||||
req->params = htons(L2T_W_PORT(e->lport) | L2T_W_NOREPLY(!sync));
|
||||
req->l2t_idx = htons(e->idx);
|
||||
req->vlan = htons(e->vlan);
|
||||
if (e->neigh && !(e->neigh->dev->flags & IFF_LOOPBACK))
|
||||
memcpy(e->dmac, e->neigh->ha, sizeof(e->dmac));
|
||||
memcpy(req->dst_mac, e->dmac, sizeof(req->dst_mac));
|
||||
|
||||
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
|
||||
t4_ofld_send(adap, skb);
|
||||
|
||||
if (sync && e->state != L2T_STATE_SWITCHING)
|
||||
e->state = L2T_STATE_SYNC_WRITE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send packets waiting in an L2T entry's ARP queue. Must be called with the
|
||||
* entry locked.
|
||||
*/
|
||||
static void send_pending(struct adapter *adap, struct l2t_entry *e)
|
||||
{
|
||||
while (e->arpq_head) {
|
||||
struct sk_buff *skb = e->arpq_head;
|
||||
|
||||
e->arpq_head = skb->next;
|
||||
skb->next = NULL;
|
||||
t4_ofld_send(adap, skb);
|
||||
}
|
||||
e->arpq_tail = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Process a CPL_L2T_WRITE_RPL. Wake up the ARP queue if it completes a
|
||||
* synchronous L2T_WRITE. Note that the TID in the reply is really the L2T
|
||||
* index it refers to.
|
||||
*/
|
||||
void do_l2t_write_rpl(struct adapter *adap, const struct cpl_l2t_write_rpl *rpl)
|
||||
{
|
||||
unsigned int tid = GET_TID(rpl);
|
||||
unsigned int idx = tid & (L2T_SIZE - 1);
|
||||
|
||||
if (unlikely(rpl->status != CPL_ERR_NONE)) {
|
||||
dev_err(adap->pdev_dev,
|
||||
"Unexpected L2T_WRITE_RPL status %u for entry %u\n",
|
||||
rpl->status, idx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tid & F_SYNC_WR) {
|
||||
struct l2t_entry *e = &adap->l2t->l2tab[idx];
|
||||
|
||||
spin_lock(&e->lock);
|
||||
if (e->state != L2T_STATE_SWITCHING) {
|
||||
send_pending(adap, e);
|
||||
e->state = (e->neigh->nud_state & NUD_STALE) ?
|
||||
L2T_STATE_STALE : L2T_STATE_VALID;
|
||||
}
|
||||
spin_unlock(&e->lock);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a packet to an L2T entry's queue of packets awaiting resolution.
|
||||
* Must be called with the entry's lock held.
|
||||
*/
|
||||
static inline void arpq_enqueue(struct l2t_entry *e, struct sk_buff *skb)
|
||||
{
|
||||
skb->next = NULL;
|
||||
if (e->arpq_head)
|
||||
e->arpq_tail->next = skb;
|
||||
else
|
||||
e->arpq_head = skb;
|
||||
e->arpq_tail = skb;
|
||||
}
|
||||
|
||||
int cxgb4_l2t_send(struct net_device *dev, struct sk_buff *skb,
|
||||
struct l2t_entry *e)
|
||||
{
|
||||
struct adapter *adap = netdev2adap(dev);
|
||||
|
||||
again:
|
||||
switch (e->state) {
|
||||
case L2T_STATE_STALE: /* entry is stale, kick off revalidation */
|
||||
neigh_event_send(e->neigh, NULL);
|
||||
spin_lock_bh(&e->lock);
|
||||
if (e->state == L2T_STATE_STALE)
|
||||
e->state = L2T_STATE_VALID;
|
||||
spin_unlock_bh(&e->lock);
|
||||
case L2T_STATE_VALID: /* fast-path, send the packet on */
|
||||
return t4_ofld_send(adap, skb);
|
||||
case L2T_STATE_RESOLVING:
|
||||
case L2T_STATE_SYNC_WRITE:
|
||||
spin_lock_bh(&e->lock);
|
||||
if (e->state != L2T_STATE_SYNC_WRITE &&
|
||||
e->state != L2T_STATE_RESOLVING) {
|
||||
spin_unlock_bh(&e->lock);
|
||||
goto again;
|
||||
}
|
||||
arpq_enqueue(e, skb);
|
||||
spin_unlock_bh(&e->lock);
|
||||
|
||||
if (e->state == L2T_STATE_RESOLVING &&
|
||||
!neigh_event_send(e->neigh, NULL)) {
|
||||
spin_lock_bh(&e->lock);
|
||||
if (e->state == L2T_STATE_RESOLVING && e->arpq_head)
|
||||
write_l2e(adap, e, 1);
|
||||
spin_unlock_bh(&e->lock);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(cxgb4_l2t_send);
|
||||
|
||||
/*
|
||||
* Allocate a free L2T entry. Must be called with l2t_data.lock held.
|
||||
*/
|
||||
static struct l2t_entry *alloc_l2e(struct l2t_data *d)
|
||||
{
|
||||
struct l2t_entry *end, *e, **p;
|
||||
|
||||
if (!atomic_read(&d->nfree))
|
||||
return NULL;
|
||||
|
||||
/* there's definitely a free entry */
|
||||
for (e = d->rover, end = &d->l2tab[L2T_SIZE]; e != end; ++e)
|
||||
if (atomic_read(&e->refcnt) == 0)
|
||||
goto found;
|
||||
|
||||
for (e = d->l2tab; atomic_read(&e->refcnt); ++e)
|
||||
;
|
||||
found:
|
||||
d->rover = e + 1;
|
||||
atomic_dec(&d->nfree);
|
||||
|
||||
/*
|
||||
* The entry we found may be an inactive entry that is
|
||||
* presently in the hash table. We need to remove it.
|
||||
*/
|
||||
if (e->state < L2T_STATE_SWITCHING)
|
||||
for (p = &d->l2tab[e->hash].first; *p; p = &(*p)->next)
|
||||
if (*p == e) {
|
||||
*p = e->next;
|
||||
e->next = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
e->state = L2T_STATE_UNUSED;
|
||||
return e;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when an L2T entry has no more users.
|
||||
*/
|
||||
static void t4_l2e_free(struct l2t_entry *e)
|
||||
{
|
||||
struct l2t_data *d;
|
||||
|
||||
spin_lock_bh(&e->lock);
|
||||
if (atomic_read(&e->refcnt) == 0) { /* hasn't been recycled */
|
||||
if (e->neigh) {
|
||||
neigh_release(e->neigh);
|
||||
e->neigh = NULL;
|
||||
}
|
||||
while (e->arpq_head) {
|
||||
struct sk_buff *skb = e->arpq_head;
|
||||
|
||||
e->arpq_head = skb->next;
|
||||
kfree_skb(skb);
|
||||
}
|
||||
e->arpq_tail = NULL;
|
||||
}
|
||||
spin_unlock_bh(&e->lock);
|
||||
|
||||
d = container_of(e, struct l2t_data, l2tab[e->idx]);
|
||||
atomic_inc(&d->nfree);
|
||||
}
|
||||
|
||||
void cxgb4_l2t_release(struct l2t_entry *e)
|
||||
{
|
||||
if (atomic_dec_and_test(&e->refcnt))
|
||||
t4_l2e_free(e);
|
||||
}
|
||||
EXPORT_SYMBOL(cxgb4_l2t_release);
|
||||
|
||||
/*
|
||||
* Update an L2T entry that was previously used for the same next hop as neigh.
|
||||
* Must be called with softirqs disabled.
|
||||
*/
|
||||
static void reuse_entry(struct l2t_entry *e, struct neighbour *neigh)
|
||||
{
|
||||
unsigned int nud_state;
|
||||
|
||||
spin_lock(&e->lock); /* avoid race with t4_l2t_free */
|
||||
if (neigh != e->neigh)
|
||||
neigh_replace(e, neigh);
|
||||
nud_state = neigh->nud_state;
|
||||
if (memcmp(e->dmac, neigh->ha, sizeof(e->dmac)) ||
|
||||
!(nud_state & NUD_VALID))
|
||||
e->state = L2T_STATE_RESOLVING;
|
||||
else if (nud_state & NUD_CONNECTED)
|
||||
e->state = L2T_STATE_VALID;
|
||||
else
|
||||
e->state = L2T_STATE_STALE;
|
||||
spin_unlock(&e->lock);
|
||||
}
|
||||
|
||||
struct l2t_entry *cxgb4_l2t_get(struct l2t_data *d, struct neighbour *neigh,
|
||||
const struct net_device *physdev,
|
||||
unsigned int priority)
|
||||
{
|
||||
u8 lport;
|
||||
u16 vlan;
|
||||
struct l2t_entry *e;
|
||||
int addr_len = neigh->tbl->key_len;
|
||||
u32 *addr = (u32 *)neigh->primary_key;
|
||||
int ifidx = neigh->dev->ifindex;
|
||||
int hash = addr_hash(addr, addr_len, ifidx);
|
||||
|
||||
if (neigh->dev->flags & IFF_LOOPBACK)
|
||||
lport = netdev2pinfo(physdev)->tx_chan + 4;
|
||||
else
|
||||
lport = netdev2pinfo(physdev)->lport;
|
||||
|
||||
if (neigh->dev->priv_flags & IFF_802_1Q_VLAN)
|
||||
vlan = vlan_dev_vlan_id(neigh->dev);
|
||||
else
|
||||
vlan = VLAN_NONE;
|
||||
|
||||
write_lock_bh(&d->lock);
|
||||
for (e = d->l2tab[hash].first; e; e = e->next)
|
||||
if (!addreq(e, addr) && e->ifindex == ifidx &&
|
||||
e->vlan == vlan && e->lport == lport) {
|
||||
l2t_hold(d, e);
|
||||
if (atomic_read(&e->refcnt) == 1)
|
||||
reuse_entry(e, neigh);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Need to allocate a new entry */
|
||||
e = alloc_l2e(d);
|
||||
if (e) {
|
||||
spin_lock(&e->lock); /* avoid race with t4_l2t_free */
|
||||
e->state = L2T_STATE_RESOLVING;
|
||||
if (neigh->dev->flags & IFF_LOOPBACK)
|
||||
memcpy(e->dmac, physdev->dev_addr, sizeof(e->dmac));
|
||||
memcpy(e->addr, addr, addr_len);
|
||||
e->ifindex = ifidx;
|
||||
e->hash = hash;
|
||||
e->lport = lport;
|
||||
e->v6 = addr_len == 16;
|
||||
atomic_set(&e->refcnt, 1);
|
||||
neigh_replace(e, neigh);
|
||||
e->vlan = vlan;
|
||||
e->next = d->l2tab[hash].first;
|
||||
d->l2tab[hash].first = e;
|
||||
spin_unlock(&e->lock);
|
||||
}
|
||||
done:
|
||||
write_unlock_bh(&d->lock);
|
||||
return e;
|
||||
}
|
||||
EXPORT_SYMBOL(cxgb4_l2t_get);
|
||||
|
||||
u64 cxgb4_select_ntuple(struct net_device *dev,
|
||||
const struct l2t_entry *l2t)
|
||||
{
|
||||
struct adapter *adap = netdev2adap(dev);
|
||||
struct tp_params *tp = &adap->params.tp;
|
||||
u64 ntuple = 0;
|
||||
|
||||
/* Initialize each of the fields which we care about which are present
|
||||
* in the Compressed Filter Tuple.
|
||||
*/
|
||||
if (tp->vlan_shift >= 0 && l2t->vlan != VLAN_NONE)
|
||||
ntuple |= (u64)(F_FT_VLAN_VLD | l2t->vlan) << tp->vlan_shift;
|
||||
|
||||
if (tp->port_shift >= 0)
|
||||
ntuple |= (u64)l2t->lport << tp->port_shift;
|
||||
|
||||
if (tp->protocol_shift >= 0)
|
||||
ntuple |= (u64)IPPROTO_TCP << tp->protocol_shift;
|
||||
|
||||
if (tp->vnic_shift >= 0) {
|
||||
u32 viid = cxgb4_port_viid(dev);
|
||||
u32 vf = FW_VIID_VIN_GET(viid);
|
||||
u32 pf = FW_VIID_PFN_GET(viid);
|
||||
u32 vld = FW_VIID_VIVLD_GET(viid);
|
||||
|
||||
ntuple |= (u64)(V_FT_VNID_ID_VF(vf) |
|
||||
V_FT_VNID_ID_PF(pf) |
|
||||
V_FT_VNID_ID_VLD(vld)) << tp->vnic_shift;
|
||||
}
|
||||
|
||||
return ntuple;
|
||||
}
|
||||
EXPORT_SYMBOL(cxgb4_select_ntuple);
|
||||
|
||||
/*
|
||||
* Called when address resolution fails for an L2T entry to handle packets
|
||||
* on the arpq head. If a packet specifies a failure handler it is invoked,
|
||||
* otherwise the packet is sent to the device.
|
||||
*/
|
||||
static void handle_failed_resolution(struct adapter *adap, struct sk_buff *arpq)
|
||||
{
|
||||
while (arpq) {
|
||||
struct sk_buff *skb = arpq;
|
||||
const struct l2t_skb_cb *cb = L2T_SKB_CB(skb);
|
||||
|
||||
arpq = skb->next;
|
||||
skb->next = NULL;
|
||||
if (cb->arp_err_handler)
|
||||
cb->arp_err_handler(cb->handle, skb);
|
||||
else
|
||||
t4_ofld_send(adap, skb);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Called when the host's neighbor layer makes a change to some entry that is
|
||||
* loaded into the HW L2 table.
|
||||
*/
|
||||
void t4_l2t_update(struct adapter *adap, struct neighbour *neigh)
|
||||
{
|
||||
struct l2t_entry *e;
|
||||
struct sk_buff *arpq = NULL;
|
||||
struct l2t_data *d = adap->l2t;
|
||||
int addr_len = neigh->tbl->key_len;
|
||||
u32 *addr = (u32 *) neigh->primary_key;
|
||||
int ifidx = neigh->dev->ifindex;
|
||||
int hash = addr_hash(addr, addr_len, ifidx);
|
||||
|
||||
read_lock_bh(&d->lock);
|
||||
for (e = d->l2tab[hash].first; e; e = e->next)
|
||||
if (!addreq(e, addr) && e->ifindex == ifidx) {
|
||||
spin_lock(&e->lock);
|
||||
if (atomic_read(&e->refcnt))
|
||||
goto found;
|
||||
spin_unlock(&e->lock);
|
||||
break;
|
||||
}
|
||||
read_unlock_bh(&d->lock);
|
||||
return;
|
||||
|
||||
found:
|
||||
read_unlock(&d->lock);
|
||||
|
||||
if (neigh != e->neigh)
|
||||
neigh_replace(e, neigh);
|
||||
|
||||
if (e->state == L2T_STATE_RESOLVING) {
|
||||
if (neigh->nud_state & NUD_FAILED) {
|
||||
arpq = e->arpq_head;
|
||||
e->arpq_head = e->arpq_tail = NULL;
|
||||
} else if ((neigh->nud_state & (NUD_CONNECTED | NUD_STALE)) &&
|
||||
e->arpq_head) {
|
||||
write_l2e(adap, e, 1);
|
||||
}
|
||||
} else {
|
||||
e->state = neigh->nud_state & NUD_CONNECTED ?
|
||||
L2T_STATE_VALID : L2T_STATE_STALE;
|
||||
if (memcmp(e->dmac, neigh->ha, sizeof(e->dmac)))
|
||||
write_l2e(adap, e, 0);
|
||||
}
|
||||
|
||||
spin_unlock_bh(&e->lock);
|
||||
|
||||
if (arpq)
|
||||
handle_failed_resolution(adap, arpq);
|
||||
}
|
||||
|
||||
/* Allocate an L2T entry for use by a switching rule. Such need to be
|
||||
* explicitly freed and while busy they are not on any hash chain, so normal
|
||||
* address resolution updates do not see them.
|
||||
*/
|
||||
struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d)
|
||||
{
|
||||
struct l2t_entry *e;
|
||||
|
||||
write_lock_bh(&d->lock);
|
||||
e = alloc_l2e(d);
|
||||
if (e) {
|
||||
spin_lock(&e->lock); /* avoid race with t4_l2t_free */
|
||||
e->state = L2T_STATE_SWITCHING;
|
||||
atomic_set(&e->refcnt, 1);
|
||||
spin_unlock(&e->lock);
|
||||
}
|
||||
write_unlock_bh(&d->lock);
|
||||
return e;
|
||||
}
|
||||
|
||||
/* Sets/updates the contents of a switching L2T entry that has been allocated
|
||||
* with an earlier call to @t4_l2t_alloc_switching.
|
||||
*/
|
||||
int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan,
|
||||
u8 port, u8 *eth_addr)
|
||||
{
|
||||
e->vlan = vlan;
|
||||
e->lport = port;
|
||||
memcpy(e->dmac, eth_addr, ETH_ALEN);
|
||||
return write_l2e(adap, e, 0);
|
||||
}
|
||||
|
||||
struct l2t_data *t4_init_l2t(void)
|
||||
{
|
||||
int i;
|
||||
struct l2t_data *d;
|
||||
|
||||
d = t4_alloc_mem(sizeof(*d));
|
||||
if (!d)
|
||||
return NULL;
|
||||
|
||||
d->rover = d->l2tab;
|
||||
atomic_set(&d->nfree, L2T_SIZE);
|
||||
rwlock_init(&d->lock);
|
||||
|
||||
for (i = 0; i < L2T_SIZE; ++i) {
|
||||
d->l2tab[i].idx = i;
|
||||
d->l2tab[i].state = L2T_STATE_UNUSED;
|
||||
spin_lock_init(&d->l2tab[i].lock);
|
||||
atomic_set(&d->l2tab[i].refcnt, 0);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
static inline void *l2t_get_idx(struct seq_file *seq, loff_t pos)
|
||||
{
|
||||
struct l2t_entry *l2tab = seq->private;
|
||||
|
||||
return pos >= L2T_SIZE ? NULL : &l2tab[pos];
|
||||
}
|
||||
|
||||
static void *l2t_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
{
|
||||
return *pos ? l2t_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
|
||||
}
|
||||
|
||||
static void *l2t_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
{
|
||||
v = l2t_get_idx(seq, *pos);
|
||||
if (v)
|
||||
++*pos;
|
||||
return v;
|
||||
}
|
||||
|
||||
static void l2t_seq_stop(struct seq_file *seq, void *v)
|
||||
{
|
||||
}
|
||||
|
||||
static char l2e_state(const struct l2t_entry *e)
|
||||
{
|
||||
switch (e->state) {
|
||||
case L2T_STATE_VALID: return 'V';
|
||||
case L2T_STATE_STALE: return 'S';
|
||||
case L2T_STATE_SYNC_WRITE: return 'W';
|
||||
case L2T_STATE_RESOLVING: return e->arpq_head ? 'A' : 'R';
|
||||
case L2T_STATE_SWITCHING: return 'X';
|
||||
default:
|
||||
return 'U';
|
||||
}
|
||||
}
|
||||
|
||||
static int l2t_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
if (v == SEQ_START_TOKEN)
|
||||
seq_puts(seq, " Idx IP address "
|
||||
"Ethernet address VLAN/P LP State Users Port\n");
|
||||
else {
|
||||
char ip[60];
|
||||
struct l2t_entry *e = v;
|
||||
|
||||
spin_lock_bh(&e->lock);
|
||||
if (e->state == L2T_STATE_SWITCHING)
|
||||
ip[0] = '\0';
|
||||
else
|
||||
sprintf(ip, e->v6 ? "%pI6c" : "%pI4", e->addr);
|
||||
seq_printf(seq, "%4u %-25s %17pM %4d %u %2u %c %5u %s\n",
|
||||
e->idx, ip, e->dmac,
|
||||
e->vlan & VLAN_VID_MASK, vlan_prio(e), e->lport,
|
||||
l2e_state(e), atomic_read(&e->refcnt),
|
||||
e->neigh ? e->neigh->dev->name : "");
|
||||
spin_unlock_bh(&e->lock);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct seq_operations l2t_seq_ops = {
|
||||
.start = l2t_seq_start,
|
||||
.next = l2t_seq_next,
|
||||
.stop = l2t_seq_stop,
|
||||
.show = l2t_seq_show
|
||||
};
|
||||
|
||||
static int l2t_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int rc = seq_open(file, &l2t_seq_ops);
|
||||
|
||||
if (!rc) {
|
||||
struct adapter *adap = inode->i_private;
|
||||
struct seq_file *seq = file->private_data;
|
||||
|
||||
seq->private = adap->l2t->l2tab;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
const struct file_operations t4_l2t_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = l2t_seq_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
111
drivers/net/ethernet/chelsio/cxgb4/l2t.h
Normal file
111
drivers/net/ethernet/chelsio/cxgb4/l2t.h
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* This file is part of the Chelsio T4 Ethernet driver for Linux.
|
||||
*
|
||||
* Copyright (c) 2003-2014 Chelsio Communications, 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 __CXGB4_L2T_H
|
||||
#define __CXGB4_L2T_H
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/atomic.h>
|
||||
|
||||
struct adapter;
|
||||
struct l2t_data;
|
||||
struct neighbour;
|
||||
struct net_device;
|
||||
struct file_operations;
|
||||
struct cpl_l2t_write_rpl;
|
||||
|
||||
/*
|
||||
* Each L2T entry plays multiple roles. First of all, it keeps state for the
|
||||
* corresponding entry of the HW L2 table and maintains a queue of offload
|
||||
* packets awaiting address resolution. Second, it is a node of a hash table
|
||||
* chain, where the nodes of the chain are linked together through their next
|
||||
* pointer. Finally, each node is a bucket of a hash table, pointing to the
|
||||
* first element in its chain through its first pointer.
|
||||
*/
|
||||
struct l2t_entry {
|
||||
u16 state; /* entry state */
|
||||
u16 idx; /* entry index */
|
||||
u32 addr[4]; /* next hop IP or IPv6 address */
|
||||
int ifindex; /* neighbor's net_device's ifindex */
|
||||
struct neighbour *neigh; /* associated neighbour */
|
||||
struct l2t_entry *first; /* start of hash chain */
|
||||
struct l2t_entry *next; /* next l2t_entry on chain */
|
||||
struct sk_buff *arpq_head; /* queue of packets awaiting resolution */
|
||||
struct sk_buff *arpq_tail;
|
||||
spinlock_t lock;
|
||||
atomic_t refcnt; /* entry reference count */
|
||||
u16 hash; /* hash bucket the entry is on */
|
||||
u16 vlan; /* VLAN TCI (id: bits 0-11, prio: 13-15 */
|
||||
u8 v6; /* whether entry is for IPv6 */
|
||||
u8 lport; /* associated offload logical interface */
|
||||
u8 dmac[ETH_ALEN]; /* neighbour's MAC address */
|
||||
};
|
||||
|
||||
typedef void (*arp_err_handler_t)(void *handle, struct sk_buff *skb);
|
||||
|
||||
/*
|
||||
* Callback stored in an skb to handle address resolution failure.
|
||||
*/
|
||||
struct l2t_skb_cb {
|
||||
void *handle;
|
||||
arp_err_handler_t arp_err_handler;
|
||||
};
|
||||
|
||||
#define L2T_SKB_CB(skb) ((struct l2t_skb_cb *)(skb)->cb)
|
||||
|
||||
static inline void t4_set_arp_err_handler(struct sk_buff *skb, void *handle,
|
||||
arp_err_handler_t handler)
|
||||
{
|
||||
L2T_SKB_CB(skb)->handle = handle;
|
||||
L2T_SKB_CB(skb)->arp_err_handler = handler;
|
||||
}
|
||||
|
||||
void cxgb4_l2t_release(struct l2t_entry *e);
|
||||
int cxgb4_l2t_send(struct net_device *dev, struct sk_buff *skb,
|
||||
struct l2t_entry *e);
|
||||
struct l2t_entry *cxgb4_l2t_get(struct l2t_data *d, struct neighbour *neigh,
|
||||
const struct net_device *physdev,
|
||||
unsigned int priority);
|
||||
u64 cxgb4_select_ntuple(struct net_device *dev,
|
||||
const struct l2t_entry *l2t);
|
||||
void t4_l2t_update(struct adapter *adap, struct neighbour *neigh);
|
||||
struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d);
|
||||
int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan,
|
||||
u8 port, u8 *eth_addr);
|
||||
struct l2t_data *t4_init_l2t(void);
|
||||
void do_l2t_write_rpl(struct adapter *p, const struct cpl_l2t_write_rpl *rpl);
|
||||
|
||||
extern const struct file_operations t4_l2t_fops;
|
||||
#endif /* __CXGB4_L2T_H */
|
||||
2988
drivers/net/ethernet/chelsio/cxgb4/sge.c
Normal file
2988
drivers/net/ethernet/chelsio/cxgb4/sge.c
Normal file
File diff suppressed because it is too large
Load diff
4164
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
Normal file
4164
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
Normal file
File diff suppressed because it is too large
Load diff
227
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h
Normal file
227
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
/*
|
||||
* This file is part of the Chelsio T4 Ethernet driver for Linux.
|
||||
*
|
||||
* Copyright (c) 2003-2014 Chelsio Communications, 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 __T4_HW_H
|
||||
#define __T4_HW_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
enum {
|
||||
NCHAN = 4, /* # of HW channels */
|
||||
MAX_MTU = 9600, /* max MAC MTU, excluding header + FCS */
|
||||
EEPROMSIZE = 17408, /* Serial EEPROM physical size */
|
||||
EEPROMVSIZE = 32768, /* Serial EEPROM virtual address space size */
|
||||
EEPROMPFSIZE = 1024, /* EEPROM writable area size for PFn, n>0 */
|
||||
RSS_NENTRIES = 2048, /* # of entries in RSS mapping table */
|
||||
TCB_SIZE = 128, /* TCB size */
|
||||
NMTUS = 16, /* size of MTU table */
|
||||
NCCTRL_WIN = 32, /* # of congestion control windows */
|
||||
L2T_SIZE = 4096, /* # of L2T entries */
|
||||
MBOX_LEN = 64, /* mailbox size in bytes */
|
||||
TRACE_LEN = 112, /* length of trace data and mask */
|
||||
FILTER_OPT_LEN = 36, /* filter tuple width for optional components */
|
||||
NWOL_PAT = 8, /* # of WoL patterns */
|
||||
WOL_PAT_LEN = 128, /* length of WoL patterns */
|
||||
};
|
||||
|
||||
enum {
|
||||
SF_PAGE_SIZE = 256, /* serial flash page size */
|
||||
SF_SEC_SIZE = 64 * 1024, /* serial flash sector size */
|
||||
};
|
||||
|
||||
enum { RSP_TYPE_FLBUF, RSP_TYPE_CPL, RSP_TYPE_INTR }; /* response entry types */
|
||||
|
||||
enum { MBOX_OWNER_NONE, MBOX_OWNER_FW, MBOX_OWNER_DRV }; /* mailbox owners */
|
||||
|
||||
enum {
|
||||
SGE_MAX_WR_LEN = 512, /* max WR size in bytes */
|
||||
SGE_NTIMERS = 6, /* # of interrupt holdoff timer values */
|
||||
SGE_NCOUNTERS = 4, /* # of interrupt packet counter values */
|
||||
SGE_MAX_IQ_SIZE = 65520,
|
||||
|
||||
SGE_TIMER_RSTRT_CNTR = 6, /* restart RX packet threshold counter */
|
||||
SGE_TIMER_UPD_CIDX = 7, /* update cidx only */
|
||||
|
||||
SGE_EQ_IDXSIZE = 64, /* egress queue pidx/cidx unit size */
|
||||
|
||||
SGE_INTRDST_PCI = 0, /* interrupt destination is PCI-E */
|
||||
SGE_INTRDST_IQ = 1, /* destination is an ingress queue */
|
||||
|
||||
SGE_UPDATEDEL_NONE = 0, /* ingress queue pidx update delivery */
|
||||
SGE_UPDATEDEL_INTR = 1, /* interrupt */
|
||||
SGE_UPDATEDEL_STPG = 2, /* status page */
|
||||
SGE_UPDATEDEL_BOTH = 3, /* interrupt and status page */
|
||||
|
||||
SGE_HOSTFCMODE_NONE = 0, /* egress queue cidx updates */
|
||||
SGE_HOSTFCMODE_IQ = 1, /* sent to ingress queue */
|
||||
SGE_HOSTFCMODE_STPG = 2, /* sent to status page */
|
||||
SGE_HOSTFCMODE_BOTH = 3, /* ingress queue and status page */
|
||||
|
||||
SGE_FETCHBURSTMIN_16B = 0,/* egress queue descriptor fetch minimum */
|
||||
SGE_FETCHBURSTMIN_32B = 1,
|
||||
SGE_FETCHBURSTMIN_64B = 2,
|
||||
SGE_FETCHBURSTMIN_128B = 3,
|
||||
|
||||
SGE_FETCHBURSTMAX_64B = 0,/* egress queue descriptor fetch maximum */
|
||||
SGE_FETCHBURSTMAX_128B = 1,
|
||||
SGE_FETCHBURSTMAX_256B = 2,
|
||||
SGE_FETCHBURSTMAX_512B = 3,
|
||||
|
||||
SGE_CIDXFLUSHTHRESH_1 = 0,/* egress queue cidx flush threshold */
|
||||
SGE_CIDXFLUSHTHRESH_2 = 1,
|
||||
SGE_CIDXFLUSHTHRESH_4 = 2,
|
||||
SGE_CIDXFLUSHTHRESH_8 = 3,
|
||||
SGE_CIDXFLUSHTHRESH_16 = 4,
|
||||
SGE_CIDXFLUSHTHRESH_32 = 5,
|
||||
SGE_CIDXFLUSHTHRESH_64 = 6,
|
||||
SGE_CIDXFLUSHTHRESH_128 = 7,
|
||||
|
||||
SGE_INGPADBOUNDARY_SHIFT = 5,/* ingress queue pad boundary */
|
||||
};
|
||||
|
||||
struct sge_qstat { /* data written to SGE queue status entries */
|
||||
__be32 qid;
|
||||
__be16 cidx;
|
||||
__be16 pidx;
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure for last 128 bits of response descriptors
|
||||
*/
|
||||
struct rsp_ctrl {
|
||||
__be32 hdrbuflen_pidx;
|
||||
__be32 pldbuflen_qid;
|
||||
union {
|
||||
u8 type_gen;
|
||||
__be64 last_flit;
|
||||
};
|
||||
};
|
||||
|
||||
#define RSPD_NEWBUF 0x80000000U
|
||||
#define RSPD_LEN(x) (((x) >> 0) & 0x7fffffffU)
|
||||
#define RSPD_QID(x) RSPD_LEN(x)
|
||||
|
||||
#define RSPD_GEN(x) ((x) >> 7)
|
||||
#define RSPD_TYPE(x) (((x) >> 4) & 3)
|
||||
|
||||
#define V_QINTR_CNT_EN 0x0
|
||||
#define QINTR_CNT_EN 0x1
|
||||
#define QINTR_TIMER_IDX(x) ((x) << 1)
|
||||
#define QINTR_TIMER_IDX_GET(x) (((x) >> 1) & 0x7)
|
||||
|
||||
/*
|
||||
* Flash layout.
|
||||
*/
|
||||
#define FLASH_START(start) ((start) * SF_SEC_SIZE)
|
||||
#define FLASH_MAX_SIZE(nsecs) ((nsecs) * SF_SEC_SIZE)
|
||||
|
||||
enum {
|
||||
/*
|
||||
* Various Expansion-ROM boot images, etc.
|
||||
*/
|
||||
FLASH_EXP_ROM_START_SEC = 0,
|
||||
FLASH_EXP_ROM_NSECS = 6,
|
||||
FLASH_EXP_ROM_START = FLASH_START(FLASH_EXP_ROM_START_SEC),
|
||||
FLASH_EXP_ROM_MAX_SIZE = FLASH_MAX_SIZE(FLASH_EXP_ROM_NSECS),
|
||||
|
||||
/*
|
||||
* iSCSI Boot Firmware Table (iBFT) and other driver-related
|
||||
* parameters ...
|
||||
*/
|
||||
FLASH_IBFT_START_SEC = 6,
|
||||
FLASH_IBFT_NSECS = 1,
|
||||
FLASH_IBFT_START = FLASH_START(FLASH_IBFT_START_SEC),
|
||||
FLASH_IBFT_MAX_SIZE = FLASH_MAX_SIZE(FLASH_IBFT_NSECS),
|
||||
|
||||
/*
|
||||
* Boot configuration data.
|
||||
*/
|
||||
FLASH_BOOTCFG_START_SEC = 7,
|
||||
FLASH_BOOTCFG_NSECS = 1,
|
||||
FLASH_BOOTCFG_START = FLASH_START(FLASH_BOOTCFG_START_SEC),
|
||||
FLASH_BOOTCFG_MAX_SIZE = FLASH_MAX_SIZE(FLASH_BOOTCFG_NSECS),
|
||||
|
||||
/*
|
||||
* Location of firmware image in FLASH.
|
||||
*/
|
||||
FLASH_FW_START_SEC = 8,
|
||||
FLASH_FW_NSECS = 16,
|
||||
FLASH_FW_START = FLASH_START(FLASH_FW_START_SEC),
|
||||
FLASH_FW_MAX_SIZE = FLASH_MAX_SIZE(FLASH_FW_NSECS),
|
||||
|
||||
/*
|
||||
* iSCSI persistent/crash information.
|
||||
*/
|
||||
FLASH_ISCSI_CRASH_START_SEC = 29,
|
||||
FLASH_ISCSI_CRASH_NSECS = 1,
|
||||
FLASH_ISCSI_CRASH_START = FLASH_START(FLASH_ISCSI_CRASH_START_SEC),
|
||||
FLASH_ISCSI_CRASH_MAX_SIZE = FLASH_MAX_SIZE(FLASH_ISCSI_CRASH_NSECS),
|
||||
|
||||
/*
|
||||
* FCoE persistent/crash information.
|
||||
*/
|
||||
FLASH_FCOE_CRASH_START_SEC = 30,
|
||||
FLASH_FCOE_CRASH_NSECS = 1,
|
||||
FLASH_FCOE_CRASH_START = FLASH_START(FLASH_FCOE_CRASH_START_SEC),
|
||||
FLASH_FCOE_CRASH_MAX_SIZE = FLASH_MAX_SIZE(FLASH_FCOE_CRASH_NSECS),
|
||||
|
||||
/*
|
||||
* Location of Firmware Configuration File in FLASH. Since the FPGA
|
||||
* "FLASH" is smaller we need to store the Configuration File in a
|
||||
* different location -- which will overlap the end of the firmware
|
||||
* image if firmware ever gets that large ...
|
||||
*/
|
||||
FLASH_CFG_START_SEC = 31,
|
||||
FLASH_CFG_NSECS = 1,
|
||||
FLASH_CFG_START = FLASH_START(FLASH_CFG_START_SEC),
|
||||
FLASH_CFG_MAX_SIZE = FLASH_MAX_SIZE(FLASH_CFG_NSECS),
|
||||
|
||||
/* We don't support FLASH devices which can't support the full
|
||||
* standard set of sections which we need for normal
|
||||
* operations.
|
||||
*/
|
||||
FLASH_MIN_SIZE = FLASH_CFG_START + FLASH_CFG_MAX_SIZE,
|
||||
|
||||
FLASH_FPGA_CFG_START_SEC = 15,
|
||||
FLASH_FPGA_CFG_START = FLASH_START(FLASH_FPGA_CFG_START_SEC),
|
||||
|
||||
/*
|
||||
* Sectors 32-63 are reserved for FLASH failover.
|
||||
*/
|
||||
};
|
||||
|
||||
#undef FLASH_START
|
||||
#undef FLASH_MAX_SIZE
|
||||
|
||||
#endif /* __T4_HW_H */
|
||||
841
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
Normal file
841
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h
Normal file
|
|
@ -0,0 +1,841 @@
|
|||
/*
|
||||
* This file is part of the Chelsio T4 Ethernet driver for Linux.
|
||||
*
|
||||
* Copyright (c) 2003-2014 Chelsio Communications, 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 __T4_MSG_H
|
||||
#define __T4_MSG_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
enum {
|
||||
CPL_PASS_OPEN_REQ = 0x1,
|
||||
CPL_PASS_ACCEPT_RPL = 0x2,
|
||||
CPL_ACT_OPEN_REQ = 0x3,
|
||||
CPL_SET_TCB_FIELD = 0x5,
|
||||
CPL_GET_TCB = 0x6,
|
||||
CPL_CLOSE_CON_REQ = 0x8,
|
||||
CPL_CLOSE_LISTSRV_REQ = 0x9,
|
||||
CPL_ABORT_REQ = 0xA,
|
||||
CPL_ABORT_RPL = 0xB,
|
||||
CPL_RX_DATA_ACK = 0xD,
|
||||
CPL_TX_PKT = 0xE,
|
||||
CPL_L2T_WRITE_REQ = 0x12,
|
||||
CPL_TID_RELEASE = 0x1A,
|
||||
|
||||
CPL_CLOSE_LISTSRV_RPL = 0x20,
|
||||
CPL_L2T_WRITE_RPL = 0x23,
|
||||
CPL_PASS_OPEN_RPL = 0x24,
|
||||
CPL_ACT_OPEN_RPL = 0x25,
|
||||
CPL_PEER_CLOSE = 0x26,
|
||||
CPL_ABORT_REQ_RSS = 0x2B,
|
||||
CPL_ABORT_RPL_RSS = 0x2D,
|
||||
|
||||
CPL_CLOSE_CON_RPL = 0x32,
|
||||
CPL_ISCSI_HDR = 0x33,
|
||||
CPL_RDMA_CQE = 0x35,
|
||||
CPL_RDMA_CQE_READ_RSP = 0x36,
|
||||
CPL_RDMA_CQE_ERR = 0x37,
|
||||
CPL_RX_DATA = 0x39,
|
||||
CPL_SET_TCB_RPL = 0x3A,
|
||||
CPL_RX_PKT = 0x3B,
|
||||
CPL_RX_DDP_COMPLETE = 0x3F,
|
||||
|
||||
CPL_ACT_ESTABLISH = 0x40,
|
||||
CPL_PASS_ESTABLISH = 0x41,
|
||||
CPL_RX_DATA_DDP = 0x42,
|
||||
CPL_PASS_ACCEPT_REQ = 0x44,
|
||||
CPL_TRACE_PKT_T5 = 0x48,
|
||||
CPL_RX_ISCSI_DDP = 0x49,
|
||||
|
||||
CPL_RDMA_READ_REQ = 0x60,
|
||||
|
||||
CPL_PASS_OPEN_REQ6 = 0x81,
|
||||
CPL_ACT_OPEN_REQ6 = 0x83,
|
||||
|
||||
CPL_RDMA_TERMINATE = 0xA2,
|
||||
CPL_RDMA_WRITE = 0xA4,
|
||||
CPL_SGE_EGR_UPDATE = 0xA5,
|
||||
|
||||
CPL_TRACE_PKT = 0xB0,
|
||||
CPL_ISCSI_DATA = 0xB2,
|
||||
|
||||
CPL_FW4_MSG = 0xC0,
|
||||
CPL_FW4_PLD = 0xC1,
|
||||
CPL_FW4_ACK = 0xC3,
|
||||
|
||||
CPL_FW6_MSG = 0xE0,
|
||||
CPL_FW6_PLD = 0xE1,
|
||||
CPL_TX_PKT_LSO = 0xED,
|
||||
CPL_TX_PKT_XT = 0xEE,
|
||||
|
||||
NUM_CPL_CMDS
|
||||
};
|
||||
|
||||
enum CPL_error {
|
||||
CPL_ERR_NONE = 0,
|
||||
CPL_ERR_TCAM_FULL = 3,
|
||||
CPL_ERR_BAD_LENGTH = 15,
|
||||
CPL_ERR_BAD_ROUTE = 18,
|
||||
CPL_ERR_CONN_RESET = 20,
|
||||
CPL_ERR_CONN_EXIST_SYNRECV = 21,
|
||||
CPL_ERR_CONN_EXIST = 22,
|
||||
CPL_ERR_ARP_MISS = 23,
|
||||
CPL_ERR_BAD_SYN = 24,
|
||||
CPL_ERR_CONN_TIMEDOUT = 30,
|
||||
CPL_ERR_XMIT_TIMEDOUT = 31,
|
||||
CPL_ERR_PERSIST_TIMEDOUT = 32,
|
||||
CPL_ERR_FINWAIT2_TIMEDOUT = 33,
|
||||
CPL_ERR_KEEPALIVE_TIMEDOUT = 34,
|
||||
CPL_ERR_RTX_NEG_ADVICE = 35,
|
||||
CPL_ERR_PERSIST_NEG_ADVICE = 36,
|
||||
CPL_ERR_KEEPALV_NEG_ADVICE = 37,
|
||||
CPL_ERR_ABORT_FAILED = 42,
|
||||
CPL_ERR_IWARP_FLM = 50,
|
||||
};
|
||||
|
||||
enum {
|
||||
ULP_MODE_NONE = 0,
|
||||
ULP_MODE_ISCSI = 2,
|
||||
ULP_MODE_RDMA = 4,
|
||||
ULP_MODE_TCPDDP = 5,
|
||||
ULP_MODE_FCOE = 6,
|
||||
};
|
||||
|
||||
enum {
|
||||
ULP_CRC_HEADER = 1 << 0,
|
||||
ULP_CRC_DATA = 1 << 1
|
||||
};
|
||||
|
||||
enum {
|
||||
CPL_ABORT_SEND_RST = 0,
|
||||
CPL_ABORT_NO_RST,
|
||||
};
|
||||
|
||||
enum { /* TX_PKT_XT checksum types */
|
||||
TX_CSUM_TCP = 0,
|
||||
TX_CSUM_UDP = 1,
|
||||
TX_CSUM_CRC16 = 4,
|
||||
TX_CSUM_CRC32 = 5,
|
||||
TX_CSUM_CRC32C = 6,
|
||||
TX_CSUM_FCOE = 7,
|
||||
TX_CSUM_TCPIP = 8,
|
||||
TX_CSUM_UDPIP = 9,
|
||||
TX_CSUM_TCPIP6 = 10,
|
||||
TX_CSUM_UDPIP6 = 11,
|
||||
TX_CSUM_IP = 12,
|
||||
};
|
||||
|
||||
union opcode_tid {
|
||||
__be32 opcode_tid;
|
||||
u8 opcode;
|
||||
};
|
||||
|
||||
#define CPL_OPCODE(x) ((x) << 24)
|
||||
#define G_CPL_OPCODE(x) (((x) >> 24) & 0xFF)
|
||||
#define MK_OPCODE_TID(opcode, tid) (CPL_OPCODE(opcode) | (tid))
|
||||
#define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid)
|
||||
#define GET_TID(cmd) (ntohl(OPCODE_TID(cmd)) & 0xFFFFFF)
|
||||
|
||||
/* partitioning of TID fields that also carry a queue id */
|
||||
#define GET_TID_TID(x) ((x) & 0x3fff)
|
||||
#define GET_TID_QID(x) (((x) >> 14) & 0x3ff)
|
||||
#define TID_QID(x) ((x) << 14)
|
||||
|
||||
struct rss_header {
|
||||
u8 opcode;
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
u8 channel:2;
|
||||
u8 filter_hit:1;
|
||||
u8 filter_tid:1;
|
||||
u8 hash_type:2;
|
||||
u8 ipv6:1;
|
||||
u8 send2fw:1;
|
||||
#else
|
||||
u8 send2fw:1;
|
||||
u8 ipv6:1;
|
||||
u8 hash_type:2;
|
||||
u8 filter_tid:1;
|
||||
u8 filter_hit:1;
|
||||
u8 channel:2;
|
||||
#endif
|
||||
__be16 qid;
|
||||
__be32 hash_val;
|
||||
};
|
||||
|
||||
struct work_request_hdr {
|
||||
__be32 wr_hi;
|
||||
__be32 wr_mid;
|
||||
__be64 wr_lo;
|
||||
};
|
||||
|
||||
/* wr_hi fields */
|
||||
#define S_WR_OP 24
|
||||
#define V_WR_OP(x) ((__u64)(x) << S_WR_OP)
|
||||
|
||||
#define WR_HDR struct work_request_hdr wr
|
||||
|
||||
/* option 0 fields */
|
||||
#define S_MSS_IDX 60
|
||||
#define M_MSS_IDX 0xF
|
||||
#define V_MSS_IDX(x) ((__u64)(x) << S_MSS_IDX)
|
||||
#define G_MSS_IDX(x) (((x) >> S_MSS_IDX) & M_MSS_IDX)
|
||||
|
||||
/* option 2 fields */
|
||||
#define S_RSS_QUEUE 0
|
||||
#define M_RSS_QUEUE 0x3FF
|
||||
#define V_RSS_QUEUE(x) ((x) << S_RSS_QUEUE)
|
||||
#define G_RSS_QUEUE(x) (((x) >> S_RSS_QUEUE) & M_RSS_QUEUE)
|
||||
|
||||
struct cpl_pass_open_req {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 local_port;
|
||||
__be16 peer_port;
|
||||
__be32 local_ip;
|
||||
__be32 peer_ip;
|
||||
__be64 opt0;
|
||||
#define TX_CHAN(x) ((x) << 2)
|
||||
#define NO_CONG(x) ((x) << 4)
|
||||
#define DELACK(x) ((x) << 5)
|
||||
#define ULP_MODE(x) ((x) << 8)
|
||||
#define RCV_BUFSIZ(x) ((x) << 12)
|
||||
#define RCV_BUFSIZ_MASK 0x3FFU
|
||||
#define DSCP(x) ((x) << 22)
|
||||
#define SMAC_SEL(x) ((u64)(x) << 28)
|
||||
#define L2T_IDX(x) ((u64)(x) << 36)
|
||||
#define TCAM_BYPASS(x) ((u64)(x) << 48)
|
||||
#define NAGLE(x) ((u64)(x) << 49)
|
||||
#define WND_SCALE(x) ((u64)(x) << 50)
|
||||
#define KEEP_ALIVE(x) ((u64)(x) << 54)
|
||||
#define MSS_IDX(x) ((u64)(x) << 60)
|
||||
__be64 opt1;
|
||||
#define SYN_RSS_ENABLE (1 << 0)
|
||||
#define SYN_RSS_QUEUE(x) ((x) << 2)
|
||||
#define CONN_POLICY_ASK (1 << 22)
|
||||
};
|
||||
|
||||
struct cpl_pass_open_req6 {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 local_port;
|
||||
__be16 peer_port;
|
||||
__be64 local_ip_hi;
|
||||
__be64 local_ip_lo;
|
||||
__be64 peer_ip_hi;
|
||||
__be64 peer_ip_lo;
|
||||
__be64 opt0;
|
||||
__be64 opt1;
|
||||
};
|
||||
|
||||
struct cpl_pass_open_rpl {
|
||||
union opcode_tid ot;
|
||||
u8 rsvd[3];
|
||||
u8 status;
|
||||
};
|
||||
|
||||
struct cpl_pass_accept_rpl {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be32 opt2;
|
||||
#define RSS_QUEUE(x) ((x) << 0)
|
||||
#define RSS_QUEUE_VALID (1 << 10)
|
||||
#define RX_COALESCE_VALID(x) ((x) << 11)
|
||||
#define RX_COALESCE(x) ((x) << 12)
|
||||
#define PACE(x) ((x) << 16)
|
||||
#define RX_FC_VALID ((1U) << 19)
|
||||
#define RX_FC_DISABLE ((1U) << 20)
|
||||
#define TX_QUEUE(x) ((x) << 23)
|
||||
#define RX_CHANNEL(x) ((x) << 26)
|
||||
#define CCTRL_ECN(x) ((x) << 27)
|
||||
#define WND_SCALE_EN(x) ((x) << 28)
|
||||
#define TSTAMPS_EN(x) ((x) << 29)
|
||||
#define SACK_EN(x) ((x) << 30)
|
||||
#define T5_OPT_2_VALID ((1U) << 31)
|
||||
__be64 opt0;
|
||||
};
|
||||
|
||||
struct cpl_t5_pass_accept_rpl {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be32 opt2;
|
||||
__be64 opt0;
|
||||
__be32 iss;
|
||||
__be32 rsvd;
|
||||
};
|
||||
|
||||
struct cpl_act_open_req {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 local_port;
|
||||
__be16 peer_port;
|
||||
__be32 local_ip;
|
||||
__be32 peer_ip;
|
||||
__be64 opt0;
|
||||
__be32 params;
|
||||
__be32 opt2;
|
||||
};
|
||||
|
||||
#define S_FILTER_TUPLE 24
|
||||
#define M_FILTER_TUPLE 0xFFFFFFFFFF
|
||||
#define V_FILTER_TUPLE(x) ((x) << S_FILTER_TUPLE)
|
||||
#define G_FILTER_TUPLE(x) (((x) >> S_FILTER_TUPLE) & M_FILTER_TUPLE)
|
||||
struct cpl_t5_act_open_req {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 local_port;
|
||||
__be16 peer_port;
|
||||
__be32 local_ip;
|
||||
__be32 peer_ip;
|
||||
__be64 opt0;
|
||||
__be32 rsvd;
|
||||
__be32 opt2;
|
||||
__be64 params;
|
||||
};
|
||||
|
||||
struct cpl_act_open_req6 {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 local_port;
|
||||
__be16 peer_port;
|
||||
__be64 local_ip_hi;
|
||||
__be64 local_ip_lo;
|
||||
__be64 peer_ip_hi;
|
||||
__be64 peer_ip_lo;
|
||||
__be64 opt0;
|
||||
__be32 params;
|
||||
__be32 opt2;
|
||||
};
|
||||
|
||||
struct cpl_t5_act_open_req6 {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 local_port;
|
||||
__be16 peer_port;
|
||||
__be64 local_ip_hi;
|
||||
__be64 local_ip_lo;
|
||||
__be64 peer_ip_hi;
|
||||
__be64 peer_ip_lo;
|
||||
__be64 opt0;
|
||||
__be32 rsvd;
|
||||
__be32 opt2;
|
||||
__be64 params;
|
||||
};
|
||||
|
||||
struct cpl_act_open_rpl {
|
||||
union opcode_tid ot;
|
||||
__be32 atid_status;
|
||||
#define GET_AOPEN_STATUS(x) ((x) & 0xff)
|
||||
#define GET_AOPEN_ATID(x) (((x) >> 8) & 0xffffff)
|
||||
};
|
||||
|
||||
struct cpl_pass_establish {
|
||||
union opcode_tid ot;
|
||||
__be32 rsvd;
|
||||
__be32 tos_stid;
|
||||
#define PASS_OPEN_TID(x) ((x) << 0)
|
||||
#define PASS_OPEN_TOS(x) ((x) << 24)
|
||||
#define GET_PASS_OPEN_TID(x) (((x) >> 0) & 0xFFFFFF)
|
||||
#define GET_POPEN_TID(x) ((x) & 0xffffff)
|
||||
#define GET_POPEN_TOS(x) (((x) >> 24) & 0xff)
|
||||
__be16 mac_idx;
|
||||
__be16 tcp_opt;
|
||||
#define GET_TCPOPT_WSCALE_OK(x) (((x) >> 5) & 1)
|
||||
#define GET_TCPOPT_SACK(x) (((x) >> 6) & 1)
|
||||
#define GET_TCPOPT_TSTAMP(x) (((x) >> 7) & 1)
|
||||
#define GET_TCPOPT_SND_WSCALE(x) (((x) >> 8) & 0xf)
|
||||
#define GET_TCPOPT_MSS(x) (((x) >> 12) & 0xf)
|
||||
__be32 snd_isn;
|
||||
__be32 rcv_isn;
|
||||
};
|
||||
|
||||
struct cpl_act_establish {
|
||||
union opcode_tid ot;
|
||||
__be32 rsvd;
|
||||
__be32 tos_atid;
|
||||
__be16 mac_idx;
|
||||
__be16 tcp_opt;
|
||||
__be32 snd_isn;
|
||||
__be32 rcv_isn;
|
||||
};
|
||||
|
||||
struct cpl_get_tcb {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 reply_ctrl;
|
||||
#define QUEUENO(x) ((x) << 0)
|
||||
#define REPLY_CHAN(x) ((x) << 14)
|
||||
#define NO_REPLY(x) ((x) << 15)
|
||||
__be16 cookie;
|
||||
};
|
||||
|
||||
struct cpl_set_tcb_field {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 reply_ctrl;
|
||||
__be16 word_cookie;
|
||||
#define TCB_WORD(x) ((x) << 0)
|
||||
#define TCB_COOKIE(x) ((x) << 5)
|
||||
#define GET_TCB_COOKIE(x) (((x) >> 5) & 7)
|
||||
__be64 mask;
|
||||
__be64 val;
|
||||
};
|
||||
|
||||
struct cpl_set_tcb_rpl {
|
||||
union opcode_tid ot;
|
||||
__be16 rsvd;
|
||||
u8 cookie;
|
||||
u8 status;
|
||||
__be64 oldval;
|
||||
};
|
||||
|
||||
struct cpl_close_con_req {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be32 rsvd;
|
||||
};
|
||||
|
||||
struct cpl_close_con_rpl {
|
||||
union opcode_tid ot;
|
||||
u8 rsvd[3];
|
||||
u8 status;
|
||||
__be32 snd_nxt;
|
||||
__be32 rcv_nxt;
|
||||
};
|
||||
|
||||
struct cpl_close_listsvr_req {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 reply_ctrl;
|
||||
#define LISTSVR_IPV6(x) ((x) << 14)
|
||||
__be16 rsvd;
|
||||
};
|
||||
|
||||
struct cpl_close_listsvr_rpl {
|
||||
union opcode_tid ot;
|
||||
u8 rsvd[3];
|
||||
u8 status;
|
||||
};
|
||||
|
||||
struct cpl_abort_req_rss {
|
||||
union opcode_tid ot;
|
||||
u8 rsvd[3];
|
||||
u8 status;
|
||||
};
|
||||
|
||||
struct cpl_abort_req {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be32 rsvd0;
|
||||
u8 rsvd1;
|
||||
u8 cmd;
|
||||
u8 rsvd2[6];
|
||||
};
|
||||
|
||||
struct cpl_abort_rpl_rss {
|
||||
union opcode_tid ot;
|
||||
u8 rsvd[3];
|
||||
u8 status;
|
||||
};
|
||||
|
||||
struct cpl_abort_rpl {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be32 rsvd0;
|
||||
u8 rsvd1;
|
||||
u8 cmd;
|
||||
u8 rsvd2[6];
|
||||
};
|
||||
|
||||
struct cpl_peer_close {
|
||||
union opcode_tid ot;
|
||||
__be32 rcv_nxt;
|
||||
};
|
||||
|
||||
struct cpl_tid_release {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be32 rsvd;
|
||||
};
|
||||
|
||||
struct cpl_tx_pkt_core {
|
||||
__be32 ctrl0;
|
||||
#define TXPKT_VF(x) ((x) << 0)
|
||||
#define TXPKT_PF(x) ((x) << 8)
|
||||
#define TXPKT_VF_VLD (1 << 11)
|
||||
#define TXPKT_OVLAN_IDX(x) ((x) << 12)
|
||||
#define TXPKT_INTF(x) ((x) << 16)
|
||||
#define TXPKT_INS_OVLAN (1 << 21)
|
||||
#define TXPKT_OPCODE(x) ((x) << 24)
|
||||
__be16 pack;
|
||||
__be16 len;
|
||||
__be64 ctrl1;
|
||||
#define TXPKT_CSUM_END(x) ((x) << 12)
|
||||
#define TXPKT_CSUM_START(x) ((x) << 20)
|
||||
#define TXPKT_IPHDR_LEN(x) ((u64)(x) << 20)
|
||||
#define TXPKT_CSUM_LOC(x) ((u64)(x) << 30)
|
||||
#define TXPKT_ETHHDR_LEN(x) ((u64)(x) << 34)
|
||||
#define TXPKT_CSUM_TYPE(x) ((u64)(x) << 40)
|
||||
#define TXPKT_VLAN(x) ((u64)(x) << 44)
|
||||
#define TXPKT_VLAN_VLD (1ULL << 60)
|
||||
#define TXPKT_IPCSUM_DIS (1ULL << 62)
|
||||
#define TXPKT_L4CSUM_DIS (1ULL << 63)
|
||||
};
|
||||
|
||||
struct cpl_tx_pkt {
|
||||
WR_HDR;
|
||||
struct cpl_tx_pkt_core c;
|
||||
};
|
||||
|
||||
#define cpl_tx_pkt_xt cpl_tx_pkt
|
||||
|
||||
struct cpl_tx_pkt_lso_core {
|
||||
__be32 lso_ctrl;
|
||||
#define LSO_TCPHDR_LEN(x) ((x) << 0)
|
||||
#define LSO_IPHDR_LEN(x) ((x) << 4)
|
||||
#define LSO_ETHHDR_LEN(x) ((x) << 16)
|
||||
#define LSO_IPV6(x) ((x) << 20)
|
||||
#define LSO_LAST_SLICE (1 << 22)
|
||||
#define LSO_FIRST_SLICE (1 << 23)
|
||||
#define LSO_OPCODE(x) ((x) << 24)
|
||||
#define LSO_T5_XFER_SIZE(x) ((x) << 0)
|
||||
__be16 ipid_ofst;
|
||||
__be16 mss;
|
||||
__be32 seqno_offset;
|
||||
__be32 len;
|
||||
/* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */
|
||||
};
|
||||
|
||||
struct cpl_tx_pkt_lso {
|
||||
WR_HDR;
|
||||
struct cpl_tx_pkt_lso_core c;
|
||||
/* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */
|
||||
};
|
||||
|
||||
struct cpl_iscsi_hdr {
|
||||
union opcode_tid ot;
|
||||
__be16 pdu_len_ddp;
|
||||
#define ISCSI_PDU_LEN(x) ((x) & 0x7FFF)
|
||||
#define ISCSI_DDP (1 << 15)
|
||||
__be16 len;
|
||||
__be32 seq;
|
||||
__be16 urg;
|
||||
u8 rsvd;
|
||||
u8 status;
|
||||
};
|
||||
|
||||
struct cpl_rx_data {
|
||||
union opcode_tid ot;
|
||||
__be16 rsvd;
|
||||
__be16 len;
|
||||
__be32 seq;
|
||||
__be16 urg;
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
u8 dack_mode:2;
|
||||
u8 psh:1;
|
||||
u8 heartbeat:1;
|
||||
u8 ddp_off:1;
|
||||
u8 :3;
|
||||
#else
|
||||
u8 :3;
|
||||
u8 ddp_off:1;
|
||||
u8 heartbeat:1;
|
||||
u8 psh:1;
|
||||
u8 dack_mode:2;
|
||||
#endif
|
||||
u8 status;
|
||||
};
|
||||
|
||||
struct cpl_rx_data_ack {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be32 credit_dack;
|
||||
#define RX_CREDITS(x) ((x) << 0)
|
||||
#define RX_FORCE_ACK(x) ((x) << 28)
|
||||
};
|
||||
|
||||
struct cpl_rx_pkt {
|
||||
struct rss_header rsshdr;
|
||||
u8 opcode;
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
u8 iff:4;
|
||||
u8 csum_calc:1;
|
||||
u8 ipmi_pkt:1;
|
||||
u8 vlan_ex:1;
|
||||
u8 ip_frag:1;
|
||||
#else
|
||||
u8 ip_frag:1;
|
||||
u8 vlan_ex:1;
|
||||
u8 ipmi_pkt:1;
|
||||
u8 csum_calc:1;
|
||||
u8 iff:4;
|
||||
#endif
|
||||
__be16 csum;
|
||||
__be16 vlan;
|
||||
__be16 len;
|
||||
__be32 l2info;
|
||||
#define RXF_UDP (1 << 22)
|
||||
#define RXF_TCP (1 << 23)
|
||||
#define RXF_IP (1 << 24)
|
||||
#define RXF_IP6 (1 << 25)
|
||||
__be16 hdr_len;
|
||||
__be16 err_vec;
|
||||
};
|
||||
|
||||
/* rx_pkt.l2info fields */
|
||||
#define S_RX_ETHHDR_LEN 0
|
||||
#define M_RX_ETHHDR_LEN 0x1F
|
||||
#define V_RX_ETHHDR_LEN(x) ((x) << S_RX_ETHHDR_LEN)
|
||||
#define G_RX_ETHHDR_LEN(x) (((x) >> S_RX_ETHHDR_LEN) & M_RX_ETHHDR_LEN)
|
||||
|
||||
#define S_RX_T5_ETHHDR_LEN 0
|
||||
#define M_RX_T5_ETHHDR_LEN 0x3F
|
||||
#define V_RX_T5_ETHHDR_LEN(x) ((x) << S_RX_T5_ETHHDR_LEN)
|
||||
#define G_RX_T5_ETHHDR_LEN(x) (((x) >> S_RX_T5_ETHHDR_LEN) & M_RX_T5_ETHHDR_LEN)
|
||||
|
||||
#define S_RX_MACIDX 8
|
||||
#define M_RX_MACIDX 0x1FF
|
||||
#define V_RX_MACIDX(x) ((x) << S_RX_MACIDX)
|
||||
#define G_RX_MACIDX(x) (((x) >> S_RX_MACIDX) & M_RX_MACIDX)
|
||||
|
||||
#define S_RXF_SYN 21
|
||||
#define V_RXF_SYN(x) ((x) << S_RXF_SYN)
|
||||
#define F_RXF_SYN V_RXF_SYN(1U)
|
||||
|
||||
#define S_RX_CHAN 28
|
||||
#define M_RX_CHAN 0xF
|
||||
#define V_RX_CHAN(x) ((x) << S_RX_CHAN)
|
||||
#define G_RX_CHAN(x) (((x) >> S_RX_CHAN) & M_RX_CHAN)
|
||||
|
||||
/* rx_pkt.hdr_len fields */
|
||||
#define S_RX_TCPHDR_LEN 0
|
||||
#define M_RX_TCPHDR_LEN 0x3F
|
||||
#define V_RX_TCPHDR_LEN(x) ((x) << S_RX_TCPHDR_LEN)
|
||||
#define G_RX_TCPHDR_LEN(x) (((x) >> S_RX_TCPHDR_LEN) & M_RX_TCPHDR_LEN)
|
||||
|
||||
#define S_RX_IPHDR_LEN 6
|
||||
#define M_RX_IPHDR_LEN 0x3FF
|
||||
#define V_RX_IPHDR_LEN(x) ((x) << S_RX_IPHDR_LEN)
|
||||
#define G_RX_IPHDR_LEN(x) (((x) >> S_RX_IPHDR_LEN) & M_RX_IPHDR_LEN)
|
||||
|
||||
struct cpl_trace_pkt {
|
||||
u8 opcode;
|
||||
u8 intf;
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
u8 runt:4;
|
||||
u8 filter_hit:4;
|
||||
u8 :6;
|
||||
u8 err:1;
|
||||
u8 trunc:1;
|
||||
#else
|
||||
u8 filter_hit:4;
|
||||
u8 runt:4;
|
||||
u8 trunc:1;
|
||||
u8 err:1;
|
||||
u8 :6;
|
||||
#endif
|
||||
__be16 rsvd;
|
||||
__be16 len;
|
||||
__be64 tstamp;
|
||||
};
|
||||
|
||||
struct cpl_t5_trace_pkt {
|
||||
__u8 opcode;
|
||||
__u8 intf;
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
__u8 runt:4;
|
||||
__u8 filter_hit:4;
|
||||
__u8:6;
|
||||
__u8 err:1;
|
||||
__u8 trunc:1;
|
||||
#else
|
||||
__u8 filter_hit:4;
|
||||
__u8 runt:4;
|
||||
__u8 trunc:1;
|
||||
__u8 err:1;
|
||||
__u8:6;
|
||||
#endif
|
||||
__be16 rsvd;
|
||||
__be16 len;
|
||||
__be64 tstamp;
|
||||
__be64 rsvd1;
|
||||
};
|
||||
|
||||
struct cpl_l2t_write_req {
|
||||
WR_HDR;
|
||||
union opcode_tid ot;
|
||||
__be16 params;
|
||||
#define L2T_W_INFO(x) ((x) << 2)
|
||||
#define L2T_W_PORT(x) ((x) << 8)
|
||||
#define L2T_W_NOREPLY(x) ((x) << 15)
|
||||
__be16 l2t_idx;
|
||||
__be16 vlan;
|
||||
u8 dst_mac[6];
|
||||
};
|
||||
|
||||
struct cpl_l2t_write_rpl {
|
||||
union opcode_tid ot;
|
||||
u8 status;
|
||||
u8 rsvd[3];
|
||||
};
|
||||
|
||||
struct cpl_rdma_terminate {
|
||||
union opcode_tid ot;
|
||||
__be16 rsvd;
|
||||
__be16 len;
|
||||
};
|
||||
|
||||
struct cpl_sge_egr_update {
|
||||
__be32 opcode_qid;
|
||||
#define EGR_QID(x) ((x) & 0x1FFFF)
|
||||
__be16 cidx;
|
||||
__be16 pidx;
|
||||
};
|
||||
|
||||
/* cpl_fw*.type values */
|
||||
enum {
|
||||
FW_TYPE_CMD_RPL = 0,
|
||||
FW_TYPE_WR_RPL = 1,
|
||||
FW_TYPE_CQE = 2,
|
||||
FW_TYPE_OFLD_CONNECTION_WR_RPL = 3,
|
||||
FW_TYPE_RSSCPL = 4,
|
||||
};
|
||||
|
||||
struct cpl_fw4_pld {
|
||||
u8 opcode;
|
||||
u8 rsvd0[3];
|
||||
u8 type;
|
||||
u8 rsvd1;
|
||||
__be16 len;
|
||||
__be64 data;
|
||||
__be64 rsvd2;
|
||||
};
|
||||
|
||||
struct cpl_fw6_pld {
|
||||
u8 opcode;
|
||||
u8 rsvd[5];
|
||||
__be16 len;
|
||||
__be64 data[4];
|
||||
};
|
||||
|
||||
struct cpl_fw4_msg {
|
||||
u8 opcode;
|
||||
u8 type;
|
||||
__be16 rsvd0;
|
||||
__be32 rsvd1;
|
||||
__be64 data[2];
|
||||
};
|
||||
|
||||
struct cpl_fw4_ack {
|
||||
union opcode_tid ot;
|
||||
u8 credits;
|
||||
u8 rsvd0[2];
|
||||
u8 seq_vld;
|
||||
__be32 snd_nxt;
|
||||
__be32 snd_una;
|
||||
__be64 rsvd1;
|
||||
};
|
||||
|
||||
struct cpl_fw6_msg {
|
||||
u8 opcode;
|
||||
u8 type;
|
||||
__be16 rsvd0;
|
||||
__be32 rsvd1;
|
||||
__be64 data[4];
|
||||
};
|
||||
|
||||
/* cpl_fw6_msg.type values */
|
||||
enum {
|
||||
FW6_TYPE_CMD_RPL = 0,
|
||||
FW6_TYPE_WR_RPL = 1,
|
||||
FW6_TYPE_CQE = 2,
|
||||
FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3,
|
||||
FW6_TYPE_RSSCPL = FW_TYPE_RSSCPL,
|
||||
};
|
||||
|
||||
struct cpl_fw6_msg_ofld_connection_wr_rpl {
|
||||
__u64 cookie;
|
||||
__be32 tid; /* or atid in case of active failure */
|
||||
__u8 t_state;
|
||||
__u8 retval;
|
||||
__u8 rsvd[2];
|
||||
};
|
||||
|
||||
enum {
|
||||
ULP_TX_MEM_READ = 2,
|
||||
ULP_TX_MEM_WRITE = 3,
|
||||
ULP_TX_PKT = 4
|
||||
};
|
||||
|
||||
enum {
|
||||
ULP_TX_SC_NOOP = 0x80,
|
||||
ULP_TX_SC_IMM = 0x81,
|
||||
ULP_TX_SC_DSGL = 0x82,
|
||||
ULP_TX_SC_ISGL = 0x83
|
||||
};
|
||||
|
||||
struct ulptx_sge_pair {
|
||||
__be32 len[2];
|
||||
__be64 addr[2];
|
||||
};
|
||||
|
||||
struct ulptx_sgl {
|
||||
__be32 cmd_nsge;
|
||||
#define ULPTX_CMD(x) ((x) << 24)
|
||||
#define ULPTX_NSGE(x) ((x) << 0)
|
||||
#define ULPTX_MORE (1U << 23)
|
||||
__be32 len0;
|
||||
__be64 addr0;
|
||||
struct ulptx_sge_pair sge[0];
|
||||
};
|
||||
|
||||
struct ulp_mem_io {
|
||||
WR_HDR;
|
||||
__be32 cmd;
|
||||
#define ULP_MEMIO_ORDER(x) ((x) << 23)
|
||||
__be32 len16; /* command length */
|
||||
__be32 dlen; /* data length in 32-byte units */
|
||||
#define ULP_MEMIO_DATA_LEN(x) ((x) << 0)
|
||||
__be32 lock_addr;
|
||||
#define ULP_MEMIO_ADDR(x) ((x) << 0)
|
||||
#define ULP_MEMIO_LOCK(x) ((x) << 31)
|
||||
};
|
||||
|
||||
#define S_T5_ULP_MEMIO_IMM 23
|
||||
#define V_T5_ULP_MEMIO_IMM(x) ((x) << S_T5_ULP_MEMIO_IMM)
|
||||
#define F_T5_ULP_MEMIO_IMM V_T5_ULP_MEMIO_IMM(1U)
|
||||
|
||||
#define S_T5_ULP_MEMIO_ORDER 22
|
||||
#define V_T5_ULP_MEMIO_ORDER(x) ((x) << S_T5_ULP_MEMIO_ORDER)
|
||||
#define F_T5_ULP_MEMIO_ORDER V_T5_ULP_MEMIO_ORDER(1U)
|
||||
|
||||
#endif /* __T4_MSG_H */
|
||||
1344
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
Normal file
1344
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h
Normal file
File diff suppressed because it is too large
Load diff
2282
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
Normal file
2282
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue