Add support for Chelsio T5 adapter
Subsystems (7)
cover Add support for Chelsio T5 adapter
Hi All,
This patch series adds support for Chelsio's T5 adapter. It also adds support for new features of T5. It adds these in cxgb4, cxgb4vf, RDMA/cxgb4 and csiostor drivers.
Chelsio's T5 asic moves the architecture into 40GbE speeds. T5 is a 10/40GbE controller with full offload support of a complete Unified Wire solution comprising NIC, Virtualization, TOE, iWARP RDMA and FCoE.
T5 supports all the offload, virtualization and switching capabilities of the existing T4 and adds some new features. The patch series does basic intialization for T5 in each driver. The patch series implements a low latency Write Combining work request path in cxgb4 and RDMA/cxgb4 driver for T5. It supports new T5 feature DSGL in RDMA/cxgb4 driver which enables direct DMA by HW to memory region PBL arrays and fast register PBL arrays from host memory. It adds support for dumping T5 registers, T5's debugfs support and enables doorbell drop recovery only for T4 in cxgb4 driver.
To facilitate addition of support in csiostor for future adapters, a new framework for adapter specific operations has been defined. Consequently, T4 and T5 specific operations are now separated into different files. One of the csiostor patches also includes common bug fixes.
We are submitting changes in all the drivers for T5 in one series since there are common changes in cxgb4 driver which are required by all the ULDs and csiostor. This way we can avoid build failures, build dependencies and ensure smooth integration.
We request to merge this patch series via David Miller's net-next tree. We are copying respective maintainers of all the drivers for reviewing the changes. Kindly let us know in case of any review comments.
We have successfully carried out networking, virtualization, iWARP and storage related stress tests on this patch series.
Thanks,
Vipul Pandya
Arvind Bhushan (4):
csiostor: Segregate T4 adapter operations.
csiostor: Add T5 adapter operations.
csiostor: Header file modifications for chip support and bug fixes.
csiostor: Cleanup chip specific operations.
Santosh Rastapur (11):
cxgb4: Add register definations for T5
cxgb4: Add macros, structures and inline functions for T5
cxgb4: Initialize T5
cxgb4: Dump T5 registers
cxgb4: Add T5 write combining support
cxgb4: Enable doorbell drop recovery only for T4 adapter
cxgb4: Add T5 debugfs support
cxgb4: Add T5 PCI ids
cxgb4: Update driver version and description
cxgb4: Disable SR-IOV support for PF4-7 for T5
cxgb4vf: Add support for Chelsio T5 adapter
Vipul Pandya (7):
RDMA/cxgb4: Add Support for Chelsio T5 adapter RDMA/cxgb4: Turn off db coalescing when RDMA QPs are in use. RDMA/cxgb4: Add module_params to enable DB FC & Coalescing on T5 RDMA/cxgb4: Use DSGLs for fastreg and adapter memory writes for T5. RDMA/cxgb4: Map pbl buffers for dma if using DSGL. RDMA/cxgb4: Bump tcam_full stat and WR reply timeout RDMA/cxgb4: Fix onchip queue support for T5
drivers/infiniband/hw/cxgb4/cm.c | 66 ++- drivers/infiniband/hw/cxgb4/device.c | 34 +- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 14 +- drivers/infiniband/hw/cxgb4/mem.c | 155 ++++- drivers/infiniband/hw/cxgb4/provider.c | 15 +- drivers/infiniband/hw/cxgb4/qp.c | 113 ++- drivers/infiniband/hw/cxgb4/t4.h | 11 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 55 ++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 778 ++++++++++++++++++-- drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 3 + drivers/net/ethernet/chelsio/cxgb4/sge.c | 91 ++- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 256 ++++++-- drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 1 - drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 53 ++ drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 98 +++ drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 2 +- drivers/net/ethernet/chelsio/cxgb4vf/adapter.h | 1 + .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 35 +- drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 8 +- drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h | 24 + drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | 14 +- drivers/scsi/csiostor/Makefile | 3 +- drivers/scsi/csiostor/csio_hw.c | 559 +++----------- drivers/scsi/csiostor/csio_hw.h | 47 +- drivers/scsi/csiostor/csio_hw_chip.h | 175 +++++ drivers/scsi/csiostor/csio_hw_t4.c | 403 ++++++++++ drivers/scsi/csiostor/csio_hw_t5.c | 397 ++++++++++ drivers/scsi/csiostor/csio_init.c | 48 +- drivers/scsi/csiostor/csio_init.h | 29 +- drivers/scsi/csiostor/csio_lnode.h | 2 +- drivers/scsi/csiostor/csio_rnode.c | 10 +- drivers/scsi/csiostor/csio_rnode.h | 2 +- drivers/scsi/csiostor/csio_wr.c | 60 +- 33 files changed, 2821 insertions(+), 741 deletions(-) create mode 100644 drivers/scsi/csiostor/csio_hw_chip.h create mode 100644 drivers/scsi/csiostor/csio_hw_t4.c create mode 100644 drivers/scsi/csiostor/csio_hw_t5.c
PATCH 1/22 cxgb4: Add register definations for T5
From: Santosh Rastapur <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 94 ++++++++++++++++++++++++++ 1 files changed, 94 insertions(+), 0 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +94 -0
@@ -68,9 +68,14 @@#define QID_SHIFT 15#define QID (x) ((x) << QID_SHIFT)#define DBPRIO (x) ((x) << 14) +#define DBTYPE (x) ((x) << 13)#define PIDX_MASK 0x00003fffU#define PIDX_SHIFT 0#define PIDX (x) ((x) << PIDX_SHIFT) +#define S_PIDX_T5 0 +#define M_PIDX_T5 0x1fffU +#define PIDX_T5 (x) (((x) >> S_PIDX_T5) & M_PIDX_T5) +#define SGE_PF_GTS 0x4#define INGRESSQID_MASK 0xffff0000U
@@ -152,6 +157,8 @@#define QUEUESPERPAGEPF0_MASK 0x0000000fU#define QUEUESPERPAGEPF0_GET (x) ((x) & QUEUESPERPAGEPF0_MASK) +#define QUEUESPERPAGEPF1 4 +#define SGE_INT_CAUSE1 0x1024#define SGE_INT_CAUSE2 0x1030#define SGE_INT_CAUSE3 0x103c
@@ -272,17 +279,36 @@#define S_HP_INT_THRESH 28#define M_HP_INT_THRESH 0xfU#define V_HP_INT_THRESH (x) ((x) << S_HP_INT_THRESH) +#define S_LP_INT_THRESH_T5 18 +#define V_LP_INT_THRESH_T5 (x) ((x) << S_LP_INT_THRESH_T5) +#define M_LP_COUNT_T5 0x3ffffU +#define G_LP_COUNT_T5 (x) (((x) >> S_LP_COUNT) & M_LP_COUNT_T5)#define M_HP_COUNT 0x7ffU#define S_HP_COUNT 16#define G_HP_COUNT (x) (((x) >> S_HP_COUNT) & M_HP_COUNT)#define S_LP_INT_THRESH 12#define M_LP_INT_THRESH 0xfU +#define M_LP_INT_THRESH_T5 0xfffU#define V_LP_INT_THRESH (x) ((x) << S_LP_INT_THRESH)#define M_LP_COUNT 0x7ffU#define S_LP_COUNT 0#define G_LP_COUNT (x) (((x) >> S_LP_COUNT) & M_LP_COUNT)#define A_SGE_DBFIFO_STATUS 0x10a4 +#define SGE_STAT_TOTAL 0x10e4 +#define SGE_STAT_MATCH 0x10e8 + +#define SGE_STAT_CFG 0x10ec +#define S_STATSOURCE_T5 9 +#define STATSOURCE_T5 (x) ((x) << S_STATSOURCE_T5) + +#define SGE_DBFIFO_STATUS2 0x1118 +#define M_HP_COUNT_T5 0x3ffU +#define G_HP_COUNT_T5 (x) ((x) & M_HP_COUNT_T5) +#define S_HP_INT_THRESH_T5 10 +#define M_HP_INT_THRESH_T5 0xfU +#define V_HP_INT_THRESH_T5 (x) ((x) << S_HP_INT_THRESH_T5) +#define S_ENABLE_DROP 13#define V_ENABLE_DROP (x) ((x) << S_ENABLE_DROP)#define F_ENABLE_DROP V_ENABLE_DROP(1U)
@@ -331,8 +357,27 @@#define MSIADDRHPERR 0x00000002U#define MSIADDRLPERR 0x00000001U +#define READRSPERR 0x20000000U +#define TRGT1GRPPERR 0x10000000U +#define IPSOTPERR 0x08000000U +#define IPRXDATAGRPPERR 0x02000000U +#define IPRXHDRGRPPERR 0x01000000U +#define MAGRPPERR 0x00400000U +#define VFIDPERR 0x00200000U +#define HREQWRPERR 0x00010000U +#define DREQWRPERR 0x00002000U +#define MSTTAGQPERR 0x00000400U +#define PIOREQGRPPERR 0x00000100U +#define PIOCPLGRPPERR 0x00000080U +#define MSIXSTIPERR 0x00000004U +#define MSTTIMEOUTPERR 0x00000002U +#define MSTGRPPERR 0x00000001U +#define PCIE_NONFAT_ERR 0x3010#define PCIE_MEM_ACCESS_BASE_WIN 0x3068 +#define S_PCIEOFST 10 +#define M_PCIEOFST 0x3fffffU +#define GET_PCIEOFST (x) (((x) >> S_PCIEOFST) & M_PCIEOFST)#define PCIEOFST_MASK 0xfffffc00U#define BIR_MASK 0x00000300U#define BIR_SHIFT 8
@@ -342,6 +387,9 @@#define WINDOW (x) ((x) << WINDOW_SHIFT)#define PCIE_MEM_ACCESS_OFFSET 0x306c +#define S_PFNUM 0 +#define V_PFNUM (x) ((x) << S_PFNUM) +#define PCIE_FW 0x30b8#define PCIE_FW_ERR 0x80000000U#define PCIE_FW_INIT 0x40000000U
@@ -407,12 +455,18 @@#define MC_BIST_STATUS_RDATA 0x7688 +#define MA_EDRAM0_BAR 0x77c0 +#define MA_EDRAM1_BAR 0x77c4 +#define EDRAM_SIZE_MASK 0xfffU +#define EDRAM_SIZE_GET (x) ((x) & EDRAM_SIZE_MASK) +#define MA_EXT_MEMORY_BAR 0x77c8#define EXT_MEM_SIZE_MASK 0x00000fffU#define EXT_MEM_SIZE_SHIFT 0#define EXT_MEM_SIZE_GET (x) (((x) & EXT_MEM_SIZE_MASK) >> EXT_MEM_SIZE_SHIFT)#define MA_TARGET_MEM_ENABLE 0x77d8 +#define EXT_MEM1_ENABLE 0x00000010U#define EXT_MEM_ENABLE 0x00000004U#define EDRAM1_ENABLE 0x00000002U#define EDRAM0_ENABLE 0x00000001U
@@ -431,6 +485,7 @@#define MA_PCIE_FW 0x30b8#define MA_PARITY_ERROR_STATUS 0x77f4 +#define MA_EXT_MEMORY1_BAR 0x7808#define EDC_0_BASE_ADDR 0x7900#define EDC_BIST_CMD 0x7904
@@ -801,6 +856,15 @@#define MPS_PORT_STAT_RX_PORT_PPP7_H 0x60c#define MPS_PORT_STAT_RX_PORT_LESS_64B_L 0x610#define MPS_PORT_STAT_RX_PORT_LESS_64B_H 0x614 +#define MAC_PORT_CFG2 0x818 +#define MAC_PORT_MAGIC_MACID_LO 0x824 +#define MAC_PORT_MAGIC_MACID_HI 0x828 +#define MAC_PORT_EPIO_DATA0 0x8c0 +#define MAC_PORT_EPIO_DATA1 0x8c4 +#define MAC_PORT_EPIO_DATA2 0x8c8 +#define MAC_PORT_EPIO_DATA3 0x8cc +#define MAC_PORT_EPIO_OP 0x8d0 +#define MPS_CMN_CTL 0x9000#define NUMPORTS_MASK 0x00000003U#define NUMPORTS_SHIFT 0
@@ -1063,6 +1127,7 @@#define ADDRESS_SHIFT 0#define ADDRESS (x) ((x) << ADDRESS_SHIFT) +#define MAC_PORT_INT_CAUSE 0x8dc#define XGMAC_PORT_INT_CAUSE 0x10dc#define A_TP_TX_MOD_QUEUE_REQ_MAP 0x7e28
@@ -1101,4 +1166,33 @@#define V_PORT (x) ((x) << S_PORT)#define F_PORT V_PORT(1U) +#define NUM_MPS_CLS_SRAM_L_INSTANCES 336 +#define NUM_MPS_T5_CLS_SRAM_L_INSTANCES 512 + +#define T5_PORT0_BASE 0x30000 +#define T5_PORT_STRIDE 0x4000 +#define T5_PORT_BASE (idx) (T5_PORT0_BASE + (idx) * T5_PORT_STRIDE) +#define T5_PORT_REG (idx, reg) (T5_PORT_BASE(idx) + (reg)) + +#define MC_0_BASE_ADDR 0x40000 +#define MC_1_BASE_ADDR 0x48000 +#define MC_STRIDE (MC_1_BASE_ADDR - MC_0_BASE_ADDR) +#define MC_REG (reg, idx) (reg + MC_STRIDE * idx) + +#define MC_P_BIST_CMD 0x41400 +#define MC_P_BIST_CMD_ADDR 0x41404 +#define MC_P_BIST_CMD_LEN 0x41408 +#define MC_P_BIST_DATA_PATTERN 0x4140c +#define MC_P_BIST_STATUS_RDATA 0x41488 +#define EDC_T50_BASE_ADDR 0x50000 +#define EDC_H_BIST_CMD 0x50004 +#define EDC_H_BIST_CMD_ADDR 0x50008 +#define EDC_H_BIST_CMD_LEN 0x5000c +#define EDC_H_BIST_DATA_PATTERN 0x50010 +#define EDC_H_BIST_STATUS_RDATA 0x50028 + +#define EDC_T51_BASE_ADDR 0x50800 +#define EDC_STRIDE_T5 (EDC_T51_BASE_ADDR - EDC_T50_BASE_ADDR) +#define EDC_REG_T5 (reg, idx) (reg + EDC_STRIDE_T5 * idx) +#endif /* __T4_REGS_H */
Signature · 1 line
1.7.1
PATCH 2/22 cxgb4: Add macros, structures and inline functions for T5
In reply to Vipul PandyaFrom: Santosh Rastapur <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 50 ++++++++++++++++++++++++- drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 45 ++++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 2 +- 3 files changed, 95 insertions(+), 2 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +49 -1
@@ -54,6 +54,10 @@#define FW_VERSION_MINOR 1#define FW_VERSION_MICRO 0 +#define FW_VERSION_MAJOR_T5 0 +#define FW_VERSION_MINOR_T5 0 +#define FW_VERSION_MICRO_T5 0 +#define CH_WARN (adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)enum {
@@ -66,7 +70,9 @@ enum {enum {MEM_EDC0 ,MEM_EDC1 , -MEM_MC +MEM_MC , +MEM_MC0 =MEM_MC , +MEM_MC1 };enum {
@@ -74,8 +80,10 @@ enum {MEMWIN0_BASE =0x1b800 ,MEMWIN1_APERTURE =32768 ,MEMWIN1_BASE =0x28000 , +MEMWIN1_BASE_T5 =0x52000 ,MEMWIN2_APERTURE =65536 ,MEMWIN2_BASE =0x30000 , + MEMWIN2_BASE_T5 = 0x54000, }; enum dev_master {
@@ -504,6 +512,35 @@ struct sge {struct l2t_data ; +#define CHELSIO_CHIP_CODE (version, revision) (((version) << 4) | (revision)) +#define CHELSIO_CHIP_VERSION (code) ((code) >> 4) +#define CHELSIO_CHIP_RELEASE (code) ((code) & 0xf) + +#define CHELSIO_T4 0x4 +#define CHELSIO_T5 0x5 + +enum chip_type { +T4_A1 =CHELSIO_CHIP_CODE (CHELSIO_T4 ,0 ), +T4_A2 =CHELSIO_CHIP_CODE (CHELSIO_T4 ,1 ), +T4_A3 =CHELSIO_CHIP_CODE (CHELSIO_T4 ,2 ), +T4_FIRST_REV =T4_A1 , +T4_LAST_REV =T4_A3 , + +T5_A1 =CHELSIO_CHIP_CODE (CHELSIO_T5 ,0 ), +T5_FIRST_REV =T5_A1 , +T5_LAST_REV =T5_A1 , +}; + +#ifdef CONFIG_PCI_IOV + +/* T4 - 4 PFs support SRIOV +* T5 - 8 PFs support SRIOV +*/ +#define NUM_OF_PF_WITH_SRIOV_T4 4 +#define NUM_OF_PF_WITH_SRIOV_T5 8 + +#endif +struct adapter {void __iomem *regs;struct pci_dev *pdev;
@@ -511,6 +548,7 @@ struct adapter {unsigned int mbox;unsigned int fn;unsigned int flags; +enum chip_type chip;int msg_enable;
@@ -673,6 +711,16 @@ enum { VLAN_REWRITE }; +static inline int is_t5 (enum chip_type chip) +{ +return (chip >=T5_FIRST_REV && chip <=T5_LAST_REV ); +} + +static inline int is_t4 (enum chip_type chip) +{ +return (chip >=T4_FIRST_REV && chip <=T4_LAST_REV ); +} +static inline u32 t4_read_reg (struct adapter *adap,u32 reg_addr) {return readl (adap->regs + reg_addr);
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +45 -0
69 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +1 -1
@@ -574,7 +574,7 @@ struct fw_eth_tx_pkt_vm_wr {__be16 vlantci; }; -#define FW_CMD_MAX_TIMEOUT 3000 +#define FW_CMD_MAX_TIMEOUT 10000/* * If a host driver does a HELLO and discovers that there's already a MASTER
Signature · 1 line
1.7.1
PATCH 3/22 cxgb4: Initialize T5
In reply to Vipul PandyaFrom: Santosh Rastapur <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 85 ++++++++++--- drivers/net/ethernet/chelsio/cxgb4/sge.c | 37 ++++-- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 152 ++++++++++++++++++++--- drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 1 - 4 files changed, 227 insertions(+), 48 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +65 -20
@@ -233,7 +233,9 @@ static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = { };#define FW_FNAME "cxgb4/t4fw.bin" +#define FW5_FNAME "cxgb4/t5fw.bin"#define FW_CFNAME "cxgb4/t4-config.txt" +#define FW5_CFNAME "cxgb4/t5-config.txt"MODULE_DESCRIPTION (DRV_DESC );MODULE_AUTHOR ("Chelsio Communications" );
@@ -241,6 +243,7 @@ MODULE_LICENSE("Dual BSD/GPL");MODULE_VERSION (DRV_VERSION );MODULE_DEVICE_TABLE (pci, cxgb4_pci_tbl);MODULE_FIRMWARE (FW_FNAME ); +MODULE_FIRMWARE (FW5_FNAME );/* * Normally we're willing to become the firmware's Master PF but will be happy
@@ -319,10 +322,14 @@ static bool vf_acls;module_param (vf_acls, bool,0644 );MODULE_PARM_DESC (vf_acls,"if set enable virtualization L2 ACL enforcement" ); -static unsigned int num_vf[4 ]; +/* Since T5 has more num of PFs, using NUM_OF_PF_WITH_SRIOV_T5 +* macro as num_vf array size +*/ +static unsigned int num_vf[NUM_OF_PF_WITH_SRIOV_T5 ];module_param_array (num_vf, uint,NULL ,0644 ); -MODULE_PARM_DESC (num_vf,"number of VFs for each of PFs 0-3" ); +MODULE_PARM_DESC (num_vf, +"number of VFs for each of PFs 0-3 for T4 and PFs 0-7 for T5" );#endif /*
@@ -1002,21 +1009,36 @@ freeout: t4_free_sge_resources(adap);static int upgrade_fw (struct adapter *adap) {int ret; -u32 vers; +u32 vers, exp_major;const struct fw_hdr *hdr;const struct firmware *fw;struct device *dev = adap->pdev_dev; +char *fw_file_name; - ret =request_firmware (&fw,FW_FNAME , dev); +switch (CHELSIO_CHIP_VERSION (adap->chip)) { +case CHELSIO_T4 : + fw_file_name =FW_FNAME ; + exp_major =FW_VERSION_MAJOR ; +break ; +case CHELSIO_T5 : + fw_file_name =FW5_FNAME ; + exp_major =FW_VERSION_MAJOR_T5 ; +break ; +default : +dev_err (dev,"Unsupported chip type, %x\n" , adap->chip); +return -EINVAL ; + } + + ret =request_firmware (&fw, fw_file_name, dev);if (ret <0 ) { -dev_err (dev,"unable to load firmware image " FW_FNAME -", error %d\n" , ret); +dev_err (dev,"unable to load firmware image %s, error %d\n" , + fw_file_name, ret);return ret; } hdr = (const struct fw_hdr *)fw->data; vers =ntohl (hdr->fw_ver); -if (FW_HDR_FW_VER_MAJOR_GET (vers) !=FW_VERSION_MAJOR ) { +if (FW_HDR_FW_VER_MAJOR_GET (vers) != exp_major) { ret = -EINVAL ;/* wrong major version, won't do */ goto out; }
@@ -1024,18 +1046,15 @@ static int upgrade_fw(struct adapter *adap)/* * If the flash FW is unusable or we found something newer, load it. */ -if (FW_HDR_FW_VER_MAJOR_GET (adap->params.fw_vers) !=FW_VERSION_MAJOR || +if (FW_HDR_FW_VER_MAJOR_GET (adap->params.fw_vers) != exp_major || vers > adap->params.fw_vers) {dev_info (dev,"upgrading firmware ...\n" ); ret =t4_fw_upgrade (adap, adap->mbox, fw->data, fw->size,/*force=*/ false);if (!ret) -dev_info (dev,"firmware successfully upgraded to " -FW_FNAME " (%d.%d.%d.%d)\n" , -FW_HDR_FW_VER_MAJOR_GET (vers), -FW_HDR_FW_VER_MINOR_GET (vers), -FW_HDR_FW_VER_MICRO_GET (vers), -FW_HDR_FW_VER_BUILD_GET (vers)); +dev_info (dev, +"firmware upgraded to version %pI4 from %s\n" , + &hdr->fw_ver, fw_file_name);else dev_err (dev,"firmware upgrade failed! err=%d\n" , -ret); }else {
@@ -1413,7 +1432,8 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,*/ static inline unsigned int mk_adap_vers (const struct adapter *ap) { -return 4 | (ap->params.rev <<10 ) | (1 <<16 ); +return CHELSIO_CHIP_VERSION (ap->chip) | + (CHELSIO_CHIP_RELEASE (ap->chip) <<10 ) | (1 <<16 ); } static void reg_block_dump(struct adapter *ap, void *buf, unsigned int start,
@@ -3745,6 +3765,7 @@ static int adap_init0_config(struct adapter *adapter, int reset)unsigned long mtype =0 , maddr =0 ;u32 finiver, finicsum, cfcsum;int ret, using_flash; +char *fw_config_file, fw_config_file_path[256 ];/* * Reset device if necessary.
@@ -3761,7 +3782,21 @@ static int adap_init0_config(struct adapter *adapter, int reset)* then use that. Otherwise, use the configuration file stored * in the adapter flash ... */ - ret =request_firmware (&cf,FW_CFNAME , adapter->pdev_dev); +switch (CHELSIO_CHIP_VERSION (adapter->chip)) { +case CHELSIO_T4 : + fw_config_file =FW_CFNAME ; +break ; +case CHELSIO_T5 : + fw_config_file =FW5_CFNAME ; +break ; +default : +dev_err (adapter->pdev_dev,"Device %d is not supported\n" , + adapter->pdev->device); + ret = -EINVAL ; + goto bye; + } + + ret =request_firmware (&cf, fw_config_file, adapter->pdev_dev);if (ret <0 ) { using_flash =1 ; mtype =FW_MEMTYPE_CF_FLASH ;
@@ -3877,6 +3912,7 @@ static int adap_init0_config(struct adapter *adapter, int reset)if (ret <0 ) goto bye; +sprintf (fw_config_file_path,"/lib/firmware/%s" , fw_config_file);/* * Return successfully and note that we're operating with parameters * not supplied by the driver, rather than from hard-wired
@@ -3887,7 +3923,7 @@ static int adap_init0_config(struct adapter *adapter, int reset)"Configuration File %s, version %#x, computed checksum %#x\n" , (using_flash ?"in device FLASH" - :"/lib/firmware/" FW_CFNAME ), + : fw_config_file_path), finiver, cfcsum);return 0 ;
@@ -4015,8 +4051,10 @@ static int adap_init0_no_config(struct adapter *adapter, int reset)*/ {int pf, vf; +int max_no_pf =is_t4 (adapter->chip) ?NUM_OF_PF_WITH_SRIOV_T4 : +NUM_OF_PF_WITH_SRIOV_T5 ; -for (pf =0 ; pf <ARRAY_SIZE (num_vf); pf++) { +for (pf =0 ; pf < max_no_pf; pf++) {if (num_vf[pf] <=0 )continue ;
@@ -4814,7 +4852,8 @@ static void print_port_info(const struct net_device *dev)sprintf (bufp,"BASE-%s" , base[pi->port_type]);netdev_info (dev,"Chelsio %s rev %d %s %sNIC PCIe x%d%s%s\n" , - adap->params.vpd.id, adap->params.rev, buf, + adap->params.vpd.id, +CHELSIO_CHIP_RELEASE (adap->params.rev), buf,is_offload (adap) ?"R" :"" , adap->params.pci.width, spd, (adap->flags &USING_MSIX ) ?" MSI-X" : (adap->flags &USING_MSI ) ?" MSI" :"" );
@@ -4861,6 +4900,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)struct port_info *pi;bool highdma = false;struct adapter *adapter =NULL ; +#ifdef CONFIG_PCI_IOV +int max_no_pf; +#endif printk_once (KERN_INFO "%s - version %s\n" ,DRV_DESC ,DRV_VERSION );
@@ -5052,7 +5094,10 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) sriov: #ifdef CONFIG_PCI_IOV -if (func <ARRAY_SIZE (num_vf) && num_vf[func] >0 ) + max_no_pf =is_t4 (adapter->chip) ?NUM_OF_PF_WITH_SRIOV_T4 : +NUM_OF_PF_WITH_SRIOV_T5 ; + +if (func < max_no_pf && num_vf[func] >0 )if (pci_enable_sriov (pdev, num_vf[func]) ==0 ) dev_info(&pdev->dev, "instantiated %u virtual functions\n",
drivers/net/ethernet/chelsio/cxgb4/sge.c +27 -10
@@ -506,10 +506,14 @@ static void unmap_rx_buf(struct adapter *adap, struct sge_fl *q)static inline void ring_fl_db (struct adapter *adap,struct sge_fl *q) { +u32 val;if (q->pend_cred >=8 ) { + val =PIDX (q->pend_cred /8 ); +if (!is_t4 (adap->chip)) + val |=DBTYPE (1 );wmb ();t4_write_reg (adap,MYPF_REG (SGE_PF_KDOORBELL ),DBPRIO (1 ) | -QID (q->cntxt_id) |PIDX (q->pend_cred /8 )); +QID (q->cntxt_id) | val); q->pend_cred &=7 ; } }
@@ -1555,7 +1559,6 @@ static noinline int handle_trace_pkt(struct adapter *adap, const struct pkt_gl *gl) {struct sk_buff *skb; -struct cpl_trace_pkt *p; skb =cxgb4_pktgl_to_skb (gl,RX_PULL_LEN ,RX_PULL_LEN );if (unlikely (!skb)) {
@@ -1563,8 +1566,11 @@ static noinline int handle_trace_pkt(struct adapter *adap,return 0 ; } - p = (struct cpl_trace_pkt *)skb->data; -__skb_pull (skb,sizeof (*p)); +if (is_t4 (adap->chip)) +__skb_pull (skb,sizeof (struct cpl_trace_pkt )); +else +__skb_pull (skb,sizeof (struct cpl_t5_trace_pkt )); +skb_reset_mac_header (skb); skb->protocol =htons (0xffff ); skb->dev = adap->port[0 ];
@@ -1625,8 +1631,10 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,const struct cpl_rx_pkt *pkt; struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);struct sge *s = &q->adap->sge; +int cpl_trace_pkt =is_t4 (q->adap->chip) ? +CPL_TRACE_PKT :CPL_TRACE_PKT_T5 ; -if (unlikely (*(u8 *)rsp ==CPL_TRACE_PKT )) +if (unlikely (*(u8 *)rsp == cpl_trace_pkt))return handle_trace_pkt (q->adap, si); pkt = (const struct cpl_rx_pkt *)rsp;
@@ -2587,11 +2595,20 @@ static int t4_sge_init_hard(struct adapter *adap)* Set up to drop DOORBELL writes when the DOORBELL FIFO overflows * and generate an interrupt when this occurs so we can recover. */ -t4_set_reg_field (adap,A_SGE_DBFIFO_STATUS , -V_HP_INT_THRESH (M_HP_INT_THRESH ) | -V_LP_INT_THRESH (M_LP_INT_THRESH ), -V_HP_INT_THRESH (dbfifo_int_thresh) | -V_LP_INT_THRESH (dbfifo_int_thresh)); +if (is_t4 (adap->chip)) { +t4_set_reg_field (adap,A_SGE_DBFIFO_STATUS , +V_HP_INT_THRESH (M_HP_INT_THRESH ) | +V_LP_INT_THRESH (M_LP_INT_THRESH ), +V_HP_INT_THRESH (dbfifo_int_thresh) | +V_LP_INT_THRESH (dbfifo_int_thresh)); + }else { +t4_set_reg_field (adap,A_SGE_DBFIFO_STATUS , +V_LP_INT_THRESH_T5 (M_LP_INT_THRESH_T5 ), +V_LP_INT_THRESH_T5 (dbfifo_int_thresh)); +t4_set_reg_field (adap,SGE_DBFIFO_STATUS2 , +V_HP_INT_THRESH_T5 (M_HP_INT_THRESH_T5 ), +V_HP_INT_THRESH_T5 (dbfifo_int_thresh)); + }t4_set_reg_field (adap,A_SGE_DOORBELL_CONTROL ,F_ENABLE_DROP ,F_ENABLE_DROP );
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +135 -17
264 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +0 -1
@@ -47,7 +47,6 @@ enum {TCB_SIZE =128 ,/* TCB size */ NMTUS =16 ,/* size of MTU table */ NCCTRL_WIN =32 ,/* # of congestion control windows */ -NEXACT_MAC =336 ,/* # of exact MAC address filters */ L2T_SIZE =4096 ,/* # of L2T entries */ MBOX_LEN =64 ,/* mailbox size in bytes */ TRACE_LEN = 112, /* length of trace data and mask */
Signature · 1 line
1.7.1
A message that is not in the archive (sent off-list or not yet received): 1363088794-31453-1-git-send-email-vipul-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org
PATCH 4/22 cxgb4: Dump T5 registers
From: Santosh Rastapur <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 452 ++++++++++++++++++++++- 1 files changed, 448 insertions(+), 4 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +448 -4
@@ -1340,10 +1340,15 @@ static int get_sset_count(struct net_device *dev, int sset) }#define T4_REGMAP_SIZE (160 * 1024) +#define T5_REGMAP_SIZE (332 * 1024)static int get_regs_len (struct net_device *dev) { -return T4_REGMAP_SIZE ; +struct adapter *adap =netdev2adap (dev); +if (is_t4 (adap->chip)) +return T4_REGMAP_SIZE ; +else +return T5_REGMAP_SIZE ; }static int get_eeprom_len (struct net_device *dev)
@@ -1448,7 +1453,7 @@ static void reg_block_dump(struct adapter *ap, void *buf, unsigned int start,static void get_regs (struct net_device *dev,struct ethtool_regs *regs,void *buf) { -static const unsigned int reg_ranges[] = { +static const unsigned int t4_reg_ranges[] = {0x1008 ,0x1108 ,0x1180 ,0x11b4 ,0x11fc ,0x123c ,
@@ -1668,13 +1673,452 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs,0x27e00 ,0x27e04 }; +static const unsigned int t5_reg_ranges[] = { +0x1008 ,0x1148 , +0x1180 ,0x11b4 , +0x11fc ,0x123c , +0x1280 ,0x173c , +0x1800 ,0x18fc , +0x3000 ,0x3028 , +0x3060 ,0x30d8 , +0x30e0 ,0x30fc , +0x3140 ,0x357c , +0x35a8 ,0x35cc , +0x35ec ,0x35ec , +0x3600 ,0x5624 , +0x56cc ,0x575c , +0x580c ,0x5814 , +0x5890 ,0x58bc , +0x5940 ,0x59dc , +0x59fc ,0x5a18 , +0x5a60 ,0x5a9c , +0x5b9c ,0x5bfc , +0x6000 ,0x6040 , +0x6058 ,0x614c , +0x7700 ,0x7798 , +0x77c0 ,0x78fc , +0x7b00 ,0x7c54 , +0x7d00 ,0x7efc , +0x8dc0 ,0x8de0 , +0x8df8 ,0x8e84 , +0x8ea0 ,0x8f84 , +0x8fc0 ,0x90f8 , +0x9400 ,0x9470 , +0x9600 ,0x96f4 , +0x9800 ,0x9808 , +0x9820 ,0x983c , +0x9850 ,0x9864 , +0x9c00 ,0x9c6c , +0x9c80 ,0x9cec , +0x9d00 ,0x9d6c , +0x9d80 ,0x9dec , +0x9e00 ,0x9e6c , +0x9e80 ,0x9eec , +0x9f00 ,0x9f6c , +0x9f80 ,0xa020 , +0xd004 ,0xd03c , +0xdfc0 ,0xdfe0 , +0xe000 ,0x11088 , +0x1109c ,0x1117c , +0x11190 ,0x11204 , +0x19040 ,0x1906c , +0x19078 ,0x19080 , +0x1908c ,0x19124 , +0x19150 ,0x191b0 , +0x191d0 ,0x191e8 , +0x19238 ,0x19290 , +0x193f8 ,0x19474 , +0x19490 ,0x194cc , +0x194f0 ,0x194f8 , +0x19c00 ,0x19c60 , +0x19c94 ,0x19e10 , +0x19e50 ,0x19f34 , +0x19f40 ,0x19f50 , +0x19f90 ,0x19fe4 , +0x1a000 ,0x1a06c , +0x1a0b0 ,0x1a120 , +0x1a128 ,0x1a138 , +0x1a190 ,0x1a1c4 , +0x1a1fc ,0x1a1fc , +0x1e008 ,0x1e00c , +0x1e040 ,0x1e04c , +0x1e284 ,0x1e290 , +0x1e2c0 ,0x1e2c0 , +0x1e2e0 ,0x1e2e0 , +0x1e300 ,0x1e384 , +0x1e3c0 ,0x1e3c8 , +0x1e408 ,0x1e40c , +0x1e440 ,0x1e44c , +0x1e684 ,0x1e690 , +0x1e6c0 ,0x1e6c0 , +0x1e6e0 ,0x1e6e0 , +0x1e700 ,0x1e784 , +0x1e7c0 ,0x1e7c8 , +0x1e808 ,0x1e80c , +0x1e840 ,0x1e84c , +0x1ea84 ,0x1ea90 , +0x1eac0 ,0x1eac0 , +0x1eae0 ,0x1eae0 , +0x1eb00 ,0x1eb84 , +0x1ebc0 ,0x1ebc8 , +0x1ec08 ,0x1ec0c , +0x1ec40 ,0x1ec4c , +0x1ee84 ,0x1ee90 , +0x1eec0 ,0x1eec0 , +0x1eee0 ,0x1eee0 , +0x1ef00 ,0x1ef84 , +0x1efc0 ,0x1efc8 , +0x1f008 ,0x1f00c , +0x1f040 ,0x1f04c , +0x1f284 ,0x1f290 , +0x1f2c0 ,0x1f2c0 , +0x1f2e0 ,0x1f2e0 , +0x1f300 ,0x1f384 , +0x1f3c0 ,0x1f3c8 , +0x1f408 ,0x1f40c , +0x1f440 ,0x1f44c , +0x1f684 ,0x1f690 , +0x1f6c0 ,0x1f6c0 , +0x1f6e0 ,0x1f6e0 , +0x1f700 ,0x1f784 , +0x1f7c0 ,0x1f7c8 , +0x1f808 ,0x1f80c , +0x1f840 ,0x1f84c , +0x1fa84 ,0x1fa90 , +0x1fac0 ,0x1fac0 , +0x1fae0 ,0x1fae0 , +0x1fb00 ,0x1fb84 , +0x1fbc0 ,0x1fbc8 , +0x1fc08 ,0x1fc0c , +0x1fc40 ,0x1fc4c , +0x1fe84 ,0x1fe90 , +0x1fec0 ,0x1fec0 , +0x1fee0 ,0x1fee0 , +0x1ff00 ,0x1ff84 , +0x1ffc0 ,0x1ffc8 , +0x30000 ,0x30030 , +0x30100 ,0x30144 , +0x30190 ,0x301d0 , +0x30200 ,0x30318 , +0x30400 ,0x3052c , +0x30540 ,0x3061c , +0x30800 ,0x30834 , +0x308c0 ,0x30908 , +0x30910 ,0x309ac , +0x30a00 ,0x30a04 , +0x30a0c ,0x30a2c , +0x30a44 ,0x30a50 , +0x30a74 ,0x30c24 , +0x30d08 ,0x30d14 , +0x30d1c ,0x30d20 , +0x30d3c ,0x30d50 , +0x31200 ,0x3120c , +0x31220 ,0x31220 , +0x31240 ,0x31240 , +0x31600 ,0x31600 , +0x31608 ,0x3160c , +0x31a00 ,0x31a1c , +0x31e04 ,0x31e20 , +0x31e38 ,0x31e3c , +0x31e80 ,0x31e80 , +0x31e88 ,0x31ea8 , +0x31eb0 ,0x31eb4 , +0x31ec8 ,0x31ed4 , +0x31fb8 ,0x32004 , +0x32208 ,0x3223c , +0x32600 ,0x32630 , +0x32a00 ,0x32abc , +0x32b00 ,0x32b70 , +0x33000 ,0x33048 , +0x33060 ,0x3309c , +0x330f0 ,0x33148 , +0x33160 ,0x3319c , +0x331f0 ,0x332e4 , +0x332f8 ,0x333e4 , +0x333f8 ,0x33448 , +0x33460 ,0x3349c , +0x334f0 ,0x33548 , +0x33560 ,0x3359c , +0x335f0 ,0x336e4 , +0x336f8 ,0x337e4 , +0x337f8 ,0x337fc , +0x33814 ,0x33814 , +0x3382c ,0x3382c , +0x33880 ,0x3388c , +0x338e8 ,0x338ec , +0x33900 ,0x33948 , +0x33960 ,0x3399c , +0x339f0 ,0x33ae4 , +0x33af8 ,0x33b10 , +0x33b28 ,0x33b28 , +0x33b3c ,0x33b50 , +0x33bf0 ,0x33c10 , +0x33c28 ,0x33c28 , +0x33c3c ,0x33c50 , +0x33cf0 ,0x33cfc , +0x34000 ,0x34030 , +0x34100 ,0x34144 , +0x34190 ,0x341d0 , +0x34200 ,0x34318 , +0x34400 ,0x3452c , +0x34540 ,0x3461c , +0x34800 ,0x34834 , +0x348c0 ,0x34908 , +0x34910 ,0x349ac , +0x34a00 ,0x34a04 , +0x34a0c ,0x34a2c , +0x34a44 ,0x34a50 , +0x34a74 ,0x34c24 , +0x34d08 ,0x34d14 , +0x34d1c ,0x34d20 , +0x34d3c ,0x34d50 , +0x35200 ,0x3520c , +0x35220 ,0x35220 , +0x35240 ,0x35240 , +0x35600 ,0x35600 , +0x35608 ,0x3560c , +0x35a00 ,0x35a1c , +0x35e04 ,0x35e20 , +0x35e38 ,0x35e3c , +0x35e80 ,0x35e80 , +0x35e88 ,0x35ea8 , +0x35eb0 ,0x35eb4 , +0x35ec8 ,0x35ed4 , +0x35fb8 ,0x36004 , +0x36208 ,0x3623c , +0x36600 ,0x36630 , +0x36a00 ,0x36abc , +0x36b00 ,0x36b70 , +0x37000 ,0x37048 , +0x37060 ,0x3709c , +0x370f0 ,0x37148 , +0x37160 ,0x3719c , +0x371f0 ,0x372e4 , +0x372f8 ,0x373e4 , +0x373f8 ,0x37448 , +0x37460 ,0x3749c , +0x374f0 ,0x37548 , +0x37560 ,0x3759c , +0x375f0 ,0x376e4 , +0x376f8 ,0x377e4 , +0x377f8 ,0x377fc , +0x37814 ,0x37814 , +0x3782c ,0x3782c , +0x37880 ,0x3788c , +0x378e8 ,0x378ec , +0x37900 ,0x37948 , +0x37960 ,0x3799c , +0x379f0 ,0x37ae4 , +0x37af8 ,0x37b10 , +0x37b28 ,0x37b28 , +0x37b3c ,0x37b50 , +0x37bf0 ,0x37c10 , +0x37c28 ,0x37c28 , +0x37c3c ,0x37c50 , +0x37cf0 ,0x37cfc , +0x38000 ,0x38030 , +0x38100 ,0x38144 , +0x38190 ,0x381d0 , +0x38200 ,0x38318 , +0x38400 ,0x3852c , +0x38540 ,0x3861c , +0x38800 ,0x38834 , +0x388c0 ,0x38908 , +0x38910 ,0x389ac , +0x38a00 ,0x38a04 , +0x38a0c ,0x38a2c , +0x38a44 ,0x38a50 , +0x38a74 ,0x38c24 , +0x38d08 ,0x38d14 , +0x38d1c ,0x38d20 , +0x38d3c ,0x38d50 , +0x39200 ,0x3920c , +0x39220 ,0x39220 , +0x39240 ,0x39240 , +0x39600 ,0x39600 , +0x39608 ,0x3960c , +0x39a00 ,0x39a1c , +0x39e04 ,0x39e20 , +0x39e38 ,0x39e3c , +0x39e80 ,0x39e80 , +0x39e88 ,0x39ea8 , +0x39eb0 ,0x39eb4 , +0x39ec8 ,0x39ed4 , +0x39fb8 ,0x3a004 , +0x3a208 ,0x3a23c , +0x3a600 ,0x3a630 , +0x3aa00 ,0x3aabc , +0x3ab00 ,0x3ab70 , +0x3b000 ,0x3b048 , +0x3b060 ,0x3b09c , +0x3b0f0 ,0x3b148 , +0x3b160 ,0x3b19c , +0x3b1f0 ,0x3b2e4 , +0x3b2f8 ,0x3b3e4 , +0x3b3f8 ,0x3b448 , +0x3b460 ,0x3b49c , +0x3b4f0 ,0x3b548 , +0x3b560 ,0x3b59c , +0x3b5f0 ,0x3b6e4 , +0x3b6f8 ,0x3b7e4 , +0x3b7f8 ,0x3b7fc , +0x3b814 ,0x3b814 , +0x3b82c ,0x3b82c , +0x3b880 ,0x3b88c , +0x3b8e8 ,0x3b8ec , +0x3b900 ,0x3b948 , +0x3b960 ,0x3b99c , +0x3b9f0 ,0x3bae4 , +0x3baf8 ,0x3bb10 , +0x3bb28 ,0x3bb28 , +0x3bb3c ,0x3bb50 , +0x3bbf0 ,0x3bc10 , +0x3bc28 ,0x3bc28 , +0x3bc3c ,0x3bc50 , +0x3bcf0 ,0x3bcfc , +0x3c000 ,0x3c030 , +0x3c100 ,0x3c144 , +0x3c190 ,0x3c1d0 , +0x3c200 ,0x3c318 , +0x3c400 ,0x3c52c , +0x3c540 ,0x3c61c , +0x3c800 ,0x3c834 , +0x3c8c0 ,0x3c908 , +0x3c910 ,0x3c9ac , +0x3ca00 ,0x3ca04 , +0x3ca0c ,0x3ca2c , +0x3ca44 ,0x3ca50 , +0x3ca74 ,0x3cc24 , +0x3cd08 ,0x3cd14 , +0x3cd1c ,0x3cd20 , +0x3cd3c ,0x3cd50 , +0x3d200 ,0x3d20c , +0x3d220 ,0x3d220 , +0x3d240 ,0x3d240 , +0x3d600 ,0x3d600 , +0x3d608 ,0x3d60c , +0x3da00 ,0x3da1c , +0x3de04 ,0x3de20 , +0x3de38 ,0x3de3c , +0x3de80 ,0x3de80 , +0x3de88 ,0x3dea8 , +0x3deb0 ,0x3deb4 , +0x3dec8 ,0x3ded4 , +0x3dfb8 ,0x3e004 , +0x3e208 ,0x3e23c , +0x3e600 ,0x3e630 , +0x3ea00 ,0x3eabc , +0x3eb00 ,0x3eb70 , +0x3f000 ,0x3f048 , +0x3f060 ,0x3f09c , +0x3f0f0 ,0x3f148 , +0x3f160 ,0x3f19c , +0x3f1f0 ,0x3f2e4 , +0x3f2f8 ,0x3f3e4 , +0x3f3f8 ,0x3f448 , +0x3f460 ,0x3f49c , +0x3f4f0 ,0x3f548 , +0x3f560 ,0x3f59c , +0x3f5f0 ,0x3f6e4 , +0x3f6f8 ,0x3f7e4 , +0x3f7f8 ,0x3f7fc , +0x3f814 ,0x3f814 , +0x3f82c ,0x3f82c , +0x3f880 ,0x3f88c , +0x3f8e8 ,0x3f8ec , +0x3f900 ,0x3f948 , +0x3f960 ,0x3f99c , +0x3f9f0 ,0x3fae4 , +0x3faf8 ,0x3fb10 , +0x3fb28 ,0x3fb28 , +0x3fb3c ,0x3fb50 , +0x3fbf0 ,0x3fc10 , +0x3fc28 ,0x3fc28 , +0x3fc3c ,0x3fc50 , +0x3fcf0 ,0x3fcfc , +0x40000 ,0x4000c , +0x40040 ,0x40068 , +0x40080 ,0x40144 , +0x40180 ,0x4018c , +0x40200 ,0x40298 , +0x402ac ,0x4033c , +0x403f8 ,0x403fc , +0x41300 ,0x413c4 , +0x41400 ,0x4141c , +0x41480 ,0x414d0 , +0x44000 ,0x44078 , +0x440c0 ,0x44278 , +0x442c0 ,0x44478 , +0x444c0 ,0x44678 , +0x446c0 ,0x44878 , +0x448c0 ,0x449fc , +0x45000 ,0x45068 , +0x45080 ,0x45084 , +0x450a0 ,0x450b0 , +0x45200 ,0x45268 , +0x45280 ,0x45284 , +0x452a0 ,0x452b0 , +0x460c0 ,0x460e4 , +0x47000 ,0x4708c , +0x47200 ,0x47250 , +0x47400 ,0x47420 , +0x47600 ,0x47618 , +0x47800 ,0x47814 , +0x48000 ,0x4800c , +0x48040 ,0x48068 , +0x48080 ,0x48144 , +0x48180 ,0x4818c , +0x48200 ,0x48298 , +0x482ac ,0x4833c , +0x483f8 ,0x483fc , +0x49300 ,0x493c4 , +0x49400 ,0x4941c , +0x49480 ,0x494d0 , +0x4c000 ,0x4c078 , +0x4c0c0 ,0x4c278 , +0x4c2c0 ,0x4c478 , +0x4c4c0 ,0x4c678 , +0x4c6c0 ,0x4c878 , +0x4c8c0 ,0x4c9fc , +0x4d000 ,0x4d068 , +0x4d080 ,0x4d084 , +0x4d0a0 ,0x4d0b0 , +0x4d200 ,0x4d268 , +0x4d280 ,0x4d284 , +0x4d2a0 ,0x4d2b0 , +0x4e0c0 ,0x4e0e4 , +0x4f000 ,0x4f08c , +0x4f200 ,0x4f250 , +0x4f400 ,0x4f420 , +0x4f600 ,0x4f618 , +0x4f800 ,0x4f814 , +0x50000 ,0x500cc , +0x50400 ,0x50400 , +0x50800 ,0x508cc , +0x50c00 ,0x50c00 , +0x51000 ,0x5101c , +0x51300 ,0x51308 , + }; +int i;struct adapter *ap =netdev2adap (dev); +static const unsigned int *reg_ranges; +int arr_size =0 , buf_size =0 ; + +if (is_t4 (ap->chip)) { + reg_ranges = &t4_reg_ranges[0 ]; + arr_size =ARRAY_SIZE (t4_reg_ranges); + buf_size =T4_REGMAP_SIZE ; + }else { + reg_ranges = &t5_reg_ranges[0 ]; + arr_size =ARRAY_SIZE (t5_reg_ranges); + buf_size =T5_REGMAP_SIZE ; + } regs->version =mk_adap_vers (ap); -memset (buf,0 ,T4_REGMAP_SIZE ); -for (i =0 ; i <ARRAY_SIZE (reg_ranges); i +=2 ) +memset (buf,0 , buf_size); +for (i =0 ; i < arr_size; i +=2 )reg_block_dump (ap, buf, reg_ranges[i], reg_ranges[i +1 ]); }
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/22 cxgb4: Add T5 write combining support
In reply to a message not in the archiveFrom: Santosh Rastapur <[email protected]>
This patch implements a low latency Write Combining (aka Write Coalescing) work request path. PCIE maps User Space Doorbell BAR2 region writes to the new interface to SGE. SGE pulls a new message from PCIE new interface and if its a coalesced write work request then pushes it for processing. This patch copies coalesced work request to memory mapped BAR2 space.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 2 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 53 +++++++++++++++++++++- drivers/net/ethernet/chelsio/cxgb4/sge.c | 54 +++++++++++++++++++++- 3 files changed, 104 insertions(+), 5 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +2 -0
@@ -439,6 +439,7 @@ struct sge_txq {spinlock_t db_lock;int db_disabled;unsigned short db_pidx; +u64 udb; };struct sge_eth_txq {/* state for an SGE Ethernet Tx queue */
@@ -543,6 +544,7 @@ enum chip_type {struct adapter {void __iomem *regs; +void __iomem *bar2;struct pci_dev *pdev;struct device *pdev_dev;unsigned int mbox;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +51 -2
97 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/sge.c +51 -3
79 lines not on this page · raw message
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerRe: [PATCH net-next 05/22] cxgb4: Add T5 write combining support
From: Vipul Pandya <[email protected]>
Date: Tue, 12 Mar 2013 17:16:17 +0530
drivers/net/ethernet/chelsio/cxgb4/sge.c static void write_sgl(const struct sk_buff *skb, struct sge_txq *q, · line 864
Quoted 4 lines
drivers/net/ethernet/chelsio/cxgb4/sge.c +4
-0+writel (n, adap->bar2 + q->udb +8 ); +#if defined(CONFIG_X86_32 ) || defined(CONFIG_X86_64 ) + asmvolatile ("sfence" : : :"memory" ); +#endif
There is absolutely no way I'm letting anyone put crap like this into a driver.
Use a portable inteface, and if one does not exist create one.
A message that is not in the archive (sent off-list or not yet received): 20130312.081927.1036246728528667686.davem-fT/PcQaiUtIeIZ0/[email protected]
Re: [PATCH net-next 05/22] cxgb4: Add T5 write combining support
Quoted 11 lines · David Miller
From: Vipul Pandya <[email protected]>
Date: Tue, 12 Mar 2013 17:16:17 +0530drivers/net/ethernet/chelsio/cxgb4/sge.c static void write_sgl(const struct sk_buff *skb, struct sge_txq *q, · line 864
Quoted 4 lines
drivers/net/ethernet/chelsio/cxgb4/sge.c +4
-0+writel (n, adap->bar2 + q->udb +8 ); +#if defined(CONFIG_X86_32 ) || defined(CONFIG_X86_64 ) + asmvolatile ("sfence" : : :"memory" ); +#endif There is absolutely no way I'm letting anyone put crap like this into a driver.
Use a portable inteface, and if one does not exist create one.
I guess you'll have to add a wc_wmb() function for all the hw platforms supported by the kernel. I see libibverbs defines this for the user side in include/infiniband/arch.h, and that could be used as the meat of the hw platform-specific implementations. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 513F3EBD.5020504-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org
Re: [PATCH net-next 05/22] cxgb4: Add T5 write combining support
Quoted 11 lines · Steve Wise
Quoted 10 lines · David Miller
From: Vipul Pandya <[email protected]>
Date: Tue, 12 Mar 2013 17:16:17 +0530drivers/net/ethernet/chelsio/cxgb4/sge.c static void write_sgl(const struct sk_buff *skb, struct sge_txq *q, · line 864
Quoted 4 lines
drivers/net/ethernet/chelsio/cxgb4/sge.c +4
-0+writel (n, adap->bar2 + q->udb +8 ); +#if defined(CONFIG_X86_32 ) || defined(CONFIG_X86_64 ) + asmvolatile ("sfence" : : :"memory" ); +#endif There is absolutely no way I'm letting anyone put crap like this into a driver.
Quoted 7 lines
Quoted 1 line
Use a portable inteface, and if one does not exist create one.
I guess you'll have to add a
wc_wmb()function for all the hw platforms supported by the kernel. I see libibverbs defines this for the user side ininclude/infiniband/arch.h, and that could be used as the meat of the hw platform-specific implementations.
I see that normal wmb() code for x86_64 architecture is same as what above #ifdef condition is doing. To be more clear I looked at the assembly code for wmb and find that it is converted into 'sfence' instruction. So, I think above code should be replaced with wmb call which will also take care of portability on different architecture. I will submit the series again soon.
I would like to request RDMA/cxgb4 and csiostor driver maintainer to review the series if it has not been done already. It would be great If I can include review comments from them in my next version of series. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH net-next 05/22] cxgb4: Add T5 write combining support
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
drivers/net/ethernet/chelsio/cxgb4/sge.c static void write_sgl(const struct sk_buff *skb, struct sge_txq *q, · line 864
Quoted 4 lines
drivers/net/ethernet/chelsio/cxgb4/sge.c +4
-0+writel (n, adap->bar2 + q->udb +8 ); +#if defined(CONFIG_X86_32 ) || defined(CONFIG_X86_64 ) + asmvolatile ("sfence" : : :"memory" ); +#endif There is absolutely no way I'm letting anyone put crap like this into a driver.
Quoted 7 lines
Quoted 1 line
Use a portable inteface, and if one does not exist create one.
I guess you'll have to add a
wc_wmb()function for all the hw platforms supported by the kernel. I see libibverbs defines this for the user side ininclude/infiniband/arch.h, and that could be used as the meat of the hw platform-specific implementations.
Quoted 8 lines
I see that normal
wmb()code forx86_64architecture is same as what above #ifdef condition is doing. To be more clear I looked at the assembly code for wmb and find that it is converted into 'sfence' instruction. So, I think above code should be replaced with wmb call which will also take care of portability on different architecture. I will submit the series again soon.From my recollection of the x86 architecture, the memory barriers
are hardly ever needed, certainly not in the places where, for example a ppc needs them. I'd actually suspect that the normal wmb() for x86 should be a nop.
About the only place where any on the fence instructions are needed are in relation to write combining accesses.
In particular I don't believe they are ever needed to synchronise uncached accesses with each other, or with cached accesses (which are snooped).
David
Re: [PATCH net-next 05/22] cxgb4: Add T5 write combining support
Quoted 1 line · David Laight
From my recollection of the x86 architecture, the memory barriers are hardly ever needed, certainly not in the places where, for example a ppc needs them. I'd actually suspect that the normal
wmb()for x86 should be a nop. About the only place where any on the fence instructions are needed are in relation to write combining accesses. In particular I don't believe they are ever needed to synchronise uncached accesses with each other, or with cached accesses (which are snooped). David
The question at hand is how should we indicate that we're finished
with a Write Combined set of stores in an architecturally neutral manner? Is wmb() a good approach? Vipul has noted that the iWarp code uses a new "wc_wmb()" for this purpose which seems to be the same _currently_ as wmb() for all current platforms. I presume that the iWarp folks pick a new name to offer themselves some cover in the future.
And yes, the code sequence that was accidentally included in Vipul's
previous patches should never have been submitted for inclusion in kernel.org. It got missed in our internal reviews and I apologize for that.
Casey
PATCH 7/22 cxgb4: Add T5 debugfs support
In reply to a message not in the archiveFrom: Santosh Rastapur <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 3 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 55 +++++++++--- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 104 ++++++++++++++++------ 3 files changed, 119 insertions(+), 43 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +2 -1
@@ -908,7 +908,8 @@ int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid, int start, int n, const u16 *rspq, unsigned int nrspq);int t4_config_glbl_rss (struct adapter *adapter,int mbox,unsigned int mode,unsigned int flags); -int t4_mc_read (struct adapter *adap,u32 addr,__be32 *data,u64 *parity); +int t4_mc_read (struct adapter *adap,int idx,u32 addr,__be32 *data, +u64 *parity);int t4_edc_read (struct adapter *adap,int idx,u32 addr,__be32 *data,u64 *parity);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +42 -13
85 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +75 -29
179 lines not on this page · raw message
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/22 cxgb4: Add T5 PCI ids
In reply to a message not in the archiveFrom: Santosh Rastapur <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 38 +++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +38 -0
@@ -229,6 +229,44 @@ static DEFINE_PCI_DEVICE_TABLE(cxgb4_pci_tbl) = {CH_DEVICE (0x440a ,4 ),CH_DEVICE (0x440d ,4 ),CH_DEVICE (0x440e ,4 ), +CH_DEVICE (0x5001 ,5 ), +CH_DEVICE (0x5002 ,5 ), +CH_DEVICE (0x5003 ,5 ), +CH_DEVICE (0x5004 ,5 ), +CH_DEVICE (0x5005 ,5 ), +CH_DEVICE (0x5006 ,5 ), +CH_DEVICE (0x5007 ,5 ), +CH_DEVICE (0x5008 ,5 ), +CH_DEVICE (0x5009 ,5 ), +CH_DEVICE (0x500A ,5 ), +CH_DEVICE (0x500B ,5 ), +CH_DEVICE (0x500C ,5 ), +CH_DEVICE (0x500D ,5 ), +CH_DEVICE (0x500E ,5 ), +CH_DEVICE (0x500F ,5 ), +CH_DEVICE (0x5010 ,5 ), +CH_DEVICE (0x5011 ,5 ), +CH_DEVICE (0x5012 ,5 ), +CH_DEVICE (0x5013 ,5 ), +CH_DEVICE (0x5401 ,5 ), +CH_DEVICE (0x5402 ,5 ), +CH_DEVICE (0x5403 ,5 ), +CH_DEVICE (0x5404 ,5 ), +CH_DEVICE (0x5405 ,5 ), +CH_DEVICE (0x5406 ,5 ), +CH_DEVICE (0x5407 ,5 ), +CH_DEVICE (0x5408 ,5 ), +CH_DEVICE (0x5409 ,5 ), +CH_DEVICE (0x540A ,5 ), +CH_DEVICE (0x540B ,5 ), +CH_DEVICE (0x540C ,5 ), +CH_DEVICE (0x540D ,5 ), +CH_DEVICE (0x540E ,5 ), +CH_DEVICE (0x540F ,5 ), +CH_DEVICE (0x5410 ,5 ), +CH_DEVICE (0x5411 ,5 ), +CH_DEVICE (0x5412 ,5 ), +CH_DEVICE (0x5413 ,5 ), { 0, } };
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/22 cxgb4: Enable doorbell drop recovery only for T4 adapter
In reply to Vipul PandyaFrom: Santosh Rastapur <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 87 ++++++++++++++++++---- 1 files changed, 71 insertions(+), 16 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +71 -16
@@ -3227,10 +3227,18 @@ EXPORT_SYMBOL(cxgb4_port_chan);unsigned int cxgb4_dbfifo_count (const struct net_device *dev,int lpfifo) {struct adapter *adap =netdev2adap (dev); -u32 v; +u32 v1, v2, lp_count, hp_count; - v =t4_read_reg (adap,A_SGE_DBFIFO_STATUS ); -return lpfifo ?G_LP_COUNT (v) :G_HP_COUNT (v); + v1 =t4_read_reg (adap,A_SGE_DBFIFO_STATUS ); + v2 =t4_read_reg (adap,SGE_DBFIFO_STATUS2 ); +if (is_t4 (adap->chip)) { + lp_count =G_LP_COUNT (v1); + hp_count =G_HP_COUNT (v1); + }else { + lp_count =G_LP_COUNT_T5 (v1); + hp_count =G_HP_COUNT_T5 (v2); + } +return lpfifo ? lp_count : hp_count; }EXPORT_SYMBOL (cxgb4_dbfifo_count);
@@ -3368,14 +3376,23 @@ static struct notifier_block cxgb4_netevent_nb = {static void drain_db_fifo (struct adapter *adap,int usecs) { -u32 v; +u32 v1, v2, lp_count, hp_count;do { + v1 =t4_read_reg (adap,A_SGE_DBFIFO_STATUS ); + v2 =t4_read_reg (adap,SGE_DBFIFO_STATUS2 ); +if (is_t4 (adap->chip)) { + lp_count =G_LP_COUNT (v1); + hp_count =G_HP_COUNT (v1); + }else { + lp_count =G_LP_COUNT_T5 (v1); + hp_count =G_HP_COUNT_T5 (v2); + } + +if (lp_count ==0 && hp_count ==0 ) +break ;set_current_state (TASK_UNINTERRUPTIBLE );schedule_timeout (usecs_to_jiffies (usecs)); - v =t4_read_reg (adap,A_SGE_DBFIFO_STATUS ); -if (G_LP_COUNT (v) ==0 &&G_HP_COUNT (v) ==0 ) -break ; }while (1 ); }
@@ -3484,24 +3501,62 @@ static void process_db_drop(struct work_struct *work) adap = container_of(work, struct adapter, db_drop_task); +if (is_t4 (adap->chip)) { +disable_dbs (adap); +notify_rdma_uld (adap,CXGB4_CONTROL_DB_DROP ); +drain_db_fifo (adap,1 ); +recover_all_queues (adap); +enable_dbs (adap); + }else { +u32 dropped_db =t4_read_reg (adap,0x010ac ); +u16 qid = (dropped_db >>15 ) &0x1ffff ; +u16 pidx_inc = dropped_db &0x1fff ; +unsigned int s_qpp; +unsigned short udb_density; +unsigned long qpshift; +int page; +u32 udb; + +dev_warn (adap->pdev_dev, +"Dropped DB 0x%x qid %d bar2 %d coalesce %d pidx %d\n" , + dropped_db, qid, + (dropped_db >>14 ) &1 , + (dropped_db >>13 ) &1 , + pidx_inc); + +drain_db_fifo (adap,1 ); + + s_qpp =QUEUESPERPAGEPF1 * adap->fn; + udb_density =1 <<QUEUESPERPAGEPF0_GET (t4_read_reg (adap, +SGE_EGRESS_QUEUES_PER_PAGE_PF ) >> s_qpp); + qpshift =PAGE_SHIFT -ilog2 (udb_density); + udb = qid << qpshift; + udb &=PAGE_MASK ; + page = udb /PAGE_SIZE ; + udb += (qid - (page * udb_density)) *128 ; + +writel (PIDX (pidx_inc), adap->bar2 + udb +8 ); + +/* Re-enable BAR2 WC */ +t4_set_reg_field (adap,0x10b0 ,1 <<15 ,1 <<15 ); + } +t4_set_reg_field (adap,A_SGE_DOORBELL_CONTROL ,F_DROPPED_DB ,0 ); -disable_dbs (adap); -notify_rdma_uld (adap,CXGB4_CONTROL_DB_DROP ); -drain_db_fifo (adap,1 ); -recover_all_queues (adap); -enable_dbs (adap); }void t4_db_full (struct adapter *adap) { -t4_set_reg_field (adap,SGE_INT_ENABLE3 , -DBFIFO_HP_INT |DBFIFO_LP_INT ,0 ); -queue_work (workq, &adap->db_full_task); +if (is_t4 (adap->chip)) { +t4_set_reg_field (adap,SGE_INT_ENABLE3 , +DBFIFO_HP_INT |DBFIFO_LP_INT ,0 ); +queue_work (workq, &adap->db_full_task); + } }void t4_db_dropped (struct adapter *adap) { -queue_work (workq, &adap->db_drop_task); +if (is_t4 (adap->chip)) +queue_work (workq, &adap->db_drop_task); }static void uld_attach (struct adapter *adap,unsigned int uld)
Signature · 1 line
1.7.1
PATCH 9/22 cxgb4: Update driver version and description
In reply to Vipul PandyaFrom: Santosh Rastapur <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +2 -2
@@ -68,8 +68,8 @@#include "t4fw_api.h" #include "l2t.h" -#define DRV_VERSION "1.3.0-ko" -#define DRV_DESC "Chelsio T4 Network Driver" +#define DRV_VERSION "2.0.0-ko" +#define DRV_DESC "Chelsio T4/T5 Network Driver"/* * Max interrupt hold-off timer value in us. Queues fall back to this value
Signature · 1 line
1.7.1
PATCH 10/22 cxgb4: Disable SR-IOV support for PF4-7 for T5
In reply to Vipul PandyaFrom: Santosh Rastapur <[email protected]>
All T5 adapters will only support VFs on PF0-3 despite the ability of the hardware to support them on PF4-7. This keeps our T4 and T5 adapters more similar which simplifies host driver software.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 8 ++++---- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 21 ++++++--------------- 2 files changed, 10 insertions(+), 19 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +4 -4
@@ -534,11 +534,11 @@ enum chip_type {#ifdef CONFIG_PCI_IOV -/* T4 - 4 PFs support SRIOV -* T5 - 8 PFs support SRIOV +/* T4 supports SRIOV on PF0-3 and T5 on PF0-7. However, the Serial +* Configuration initialization for T5 only has SR-IOV functionality enabled +* on PF0-3 in order to simplify everything. */ -#define NUM_OF_PF_WITH_SRIOV_T4 4 -#define NUM_OF_PF_WITH_SRIOV_T5 8 +#define NUM_OF_PF_WITH_SRIOV 4#endif
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +6 -15
@@ -360,14 +360,13 @@ static bool vf_acls;module_param (vf_acls, bool,0644 );MODULE_PARM_DESC (vf_acls,"if set enable virtualization L2 ACL enforcement" ); -/* Since T5 has more num of PFs, using NUM_OF_PF_WITH_SRIOV_T5 -* macro as num_vf array size +/* Configure the number of PCI-E Virtual Function which are to be instantiated +* on SR-IOV Capable Physical Functions. */ -static unsigned int num_vf[NUM_OF_PF_WITH_SRIOV_T5 ]; +static unsigned int num_vf[NUM_OF_PF_WITH_SRIOV ];module_param_array (num_vf, uint,NULL ,0644 ); -MODULE_PARM_DESC (num_vf, -"number of VFs for each of PFs 0-3 for T4 and PFs 0-7 for T5" ); +MODULE_PARM_DESC (num_vf,"number of VFs for each of PFs 0-3" );#endif /*
@@ -4633,10 +4632,8 @@ static int adap_init0_no_config(struct adapter *adapter, int reset)*/ {int pf, vf; -int max_no_pf =is_t4 (adapter->chip) ?NUM_OF_PF_WITH_SRIOV_T4 : -NUM_OF_PF_WITH_SRIOV_T5 ; -for (pf =0 ; pf < max_no_pf; pf++) { +for (pf =0 ; pf <ARRAY_SIZE (num_vf); pf++) {if (num_vf[pf] <=0 )continue ;
@@ -5483,9 +5480,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)struct port_info *pi;bool highdma = false;struct adapter *adapter =NULL ; -#ifdef CONFIG_PCI_IOV -int max_no_pf; -#endif printk_once (KERN_INFO "%s - version %s\n" ,DRV_DESC ,DRV_VERSION );
@@ -5704,10 +5698,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) sriov:#ifdef CONFIG_PCI_IOV - max_no_pf =is_t4 (adapter->chip) ?NUM_OF_PF_WITH_SRIOV_T4 : -NUM_OF_PF_WITH_SRIOV_T5 ; - -if (func < max_no_pf && num_vf[func] >0 ) +if (func <ARRAY_SIZE (num_vf) && num_vf[func] >0 )if (pci_enable_sriov (pdev, num_vf[func]) ==0 ) dev_info(&pdev->dev, "instantiated %u virtual functions\n",
Signature · 1 line
1.7.1
PATCH 11/22 cxgb4vf: Add support for Chelsio T5 adapter
In reply to Vipul PandyaFrom: Santosh Rastapur <[email protected]>
--- drivers/net/ethernet/chelsio/cxgb4vf/adapter.h | 1 + .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 35 ++++++++++++++++++-- drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 8 +++- drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h | 24 +++++++++++++ drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | 14 ++++++-- 5 files changed, 73 insertions(+), 9 deletions(-)
drivers/net/ethernet/chelsio/cxgb4vf/adapter.h +1 -0
@@ -344,6 +344,7 @@ struct adapter {unsigned long registered_device_map;unsigned long open_device_map;unsigned long flags; +enum chip_type chip;struct adapter_params params;/* queue and interrupt resources */
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +32 -3
@@ -54,8 +54,8 @@/* * Generic information about the driver. */ -#define DRV_VERSION "1.0.0" -#define DRV_DESC "Chelsio T4 Virtual Function (VF) Network Driver" +#define DRV_VERSION "2.0.0-ko" +#define DRV_DESC "Chelsio T4/T5 Virtual Function (VF) Network Driver"/* * Module Parameters.
@@ -1050,7 +1050,7 @@ static inline unsigned int mk_adap_vers(const struct adapter *adapter)/* * Chip version 4, revision 0x3f (cxgb4vf). */ -return 4 | (0x3f <<10 ); +return CHELSIO_CHIP_VERSION (adapter->chip) | (0x3f <<10 ); }/*
@@ -2099,6 +2099,15 @@ static int adap_init0(struct adapter *adapter)return err; } +switch (adapter->pdev->device >>12 ) { +case CHELSIO_T4 : + adapter->chip =CHELSIO_CHIP_CODE (CHELSIO_T4 ,0 ); +break ; +case CHELSIO_T5 : + adapter->chip =CHELSIO_CHIP_CODE (CHELSIO_T5 ,0 ); +break ; + } +/* * Grab basic operational parameters. These will predominantly have * been set up by the Physical Function Driver or will be hard coded
@@ -2888,6 +2897,26 @@ static struct pci_device_id cxgb4vf_pci_tbl[] = {CH_DEVICE (0x480a ,0 ),/* T404-bt */ CH_DEVICE (0x480d ,0 ),/* T480-cr */ CH_DEVICE (0x480e ,0 ),/* T440-lp-cr */ +CH_DEVICE (0x5800 ,0 ),/* T580-dbg */ +CH_DEVICE (0x5801 ,0 ),/* T520-cr */ +CH_DEVICE (0x5802 ,0 ),/* T522-cr */ +CH_DEVICE (0x5803 ,0 ),/* T540-cr */ +CH_DEVICE (0x5804 ,0 ),/* T520-bch */ +CH_DEVICE (0x5805 ,0 ),/* T540-bch */ +CH_DEVICE (0x5806 ,0 ),/* T540-ch */ +CH_DEVICE (0x5807 ,0 ),/* T520-so */ +CH_DEVICE (0x5808 ,0 ),/* T520-cx */ +CH_DEVICE (0x5809 ,0 ),/* T520-bt */ +CH_DEVICE (0x580a ,0 ),/* T504-bt */ +CH_DEVICE (0x580b ,0 ),/* T520-sr */ +CH_DEVICE (0x580c ,0 ),/* T504-bt */ +CH_DEVICE (0x580d ,0 ),/* T580-cr */ +CH_DEVICE (0x580e ,0 ),/* T540-lp-cr */ +CH_DEVICE (0x580f ,0 ),/* Amsterdam */ +CH_DEVICE (0x5810 ,0 ),/* T580-lp-cr */ +CH_DEVICE (0x5811 ,0 ),/* T520-lp-cr */ +CH_DEVICE (0x5812 ,0 ),/* T560-cr */ +CH_DEVICE (0x5813 ,0 ),/* T580-cr */ { 0, } };
drivers/net/ethernet/chelsio/cxgb4vf/sge.c +6 -2
@@ -528,17 +528,21 @@ static void unmap_rx_buf(struct adapter *adapter, struct sge_fl *fl)*/ static inline void ring_fl_db (struct adapter *adapter,struct sge_fl *fl) { +u32 val; +/* * The SGE keeps track of its Producer and Consumer Indices in terms * of Egress Queue Units so we can only tell it about integral numbers * of multiples of Free List Entries per Egress Queue Units ... */ if (fl->pend_cred >=FL_PER_EQ_UNIT ) { + val =PIDX (fl->pend_cred /FL_PER_EQ_UNIT ); +if (!is_t4 (adapter->chip)) + val |=DBTYPE (1 );wmb ();t4_write_reg (adapter,T4VF_SGE_BASE_ADDR +SGE_VF_KDOORBELL ,DBPRIO (1 ) | -QID (fl->cntxt_id) | -PIDX (fl->pend_cred /FL_PER_EQ_UNIT )); +QID (fl->cntxt_id) | val); fl->pend_cred %=FL_PER_EQ_UNIT ; } }
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h +24 -0
@@ -38,6 +38,25 @@#include "../cxgb4/t4fw_api.h" +#define CHELSIO_CHIP_CODE (version, revision) (((version) << 4) | (revision)) +#define CHELSIO_CHIP_VERSION (code) ((code) >> 4) +#define CHELSIO_CHIP_RELEASE (code) ((code) & 0xf) + +#define CHELSIO_T4 0x4 +#define CHELSIO_T5 0x5 + +enum chip_type { +T4_A1 =CHELSIO_CHIP_CODE (CHELSIO_T4 ,0 ), +T4_A2 =CHELSIO_CHIP_CODE (CHELSIO_T4 ,1 ), +T4_A3 =CHELSIO_CHIP_CODE (CHELSIO_T4 ,2 ), +T4_FIRST_REV =T4_A1 , +T4_LAST_REV =T4_A3 , + +T5_A1 =CHELSIO_CHIP_CODE (CHELSIO_T5 ,0 ), +T5_FIRST_REV =T5_A1 , +T5_LAST_REV =T5_A1 , +}; +/* * The "len16" field of a Firmware Command Structure ... */
@@ -232,6 +251,11 @@ static inline int t4vf_wr_mbox_ns(struct adapter *adapter, const void *cmd,return t4vf_wr_mbox_core (adapter, cmd, size, rpl, false); } +static inline int is_t4 (enum chip_type chip) +{ +return (chip >=T4_FIRST_REV && chip <=T4_LAST_REV ); +} +int t4vf_wait_dev_ready (struct adapter *);int t4vf_port_init (struct adapter *,int );
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +10 -4
@@ -1027,8 +1027,11 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free,unsigned nfilters =0 ;unsigned int rem = naddr;struct fw_vi_mac_cmd cmd, rpl; +unsigned int max_naddr =is_t4 (adapter->chip) ? +NUM_MPS_CLS_SRAM_L_INSTANCES : +NUM_MPS_T5_CLS_SRAM_L_INSTANCES ; -if (naddr >FW_CLS_TCAM_NUM_ENTRIES ) +if (naddr > max_naddr)return -EINVAL ;for (offset =0 ; offset < naddr;/**/ ) {
@@ -1069,10 +1072,10 @@ int t4vf_alloc_mac_filt(struct adapter *adapter, unsigned int viid, bool free,if (idx) idx[offset+i] = - (index >=FW_CLS_TCAM_NUM_ENTRIES + (index >= max_naddr ?0xffff : index); -if (index <FW_CLS_TCAM_NUM_ENTRIES ) +if (index < max_naddr) nfilters++;else if (hash) *hash |= (1ULL <<hash_mac_addr (addr[offset+i]));
@@ -1118,6 +1121,9 @@ int t4vf_change_mac(struct adapter *adapter, unsigned int viid,struct fw_vi_mac_exact *p = &cmd.u.exact[0 ];size_t len16 =DIV_ROUND_UP (offsetof(struct fw_vi_mac_cmd , u.exact[1]), 16); +unsigned int max_naddr =is_t4 (adapter->chip) ? +NUM_MPS_CLS_SRAM_L_INSTANCES : +NUM_MPS_T5_CLS_SRAM_L_INSTANCES ;/* * If this is a new allocation, determine whether it should be
@@ -1140,7 +1146,7 @@ int t4vf_change_mac(struct adapter *adapter, unsigned int viid,if (ret ==0 ) { p = &rpl.u.exact[0 ]; ret =FW_VI_MAC_CMD_IDX_GET (be16_to_cpu (p->valid_to_idx)); -if (ret >=FW_CLS_TCAM_NUM_ENTRIES ) +if (ret >= max_naddr) ret = -ENOMEM ; }return ret;
Signature · 1 line
1.7.1
PATCH 12/22 RDMA/cxgb4: Add Support for Chelsio T5 adapter
In reply to Vipul PandyaAdds support for Chelsio T5 adapter.
Enables T5's Write Combining feature.
--- drivers/infiniband/hw/cxgb4/cm.c | 64 +++++++++++++++++++++++-------- drivers/infiniband/hw/cxgb4/device.c | 13 ++++-- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 9 ++++ drivers/infiniband/hw/cxgb4/provider.c | 15 +++++-- drivers/infiniband/hw/cxgb4/qp.c | 2 +- drivers/infiniband/hw/cxgb4/t4.h | 9 ---- 6 files changed, 77 insertions(+), 35 deletions(-)
drivers/infiniband/hw/cxgb4/cm.c +47 -17
@@ -511,12 +511,16 @@ static unsigned int select_ntuple(struct c4iw_dev *dev, struct dst_entry *dst,static int send_connect (struct c4iw_ep *ep) {struct cpl_act_open_req *req; +struct cpl_t5_act_open_req *t5_req;struct sk_buff *skb;u64 opt0;u32 opt2;unsigned int mtu_idx;int wscale; -int wrlen =roundup (sizeof *req,16 ); +int size =is_t4 (ep->com.dev->rdev.lldi.adapter_type) ? +sizeof (struct cpl_act_open_req ) : +sizeof (struct cpl_t5_act_open_req ); +int wrlen =roundup (size,16 );PDBG ("%s ep %p atid %u\n" , __func__, ep, ep->atid);
@@ -552,17 +556,36 @@ static int send_connect(struct c4iw_ep *ep) opt2 |=WND_SCALE_EN (1 );t4_set_arp_err_handler (skb,NULL , act_open_req_arp_failure); - req = (struct cpl_act_open_req *)skb_put (skb, wrlen); -INIT_TP_WR (req,0 ); -OPCODE_TID (req) =cpu_to_be32 ( -MK_OPCODE_TID (CPL_ACT_OPEN_REQ , ((ep->rss_qid<<14 )|ep->atid))); - req->local_port = ep->com.local_addr.sin_port; - req->peer_port = ep->com.remote_addr.sin_port; - req->local_ip = ep->com.local_addr.sin_addr.s_addr; - req->peer_ip = ep->com.remote_addr.sin_addr.s_addr; - req->opt0 =cpu_to_be64 (opt0); - req->params =cpu_to_be32 (select_ntuple (ep->com.dev, ep->dst, ep->l2t)); - req->opt2 =cpu_to_be32 (opt2); +if (is_t4 (ep->com.dev->rdev.lldi.adapter_type)) { + req = (struct cpl_act_open_req *)skb_put (skb, wrlen); +INIT_TP_WR (req,0 ); +OPCODE_TID (req) =cpu_to_be32 ( +MK_OPCODE_TID (CPL_ACT_OPEN_REQ , + ((ep->rss_qid <<14 ) | ep->atid))); + req->local_port = ep->com.local_addr.sin_port; + req->peer_port = ep->com.remote_addr.sin_port; + req->local_ip = ep->com.local_addr.sin_addr.s_addr; + req->peer_ip = ep->com.remote_addr.sin_addr.s_addr; + req->opt0 =cpu_to_be64 (opt0); + req->params =cpu_to_be32 (select_ntuple (ep->com.dev, + ep->dst, ep->l2t)); + req->opt2 =cpu_to_be32 (opt2); + }else { + t5_req = (struct cpl_t5_act_open_req *)skb_put (skb, wrlen); +INIT_TP_WR (t5_req,0 ); +OPCODE_TID (t5_req) =cpu_to_be32 ( +MK_OPCODE_TID (CPL_ACT_OPEN_REQ , + ((ep->rss_qid <<14 ) | ep->atid))); + t5_req->local_port = ep->com.local_addr.sin_port; + t5_req->peer_port = ep->com.remote_addr.sin_port; + t5_req->local_ip = ep->com.local_addr.sin_addr.s_addr; + t5_req->peer_ip = ep->com.remote_addr.sin_addr.s_addr; + t5_req->opt0 =cpu_to_be64 (opt0); + t5_req->params =cpu_to_be64 (V_FILTER_TUPLE ( +select_ntuple (ep->com.dev, ep->dst, ep->l2t))); + t5_req->opt2 =cpu_to_be32 (opt2); + } +set_bit (ACT_OPEN_REQ , &ep->com.history);return c4iw_l2t_send (&ep->com.dev->rdev, skb, ep->l2t); }
@@ -2869,12 +2892,14 @@ static int deferred_fw6_msg(struct c4iw_dev *dev, struct sk_buff *skb)static void build_cpl_pass_accept_req (struct sk_buff *skb,int stid ,u8 tos) {u32 l2info; -u16 vlantag, len, hdr_len; +u16 vlantag, len, hdr_len, eth_hdr_len;u8 intf;struct cpl_rx_pkt *cpl =cplhdr (skb);struct cpl_pass_accept_req *req;struct tcp_options_received tmp_opt; +struct c4iw_dev *dev; + dev = *((struct c4iw_dev **) (skb->cb +sizeof (void *)));/* Store values from cpl_rx_pkt in temporary location. */ vlantag = (__force u16 ) cpl->vlan; len = (__force u16 ) cpl->len;
@@ -2898,14 +2923,16 @@ static void build_cpl_pass_accept_req(struct sk_buff *skb, int stid , u8 tos)V_SYN_MAC_IDX (G_RX_MACIDX ( (__force int )htonl (l2info))) | F_SYN_XACT_MATCH); + eth_hdr_len =is_t4 (dev->rdev.lldi.adapter_type) ? +G_RX_ETHHDR_LEN ((__force int )htonl (l2info)) : +G_RX_T5_ETHHDR_LEN ((__force int )htonl (l2info)); req->hdr_len =cpu_to_be32 (V_SYN_RX_CHAN (G_RX_CHAN ( (__force int )htonl (l2info))) |V_TCP_HDR_LEN (G_RX_TCPHDR_LEN ( (__force int )htons (hdr_len))) |V_IP_HDR_LEN (G_RX_IPHDR_LEN ( (__force int )htons (hdr_len))) | -V_ETH_HDR_LEN (G_RX_ETHHDR_LEN ( - (__force int )htonl (l2info)))); +V_ETH_HDR_LEN (G_RX_ETHHDR_LEN (eth_hdr_len))); req->vlan = (__force __be16 ) vlantag; req->len = (__force __be16 ) len; req->tos_stid = cpu_to_be32(PASS_OPEN_TID(stid) |
@@ -2993,7 +3020,7 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb)u16 window;struct port_info *pi;struct net_device *pdev; -u16 rss_qid; +u16 rss_qid, eth_hdr_len;int step;u32 tx_chan;struct neighbour *neigh;
@@ -3022,7 +3049,10 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) goto reject; } -if (G_RX_ETHHDR_LEN (ntohl (cpl->l2info)) ==ETH_HLEN ) { + eth_hdr_len =is_t4 (dev->rdev.lldi.adapter_type) ? +G_RX_ETHHDR_LEN (htonl (cpl->l2info)) : +G_RX_T5_ETHHDR_LEN (htonl (cpl->l2info)); +if (eth_hdr_len ==ETH_HLEN ) { eh = (struct ethhdr *)(req +1 ); iph = (struct iphdr *)(eh +1 ); }else {
drivers/infiniband/hw/cxgb4/device.c +9 -4
@@ -41,7 +41,7 @@#define DRV_VERSION "0.1"MODULE_AUTHOR ("Steve Wise" ); -MODULE_DESCRIPTION ("Chelsio T4 RDMA Driver" ); +MODULE_DESCRIPTION ("Chelsio T4/T5 RDMA Driver" );MODULE_LICENSE ("Dual BSD/GPL" );MODULE_VERSION (DRV_VERSION );
@@ -614,7 +614,7 @@ static int rdma_supported(const struct cxgb4_lld_info *infop) {return infop->vr->stag.size >0 && infop->vr->pbl.size >0 && infop->vr->rq.size >0 && infop->vr->qp.size >0 && - infop->vr->cq.size >0 && infop->vr->ocq.size >0 ; + infop->vr->cq.size >0 ; }static struct c4iw_dev *c4iw_alloc (const struct cxgb4_lld_info *infop)
@@ -627,6 +627,11 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) pci_name(infop->pdev));return ERR_PTR (-ENOSYS ); } +if (!ocqp_supported (infop)) +pr_info ("%s: On-Chip Queues not supported on this device.\n" , +pci_name (infop->pdev)); +if (!is_t4 (infop->adapter_type)) + db_fc_threshold =100000 ; devp = (struct c4iw_dev *)ib_alloc_device (sizeof (*devp));if (!devp) { printk(KERN_ERR MOD "Cannot allocate ib device\n");
@@ -678,8 +683,8 @@ static void *c4iw_uld_add(const struct cxgb4_lld_info *infop)int i;if (!vers_printed++) - printk(KERN_INFO MOD "Chelsio T4 RDMA Driver - version %s\n", -DRV_VERSION ); +pr_info ("Chelsio T4/T5 RDMA Driver - version %s\n" , +DRV_VERSION ); ctx =kzalloc (sizeof *ctx,GFP_KERNEL );if (!ctx) {
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +9 -0
@@ -817,6 +817,15 @@ static inline int compute_wscale(int win)return wscale; } +static inline int ocqp_supported (const struct cxgb4_lld_info *infop) +{ +#if defined(__i386__) || defined(__x86_64__) || defined(CONFIG_PPC64 ) +return infop->vr->ocq.size >0 ; +#else +return 0 ; +#endif +} +u32 c4iw_id_alloc (struct c4iw_id_table *alloc);void c4iw_id_free (struct c4iw_id_table *alloc,u32 obj); int c4iw_id_table_alloc(struct c4iw_id_table *alloc, u32 start, u32 num,
drivers/infiniband/hw/cxgb4/provider.c +11 -4
@@ -162,8 +162,14 @@ static int c4iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)*/ if (addr >= rdev->oc_mw_pa) vma->vm_page_prot =t4_pgprot_wc (vma->vm_page_prot); -else - vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); +else { +if (is_t5 (rdev->lldi.adapter_type)) + vma->vm_page_prot = +t4_pgprot_wc (vma->vm_page_prot); +else + vma->vm_page_prot = +pgprot_noncached (vma->vm_page_prot); + } ret =io_remap_pfn_range (vma, vma->vm_start, addr >>PAGE_SHIFT , len, vma->vm_page_prot);
@@ -263,7 +269,7 @@ static int c4iw_query_device(struct ib_device *ibdev, dev =to_c4iw_dev (ibdev);memset (props,0 ,sizeof *props);memcpy (&props->sys_image_guid, dev->rdev.lldi.ports[0 ]->dev_addr,6 ); - props->hw_ver = dev->rdev.lldi.adapter_type; + props->hw_ver =CHELSIO_CHIP_RELEASE (dev->rdev.lldi.adapter_type); props->fw_ver = dev->rdev.lldi.fw_vers; props->device_cap_flags = dev->device_cap_flags; props->page_size_cap =T4_PAGESIZE_MASK ;
@@ -346,7 +352,8 @@ static ssize_t show_rev(struct device *dev, struct device_attribute *attr, struct c4iw_dev *c4iw_dev = container_of(dev, struct c4iw_dev, ibdev.dev);PDBG ("%s dev 0x%p\n" , __func__, dev); -return sprintf (buf,"%d\n" , c4iw_dev->rdev.lldi.adapter_type); +return sprintf (buf,"%d\n" , +CHELSIO_CHIP_RELEASE (c4iw_dev->rdev.lldi.adapter_type)); } static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr,
drivers/infiniband/hw/cxgb4/qp.c +1 -1
@@ -76,7 +76,7 @@ static void dealloc_sq(struct c4iw_rdev *rdev, struct t4_sq *sq)static int alloc_oc_sq (struct c4iw_rdev *rdev,struct t4_sq *sq) { -if (!ocqp_support || !t4_ocqp_supported ()) +if (!ocqp_support || !ocqp_supported (&rdev->lldi))return -ENOSYS ; sq->dma_addr =c4iw_ocqp_pool_alloc (rdev, sq->memsize);if (!sq->dma_addr)
drivers/infiniband/hw/cxgb4/t4.h +0 -9
@@ -280,15 +280,6 @@ static inline pgprot_t t4_pgprot_wc(pgprot_t prot)#endif } -static inline int t4_ocqp_supported (void ) -{ -#if defined(__i386__) || defined(__x86_64__) || defined(CONFIG_PPC64 ) -return 1 ; -#else -return 0 ; -#endif -} -enum {T4_SQ_ONCHIP = (1 <<0 ), };
Signature · 1 line
1.7.1
PATCH 13/22 RDMA/cxgb4: Turn off db coalescing when RDMA QPs are in use.
In reply to Vipul Pandya--- drivers/infiniband/hw/cxgb4/qp.c | 20 ++++++++++++++++---- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 19 +++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 3 +++ drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 4 ++++ 4 files changed, 42 insertions(+), 4 deletions(-)
drivers/infiniband/hw/cxgb4/qp.c +16 -4
@@ -42,10 +42,17 @@ static int ocqp_support = 1;module_param (ocqp_support, int,0644 );MODULE_PARM_DESC (ocqp_support,"Support on-chip SQs (default=1)" ); -int db_fc_threshold =2000 ; +int db_fc_threshold =1000 ;module_param (db_fc_threshold, int,0644 ); -MODULE_PARM_DESC (db_fc_threshold,"QP count/threshold that triggers automatic " -"db flow control mode (default = 2000)" ); +MODULE_PARM_DESC (db_fc_threshold, +"QP count/threshold that triggers" +" automatic db flow control mode (default = 1000)" ); + +int db_coalescing_threshold; +module_param (db_coalescing_threshold, int,0644 ); +MODULE_PARM_DESC (db_coalescing_threshold, +"QP count/threshold that triggers" +" disabling db coalescing (default = 0)" );static void set_state (struct c4iw_qp *qhp,enum c4iw_qp_state state) {
@@ -1448,6 +1455,8 @@ int c4iw_destroy_qp(struct ib_qp *ib_qp) rhp->db_state =NORMAL ;idr_for_each (&rhp->qpidr, enable_qp_db,NULL ); } +if (rhp->qpcnt <= db_coalescing_threshold) +cxgb4_enable_db_coalescing (rhp->rdev.lldi.ports[0 ]);spin_unlock_irq (&rhp->lock);atomic_dec (&qhp->refcnt);wait_event (qhp->wait, !atomic_read (&qhp->refcnt));
@@ -1559,11 +1568,14 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,spin_lock_irq (&rhp->lock);if (rhp->db_state !=NORMAL )t4_disable_wq_db (&qhp->wq); -if (++rhp->qpcnt > db_fc_threshold && rhp->db_state ==NORMAL ) { + rhp->qpcnt++; +if (rhp->qpcnt > db_fc_threshold && rhp->db_state ==NORMAL ) { rhp->rdev.stats.db_state_transitions++; rhp->db_state =FLOW_CONTROL ;idr_for_each (&rhp->qpidr, disable_qp_db,NULL ); } +if (rhp->qpcnt > db_coalescing_threshold) +cxgb4_disable_db_coalescing (rhp->rdev.lldi.ports[0 ]); ret =insert_handle_nolock (rhp, &rhp->qpidr, qhp, qhp->wq.sq.qid);spin_unlock_irq (&rhp->lock);if (ret)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +19 -0
@@ -3397,6 +3397,25 @@ out: }EXPORT_SYMBOL (cxgb4_sync_txq_pidx); +void cxgb4_disable_db_coalescing (struct net_device *dev) +{ +struct adapter *adap; + + adap =netdev2adap (dev); +t4_set_reg_field (adap,A_SGE_DOORBELL_CONTROL ,F_NOCOALESCE , +F_NOCOALESCE ); +} +EXPORT_SYMBOL (cxgb4_disable_db_coalescing); + +void cxgb4_enable_db_coalescing (struct net_device *dev) +{ +struct adapter *adap; + + adap =netdev2adap (dev); +t4_set_reg_field (adap,A_SGE_DOORBELL_CONTROL ,F_NOCOALESCE ,0 ); +} +EXPORT_SYMBOL (cxgb4_enable_db_coalescing); +static struct pci_driver cxgb4_driver;static void check_neigh_update (struct neighbour *neigh)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +3 -0
@@ -269,4 +269,7 @@ 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); +#endif /* !__CXGB4_OFLD_H */
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +4 -0
@@ -241,6 +241,10 @@#define SGE_DOORBELL_CONTROL 0x10a8#define ENABLE_DROP (1 << 13) +#define S_NOCOALESCE 26 +#define V_NOCOALESCE (x) ((x) << S_NOCOALESCE) +#define F_NOCOALESCE V_NOCOALESCE(1U) +#define SGE_TIMER_VALUE_0_AND_1 0x10b8#define TIMERVALUE0_MASK 0xffff0000U#define TIMERVALUE0_SHIFT 16
Signature · 1 line
1.7.1
PATCH 14/22 RDMA/cxgb4: Add module_params to enable DB FC & Coalescing on T5
In reply to Vipul PandyaBoth DB Flow-Control and DB Coalescing are disabled by default on T5
--- drivers/infiniband/hw/cxgb4/device.c | 25 +++++++++++++++++++++++-- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 1 + drivers/infiniband/hw/cxgb4/qp.c | 10 ++++++---- 3 files changed, 30 insertions(+), 6 deletions(-)
drivers/infiniband/hw/cxgb4/device.c +23 -2
@@ -45,6 +45,16 @@ MODULE_DESCRIPTION("Chelsio T4/T5 RDMA Driver");MODULE_LICENSE ("Dual BSD/GPL" );MODULE_VERSION (DRV_VERSION ); +static int allow_db_fc_on_t5; +module_param (allow_db_fc_on_t5, int,0644 ); +MODULE_PARM_DESC (allow_db_fc_on_t5, +"Allow DB Flow Control on T5 (default = 0)" ); + +static int allow_db_coalescing_on_t5; +module_param (allow_db_coalescing_on_t5, int,0644 ); +MODULE_PARM_DESC (allow_db_coalescing_on_t5, +"Allow DB Coalescing on T5 (default = 0)" ); +struct uld_ctx {struct list_head entry;struct cxgb4_lld_info lldi;
@@ -630,8 +640,19 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop)if (!ocqp_supported (infop))pr_info ("%s: On-Chip Queues not supported on this device.\n" ,pci_name (infop->pdev)); -if (!is_t4 (infop->adapter_type)) - db_fc_threshold =100000 ; + +if (!is_t4 (infop->adapter_type)) { +if (!allow_db_fc_on_t5) { + db_fc_threshold =100000 ; +pr_info ("DB Flow Control Disabled.\n" ); + } + +if (!allow_db_coalescing_on_t5) { + db_coalescing_threshold =-1 ; +pr_info ("DB Coalescing Disabled.\n" ); + } + } + devp = (struct c4iw_dev *)ib_alloc_device (sizeof (*devp));if (!devp) { printk(KERN_ERR MOD "Cannot allocate ib device\n");
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +1 -0
@@ -939,6 +939,7 @@ extern struct cxgb4_client t4c_client;extern c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS ];extern int c4iw_max_read_depth;extern int db_fc_threshold; +extern int db_coalescing_threshold;#endif
drivers/infiniband/hw/cxgb4/qp.c +6 -4
@@ -1455,8 +1455,9 @@ int c4iw_destroy_qp(struct ib_qp *ib_qp) rhp->db_state =NORMAL ;idr_for_each (&rhp->qpidr, enable_qp_db,NULL ); } -if (rhp->qpcnt <= db_coalescing_threshold) -cxgb4_enable_db_coalescing (rhp->rdev.lldi.ports[0 ]); +if (db_coalescing_threshold >=0 ) +if (rhp->qpcnt <= db_coalescing_threshold) +cxgb4_enable_db_coalescing (rhp->rdev.lldi.ports[0 ]);spin_unlock_irq (&rhp->lock);atomic_dec (&qhp->refcnt);wait_event (qhp->wait, !atomic_read (&qhp->refcnt));
@@ -1574,8 +1575,9 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, rhp->db_state =FLOW_CONTROL ;idr_for_each (&rhp->qpidr, disable_qp_db,NULL ); } -if (rhp->qpcnt > db_coalescing_threshold) -cxgb4_disable_db_coalescing (rhp->rdev.lldi.ports[0 ]); +if (db_coalescing_threshold >=0 ) +if (rhp->qpcnt > db_coalescing_threshold) +cxgb4_disable_db_coalescing (rhp->rdev.lldi.ports[0 ]); ret =insert_handle_nolock (rhp, &rhp->qpidr, qhp, qhp->wq.sq.qid);spin_unlock_irq (&rhp->lock);if (ret)
Signature · 1 line
1.7.1
PATCH 15/22 RDMA/cxgb4: Use DSGLs for fastreg and adapter memory writes for T5.
In reply to Vipul PandyaIt enables direct DMA by HW to memory region PBL arrays and fast register PBL arrays from host memory, vs the T4 way of passing these arrays in the WR itself. The result is lower latency for memory registration, and larger PBL array support for fast register operations.
This patch also updates ULP_TX_MEM_WRITE command fields for T5. Ordering bit of ULP_TX_MEM_WRITE is at bit position 22 in T5 and at 23 in T4.
--- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 2 +- drivers/infiniband/hw/cxgb4/mem.c | 138 ++++++++++++++++++++++++-- drivers/infiniband/hw/cxgb4/qp.c | 76 ++++++++++----- drivers/infiniband/hw/cxgb4/t4.h | 2 +- drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 8 ++ 5 files changed, 190 insertions(+), 36 deletions(-)
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +1 -1
@@ -369,7 +369,6 @@ struct c4iw_fr_page_list {DEFINE_DMA_UNMAP_ADDR (mapping);dma_addr_t dma_addr;struct c4iw_dev *dev; -int size; }; static inline struct c4iw_fr_page_list *to_c4iw_fr_page_list(
@@ -940,6 +939,7 @@ extern c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS];extern int c4iw_max_read_depth;extern int db_fc_threshold;extern int db_coalescing_threshold; +extern int use_dsgl;#endif
drivers/infiniband/hw/cxgb4/mem.c +127 -11
189 lines not on this page · raw message
drivers/infiniband/hw/cxgb4/qp.c +53 -23
101 lines not on this page · raw message
drivers/infiniband/hw/cxgb4/t4.h +1 -1
@@ -84,7 +84,7 @@ struct t4_status_page { sizeof(struct fw_ri_isgl)) / sizeof(struct fw_ri_sge))#define T4_MAX_FR_IMMD ((T4_SQ_NUM_BYTES - sizeof(struct fw_ri_fr_nsmr_wr) - \ sizeof(struct fw_ri_immd)) & ~31UL) -#define T4_MAX_FR_DEPTH (T4_MAX_FR_IMMD / sizeof(u64)) +#define T4_MAX_FR_DEPTH (1024 / sizeof(u64))#define T4_RQ_NUM_SLOTS 2#define T4_RQ_NUM_BYTES (T4_EQ_ENTRY_SIZE * T4_RQ_NUM_SLOTS)
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +8 -0
@@ -787,4 +787,12 @@ struct ulp_mem_io {#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 */
Signature · 1 line
1.7.1
PATCH 16/22 RDMA/cxgb4: Map pbl buffers for dma if using DSGL.
In reply to Vipul Pandya--- drivers/infiniband/hw/cxgb4/mem.c | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-)
drivers/infiniband/hw/cxgb4/mem.c +23 -6
@@ -51,7 +51,7 @@ module_param(inline_threshold, int, 0644);MODULE_PARM_DESC (inline_threshold,"inline vs dsgl threshold (default=128)" );static int _c4iw_write_mem_dma_aligned (struct c4iw_rdev *rdev,u32 addr, -u32 len,void *data,int wait) +u32 len,dma_addr_t data,int wait) {struct sk_buff *skb;struct ulp_mem_io *req;
@@ -88,7 +88,7 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr, sgl->cmd_nsge =cpu_to_be32 (ULPTX_CMD (ULP_TX_SC_DSGL ) |ULPTX_NSGE (1 )); sgl->len0 =cpu_to_be32 (len); - sgl->addr0 =cpu_to_be64 (virt_to_phys (data)); + sgl->addr0 =cpu_to_be64 (data); ret =c4iw_ofld_send (rdev, skb);if (ret)
@@ -178,6 +178,13 @@ int _c4iw_write_mem_dma(struct c4iw_rdev *rdev, u32 addr, u32 len, void *data)u32 remain = len;u32 dmalen;int ret =0 ; +dma_addr_t daddr; +dma_addr_t save; + + daddr =dma_map_single (&rdev->lldi.pdev->dev, data, len,DMA_TO_DEVICE ); +if (dma_mapping_error (&rdev->lldi.pdev->dev, daddr)) +return -1 ; + save = daddr;while (remain > inline_threshold) {if (remain <T4_ULPTX_MAX_DMA ) {
@@ -188,16 +195,18 @@ int _c4iw_write_mem_dma(struct c4iw_rdev *rdev, u32 addr, u32 len, void *data) }else dmalen =T4_ULPTX_MAX_DMA ; remain -= dmalen; - ret =_c4iw_write_mem_dma_aligned (rdev, addr, dmalen, data, + ret =_c4iw_write_mem_dma_aligned (rdev, addr, dmalen, daddr, !remain);if (ret) goto out; addr += dmalen >>5 ; data += dmalen; + daddr += dmalen; }if (remain) ret =_c4iw_write_mem_inline (rdev, addr, remain, data); out: +dma_unmap_single (&rdev->lldi.pdev->dev, save, len,DMA_TO_DEVICE );return ret; }
@@ -209,9 +218,17 @@ static int write_adapter_mem(struct c4iw_rdev *rdev, u32 addr, u32 len, void *data) {if (is_t5 (rdev->lldi.adapter_type) && use_dsgl) { -if (len > inline_threshold) -return _c4iw_write_mem_dma (rdev, addr, len, data); -else +if (len > inline_threshold) { +if (_c4iw_write_mem_dma (rdev, addr, len, data)) { +printk_ratelimited (KERN_WARNING +"%s: dma map" +" failure (non fatal)\n" , +pci_name (rdev->lldi.pdev)); +return _c4iw_write_mem_inline (rdev, addr, len, + data); + }else +return 0 ; + }else return _c4iw_write_mem_inline (rdev, addr, len, data); }else return _c4iw_write_mem_inline (rdev, addr, len, data);
Signature · 1 line
1.7.1
PATCH 17/22 RDMA/cxgb4: Bump tcam_full stat and WR reply timeout
In reply to Vipul PandyaAlways bump the tcam_full stat. Also, bump wr reply timeout to 30 seconds.
--- drivers/infiniband/hw/cxgb4/cm.c | 2 +- drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/cxgb4/cm.c +1 -1
@@ -1693,9 +1693,9 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb)case CPL_ERR_CONN_TIMEDOUT :break ;case CPL_ERR_TCAM_FULL : + dev->rdev.stats.tcam_full++;if (dev->rdev.lldi.enable_fw_ofld_conn) {mutex_lock (&dev->rdev.stats.lock); - dev->rdev.stats.tcam_full++;mutex_unlock (&dev->rdev.stats.lock); send_fw_act_open_req(ep, GET_TID_TID(GET_AOPEN_ATID(
drivers/infiniband/hw/cxgb4/iw_cxgb4.h +1 -1
@@ -162,7 +162,7 @@ static inline int c4iw_num_stags(struct c4iw_rdev *rdev)return min ((int )T4_MAX_NUM_STAG , (int )(rdev->lldi.vr->stag.size >>5 )); } -#define C4IW_WR_TO (10*HZ) +#define C4IW_WR_TO (30*HZ)struct c4iw_wr_wait {struct completion completion;
Signature · 1 line
1.7.1
PATCH 18/22 RDMA/cxgb4: Fix onchip queue support for T5
In reply to Vipul PandyaT5 adapter does not support onchip queue memory. Present logic fails to allocate QP for T5 and returns an error. Also, if module parameter ocqp_support is zero then we are unable to allocate QP which should not be the case. Ideally if ocqp_support parameter is 0 or onchip queue support is disable then host QP should be allocated before returning an error.
--- drivers/infiniband/hw/cxgb4/qp.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-)
drivers/infiniband/hw/cxgb4/qp.c +5 -8
@@ -140,7 +140,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,int wr_len;struct c4iw_wr_wait wr_wait;struct sk_buff *skb; -int ret; +int ret =0 ;int eqsize; wq->sq.qid =c4iw_get_qpid (rdev, uctx);
@@ -180,17 +180,14 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, }if (user) { - ret =alloc_oc_sq (rdev, &wq->sq); -if (ret) +if (alloc_oc_sq (rdev, &wq->sq) &&alloc_host_sq (rdev, &wq->sq)) goto free_hwaddr; - - ret =alloc_host_sq (rdev, &wq->sq); -if (ret) - goto free_sq; - }else + }else { ret =alloc_host_sq (rdev, &wq->sq);if (ret) goto free_hwaddr; + } +memset (wq->sq.queue,0 , wq->sq.memsize);dma_unmap_addr_set (&wq->sq, mapping, wq->sq.dma_addr);
Signature · 1 line
1.7.1
PATCH 19/22 csiostor: Segregate T4 adapter operations.
In reply to Vipul PandyaFrom: Arvind Bhushan <[email protected]>
This patch separates T4 adapter operations into a new file.
--- drivers/scsi/csiostor/csio_hw_t4.c | 403 ++++++++++++++++++++++++++++++++++++ 1 files changed, 403 insertions(+), 0 deletions(-) create mode 100644 drivers/scsi/csiostor/csio_hw_t4.c
drivers/scsi/csiostor/csio_hw_t4.c new file +403 -0
@@ -0,0 +1,403 @@ +/* +* This file is part of the Chelsio FCoE driver for Linux. +* +* Copyright (c) 2008-2013 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 +* 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 +* - 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 "csio_hw.h" +#include "csio_init.h" + +/* +* Return the specified PCI-E Configuration Space register from our Physical +* Function. We try first via a Firmware LDST Command since we prefer to let +* the firmware own all of these registers, but if that fails we go for it +* directly ourselves. +*/ +static uint32_t +csio_t4_read_pcie_cfg4 (struct csio_hw *hw,int reg) +{ +u32 val =0 ; +struct csio_mb *mbp; +int rv; +struct fw_ldst_cmd *ldst_cmd; + + mbp =mempool_alloc (hw->mb_mempool,GFP_ATOMIC ); +if (!mbp) { +CSIO_INC_STATS (hw, n_err_nomem); +pci_read_config_dword (hw->pdev, reg, &val); +return val; + } + +csio_mb_ldst (hw, mbp,CSIO_MB_DEFAULT_TMO , reg); + rv =csio_mb_issue (hw, mbp); + +/* +* If the LDST Command suucceeded, exctract the returned register +* value. Otherwise read it directly ourself. +*/ +if (rv ==0 ) { + ldst_cmd = (struct fw_ldst_cmd *)(mbp->mb); + val =ntohl (ldst_cmd->u.pcie.data[0 ]); + }else +pci_read_config_dword (hw->pdev, reg, &val); + +mempool_free (mbp, hw->mb_mempool); + +return val; +} + +static int +csio_t4_set_mem_win (struct csio_hw *hw,uint32_t win) +{ +u32 bar0; +u32 mem_win_base; + +/* +* Truncation intentional: we only read the bottom 32-bits of the +* 64-bit BAR0/BAR1 ... We use the hardware backdoor mechanism to +* read BAR0 instead of using pci_resource_start() because we could be +* operating from within a Virtual Machine which is trapping our +* accesses to our Configuration Space and we need to set up the PCI-E +* Memory Window decoders with the actual addresses which will be +* coming across the PCI-E link. +*/ + bar0 =csio_t4_read_pcie_cfg4 (hw,PCI_BASE_ADDRESS_0 ); + bar0 &=PCI_BASE_ADDRESS_MEM_MASK ; + + mem_win_base = bar0 +MEMWIN_BASE ; + +/* +* Set up memory window for accessing adapter memory ranges. (Read +* back MA register to ensure that changes propagate before we attempt +* to use the new values.) +*/ +csio_wr_reg32 (hw, mem_win_base |BIR (0 ) | +WINDOW (ilog2 (MEMWIN_APERTURE ) -10 ), +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_BASE_WIN , win)); +csio_rd_reg32 (hw, +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_BASE_WIN , win)); +return 0 ; +} + +/* +* Interrupt handler for the PCIE module. +*/ +static void +csio_t4_pcie_intr_handler (struct csio_hw *hw) +{ +static struct intr_info sysbus_intr_info[] = { + {RNPP ,"RXNP array parity error" ,-1 ,1 }, + {RPCP ,"RXPC array parity error" ,-1 ,1 }, + {RCIP ,"RXCIF array parity error" ,-1 ,1 }, + {RCCP ,"Rx completions control array parity error" ,-1 ,1 }, + {RFTP ,"RXFT array parity error" ,-1 ,1 }, + {0 ,NULL ,0 ,0 } + }; +static struct intr_info pcie_port_intr_info[] = { + {TPCP ,"TXPC array parity error" ,-1 ,1 }, + {TNPP ,"TXNP array parity error" ,-1 ,1 }, + {TFTP ,"TXFT array parity error" ,-1 ,1 }, + {TCAP ,"TXCA array parity error" ,-1 ,1 }, + {TCIP ,"TXCIF array parity error" ,-1 ,1 }, + {RCAP ,"RXCA array parity error" ,-1 ,1 }, + {OTDD ,"outbound request TLP discarded" ,-1 ,1 }, + {RDPE ,"Rx data parity error" ,-1 ,1 }, + {TDUE ,"Tx uncorrectable data error" ,-1 ,1 }, + {0 ,NULL ,0 ,0 } + }; + +static struct intr_info pcie_intr_info[] = { + {MSIADDRLPERR ,"MSI AddrL parity error" ,-1 ,1 }, + {MSIADDRHPERR ,"MSI AddrH parity error" ,-1 ,1 }, + {MSIDATAPERR ,"MSI data parity error" ,-1 ,1 }, + {MSIXADDRLPERR ,"MSI-X AddrL parity error" ,-1 ,1 }, + {MSIXADDRHPERR ,"MSI-X AddrH parity error" ,-1 ,1 }, + {MSIXDATAPERR ,"MSI-X data parity error" ,-1 ,1 }, + {MSIXDIPERR ,"MSI-X DI parity error" ,-1 ,1 }, + {PIOCPLPERR ,"PCI PIO completion FIFO parity error" ,-1 ,1 }, + {PIOREQPERR ,"PCI PIO request FIFO parity error" ,-1 ,1 }, + {TARTAGPERR ,"PCI PCI target tag FIFO parity error" ,-1 ,1 }, + {CCNTPERR ,"PCI CMD channel count parity error" ,-1 ,1 }, + {CREQPERR ,"PCI CMD channel request parity error" ,-1 ,1 }, + {CRSPPERR ,"PCI CMD channel response parity error" ,-1 ,1 }, + {DCNTPERR ,"PCI DMA channel count parity error" ,-1 ,1 }, + {DREQPERR ,"PCI DMA channel request parity error" ,-1 ,1 }, + {DRSPPERR ,"PCI DMA channel response parity error" ,-1 ,1 }, + {HCNTPERR ,"PCI HMA channel count parity error" ,-1 ,1 }, + {HREQPERR ,"PCI HMA channel request parity error" ,-1 ,1 }, + {HRSPPERR ,"PCI HMA channel response parity error" ,-1 ,1 }, + {CFGSNPPERR ,"PCI config snoop FIFO parity error" ,-1 ,1 }, + {FIDPERR ,"PCI FID parity error" ,-1 ,1 }, + {INTXCLRPERR ,"PCI INTx clear parity error" ,-1 ,1 }, + {MATAGPERR ,"PCI MA tag parity error" ,-1 ,1 }, + {PIOTAGPERR ,"PCI PIO tag parity error" ,-1 ,1 }, + {RXCPLPERR ,"PCI Rx completion parity error" ,-1 ,1 }, + {RXWRPERR ,"PCI Rx write parity error" ,-1 ,1 }, + {RPLPERR ,"PCI replay buffer parity error" ,-1 ,1 }, + {PCIESINT ,"PCI core secondary fault" ,-1 ,1 }, + {PCIEPINT ,"PCI core primary fault" ,-1 ,1 }, + {UNXSPLCPLERR ,"PCI unexpected split completion error" ,-1 , +0 }, + {0 ,NULL ,0 ,0 } + }; + +int fat; + fat =csio_handle_intr_status (hw, +PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS , + sysbus_intr_info) + +csio_handle_intr_status (hw, +PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS , + pcie_port_intr_info) + +csio_handle_intr_status (hw,PCIE_INT_CAUSE , pcie_intr_info); +if (fat) +csio_hw_fatal_err (hw); +} + +/* +* csio_t4_flash_cfg_addr - return the address of the flash configuration file +* @hw: the HW module +* +* Return the address within the flash where the Firmware Configuration +* File is stored. +*/ +static unsigned int +csio_t4_flash_cfg_addr (struct csio_hw *hw) +{ +return FLASH_CFG_OFFSET ; +} + +/* +* csio_t4_mc_read - read from MC through backdoor accesses +* @hw: the hw module +* @idx: not used for T4 adapter +* @addr: address of first byte requested +* @data: 64 bytes of data containing the requested address +* @ecc: where to store the corresponding 64-bit ECC word +* +* Read 64 bytes of data from MC starting at a 64-byte-aligned address +* that covers the requested address @addr. If @parity is not %NULL it +* is assigned the 64-bit ECC word for the read data. +*/ +static int +csio_t4_mc_read (struct csio_hw *hw,int idx,uint32_t addr,__be32 *data, +uint64_t *ecc) +{ +int i; + +if (csio_rd_reg32 (hw,MC_BIST_CMD ) &START_BIST ) +return -EBUSY ; +csio_wr_reg32 (hw, addr & ~0x3fU ,MC_BIST_CMD_ADDR ); +csio_wr_reg32 (hw,64 ,MC_BIST_CMD_LEN ); +csio_wr_reg32 (hw,0xc ,MC_BIST_DATA_PATTERN ); +csio_wr_reg32 (hw,BIST_OPCODE (1 ) |START_BIST |BIST_CMD_GAP (1 ), +MC_BIST_CMD ); + i =csio_hw_wait_op_done_val (hw,MC_BIST_CMD ,START_BIST , +0 ,10 ,1 ,NULL ); +if (i) +return i; + +#define MC_DATA (i) MC_BIST_STATUS_REG(MC_BIST_STATUS_RDATA, i) + +for (i =15 ; i >=0 ; i--) + *data++ =htonl (csio_rd_reg32 (hw,MC_DATA (i))); +if (ecc) + *ecc =csio_rd_reg64 (hw,MC_DATA (16 )); +#undef MC_DATA +return 0 ; +} + +/* +* csio_t4_edc_read - read from EDC through backdoor accesses +* @hw: the hw module +* @idx: which EDC to access +* @addr: address of first byte requested +* @data: 64 bytes of data containing the requested address +* @ecc: where to store the corresponding 64-bit ECC word +* +* Read 64 bytes of data from EDC starting at a 64-byte-aligned address +* that covers the requested address @addr. If @parity is not %NULL it +* is assigned the 64-bit ECC word for the read data. +*/ +static int +csio_t4_edc_read (struct csio_hw *hw,int idx,uint32_t addr,__be32 *data, +uint64_t *ecc) +{ +int i; + + idx *=EDC_STRIDE ; +if (csio_rd_reg32 (hw,EDC_BIST_CMD + idx) &START_BIST ) +return -EBUSY ; +csio_wr_reg32 (hw, addr & ~0x3fU ,EDC_BIST_CMD_ADDR + idx); +csio_wr_reg32 (hw,64 ,EDC_BIST_CMD_LEN + idx); +csio_wr_reg32 (hw,0xc ,EDC_BIST_DATA_PATTERN + idx); +csio_wr_reg32 (hw,BIST_OPCODE (1 ) |BIST_CMD_GAP (1 ) |START_BIST , +EDC_BIST_CMD + idx); + i =csio_hw_wait_op_done_val (hw,EDC_BIST_CMD + idx,START_BIST , +0 ,10 ,1 ,NULL ); +if (i) +return i; + +#define EDC_DATA (i) (EDC_BIST_STATUS_REG(EDC_BIST_STATUS_RDATA, i) + idx) + +for (i =15 ; i >=0 ; i--) + *data++ =htonl (csio_rd_reg32 (hw,EDC_DATA (i))); +if (ecc) + *ecc =csio_rd_reg64 (hw,EDC_DATA (16 )); +#undef EDC_DATA +return 0 ; +} + +/* +* csio_t4_memory_rw - read/write EDC 0, EDC 1 or MC via PCIE memory window +* @hw: the csio_hw +* @win: PCI-E memory Window to use +* @mtype: memory type: MEM_EDC0, MEM_EDC1, MEM_MC0 (or MEM_MC) or MEM_MC1 +* @addr: address within indicated memory type +* @len: amount of memory to transfer +* @buf: host memory buffer +* @dir: direction of transfer 1 => read, 0 => write +* +* Reads/writes an [almost] arbitrary memory region in the firmware: the +* firmware memory address, length and host buffer must be aligned on +* 32-bit boudaries. The memory is transferred as a raw byte sequence +* from/to the firmware's memory. If this memory contains data +* structures which contain multi-byte integers, it's the callers +* responsibility to perform appropriate byte order conversions. +*/ +static int +csio_t4_memory_rw (struct csio_hw *hw,u32 win,int mtype,u32 addr, +u32 len,uint32_t *buf,int dir) +{ +u32 pos, start, offset, memoffset, bar0; +u32 edc_size, mc_size, mem_reg, mem_aperture, mem_base; + +/* +* Argument sanity checks ... +*/ +if ((addr &0x3 ) || (len &0x3 )) +return -EINVAL ; + +/* Offset into the region of memory which is being accessed +* MEM_EDC0 = 0 +* MEM_EDC1 = 1 +* MEM_MC = 2 -- T4 +*/ + edc_size =EDRAM_SIZE_GET (csio_rd_reg32 (hw,MA_EDRAM0_BAR )); +if (mtype !=MEM_MC1 ) + memoffset = (mtype * (edc_size *1024 *1024 )); +else { + mc_size =EXT_MEM_SIZE_GET (csio_rd_reg32 (hw, +MA_EXT_MEMORY_BAR )); + memoffset = (MEM_MC0 * edc_size + mc_size) *1024 *1024 ; + } + +/* Determine the PCIE_MEM_ACCESS_OFFSET */ + addr = addr + memoffset; + +/* +* Each PCI-E Memory Window is programmed with a window size -- or +* "aperture" -- which controls the granularity of its mapping onto +* adapter memory. We need to grab that aperture in order to know +* how to use the specified window. The window is also programmed +* with the base address of the Memory Window in BAR0's address +* space. For T4 this is an absolute PCI-E Bus Address. For T5 +* the address is relative to BAR0. +*/ + mem_reg =csio_rd_reg32 (hw, +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_BASE_WIN , win)); + mem_aperture =1 << (WINDOW (mem_reg) +10 ); + mem_base =GET_PCIEOFST (mem_reg) <<10 ; + + bar0 =csio_t4_read_pcie_cfg4 (hw,PCI_BASE_ADDRESS_0 ); + bar0 &=PCI_BASE_ADDRESS_MEM_MASK ; + mem_base -= bar0; + + start = addr & ~(mem_aperture-1 ); + offset = addr - start; + +csio_dbg (hw,"csio_t4_memory_rw: mem_reg: 0x%x, mem_aperture: 0x%x\n" , + mem_reg, mem_aperture); +csio_dbg (hw,"csio_t4_memory_rw: mem_base: 0x%x, mem_offset: 0x%x\n" , + mem_base, memoffset); +csio_dbg (hw,"csio_t4_memory_rw: bar0: 0x%x, start:0x%x, offset:0x%x\n" , + bar0, start, offset); +csio_dbg (hw,"csio_t4_memory_rw: mtype: %d, addr: 0x%x, len: %d\n" , + mtype, addr, len); + +for (pos = start; len >0 ; pos += mem_aperture, offset =0 ) { +/* +* Move PCI-E Memory Window to our current transfer +* position. Read it back to ensure that changes propagate +* before we attempt to use the new value. +*/ +csio_wr_reg32 (hw, pos, +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_OFFSET , win)); +csio_rd_reg32 (hw, +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_OFFSET , win)); + +while (offset < mem_aperture && len >0 ) { +if (dir) + *buf++ =csio_rd_reg32 (hw, mem_base + offset); +else +csio_wr_reg32 (hw, *buf++, mem_base + offset); + + offset +=sizeof (__be32); + len -=sizeof (__be32); + } + } +return 0 ; +} + +/* +* csio_t4_dfs_create_ext_mem - setup debugfs for MC to read the values +* @hw: the csio_hw +* +* This function creates files in the debugfs with external memory region MC. +*/ +static void +csio_t4_dfs_create_ext_mem (struct csio_hw *hw) +{ +u32 size; +int i =csio_rd_reg32 (hw,MA_TARGET_MEM_ENABLE ); +if (i &EXT_MEM_ENABLE ) { + size =csio_rd_reg32 (hw,MA_EXT_MEMORY_BAR ); +csio_add_debugfs_mem (hw,"mc" ,MEM_MC , +EXT_MEM_SIZE_GET (size)); + } +} + +/* T4 adapter specific function */ +struct csio_hw_chip_ops t4_ops = { + .chip_set_mem_win = csio_t4_set_mem_win, + .chip_pcie_intr_handler = csio_t4_pcie_intr_handler, + .chip_flash_cfg_addr = csio_t4_flash_cfg_addr, + .chip_mc_read = csio_t4_mc_read, + .chip_edc_read = csio_t4_edc_read, + .chip_memory_rw = csio_t4_memory_rw, + .chip_dfs_create_ext_mem = csio_t4_dfs_create_ext_mem, +};
Signature · 1 line
1.7.1
PATCH 20/22 csiostor: Add T5 adapter operations.
In reply to Vipul PandyaFrom: Arvind Bhushan <[email protected]>
This patch creates a new file for T5 adapter operations.
--- drivers/scsi/csiostor/csio_hw_t5.c | 397 ++++++++++++++++++++++++++++++++++++ 1 files changed, 397 insertions(+), 0 deletions(-) create mode 100644 drivers/scsi/csiostor/csio_hw_t5.c
drivers/scsi/csiostor/csio_hw_t5.c new file +397 -0
@@ -0,0 +1,397 @@ +/* +* This file is part of the Chelsio FCoE driver for Linux. +* +* Copyright (c) 2008-2013 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 +* 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 "csio_hw.h" +#include "csio_init.h" + +static int +csio_t5_set_mem_win (struct csio_hw *hw,uint32_t win) +{ +u32 mem_win_base; +/* +* Truncation intentional: we only read the bottom 32-bits of the +* 64-bit BAR0/BAR1 ... We use the hardware backdoor mechanism to +* read BAR0 instead of using pci_resource_start() because we could be +* operating from within a Virtual Machine which is trapping our +* accesses to our Configuration Space and we need to set up the PCI-E +* Memory Window decoders with the actual addresses which will be +* coming across the PCI-E link. +*/ + +/* For T5, only relative offset inside the PCIe BAR is passed */ + mem_win_base =MEMWIN_BASE ; + +/* +* Set up memory window for accessing adapter memory ranges. (Read +* back MA register to ensure that changes propagate before we attempt +* to use the new values.) +*/ +csio_wr_reg32 (hw, mem_win_base |BIR (0 ) | +WINDOW (ilog2 (MEMWIN_APERTURE ) -10 ), +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_BASE_WIN , win)); +csio_rd_reg32 (hw, +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_BASE_WIN , win)); + +return 0 ; +} + +/* +* Interrupt handler for the PCIE module. +*/ +static void +csio_t5_pcie_intr_handler (struct csio_hw *hw) +{ +static struct intr_info sysbus_intr_info[] = { + {RNPP ,"RXNP array parity error" ,-1 ,1 }, + {RPCP ,"RXPC array parity error" ,-1 ,1 }, + {RCIP ,"RXCIF array parity error" ,-1 ,1 }, + {RCCP ,"Rx completions control array parity error" ,-1 ,1 }, + {RFTP ,"RXFT array parity error" ,-1 ,1 }, + {0 ,NULL ,0 ,0 } + }; +static struct intr_info pcie_port_intr_info[] = { + {TPCP ,"TXPC array parity error" ,-1 ,1 }, + {TNPP ,"TXNP array parity error" ,-1 ,1 }, + {TFTP ,"TXFT array parity error" ,-1 ,1 }, + {TCAP ,"TXCA array parity error" ,-1 ,1 }, + {TCIP ,"TXCIF array parity error" ,-1 ,1 }, + {RCAP ,"RXCA array parity error" ,-1 ,1 }, + {OTDD ,"outbound request TLP discarded" ,-1 ,1 }, + {RDPE ,"Rx data parity error" ,-1 ,1 }, + {TDUE ,"Tx uncorrectable data error" ,-1 ,1 }, + {0 ,NULL ,0 ,0 } + }; + +static struct intr_info pcie_intr_info[] = { + {MSTGRPPERR ,"Master Response Read Queue parity error" , +-1 ,1 }, + {MSTTIMEOUTPERR ,"Master Timeout FIFO parity error" ,-1 ,1 }, + {MSIXSTIPERR ,"MSI-X STI SRAM parity error" ,-1 ,1 }, + {MSIXADDRLPERR ,"MSI-X AddrL parity error" ,-1 ,1 }, + {MSIXADDRHPERR ,"MSI-X AddrH parity error" ,-1 ,1 }, + {MSIXDATAPERR ,"MSI-X data parity error" ,-1 ,1 }, + {MSIXDIPERR ,"MSI-X DI parity error" ,-1 ,1 }, + {PIOCPLGRPPERR ,"PCI PIO completion Group FIFO parity error" , +-1 ,1 }, + {PIOREQGRPPERR ,"PCI PIO request Group FIFO parity error" , +-1 ,1 }, + {TARTAGPERR ,"PCI PCI target tag FIFO parity error" ,-1 ,1 }, + {MSTTAGQPERR ,"PCI master tag queue parity error" ,-1 ,1 }, + {CREQPERR ,"PCI CMD channel request parity error" ,-1 ,1 }, + {CRSPPERR ,"PCI CMD channel response parity error" ,-1 ,1 }, + {DREQWRPERR ,"PCI DMA channel write request parity error" , +-1 ,1 }, + {DREQPERR ,"PCI DMA channel request parity error" ,-1 ,1 }, + {DRSPPERR ,"PCI DMA channel response parity error" ,-1 ,1 }, + {HREQWRPERR ,"PCI HMA channel count parity error" ,-1 ,1 }, + {HREQPERR ,"PCI HMA channel request parity error" ,-1 ,1 }, + {HRSPPERR ,"PCI HMA channel response parity error" ,-1 ,1 }, + {CFGSNPPERR ,"PCI config snoop FIFO parity error" ,-1 ,1 }, + {FIDPERR ,"PCI FID parity error" ,-1 ,1 }, + {VFIDPERR ,"PCI INTx clear parity error" ,-1 ,1 }, + {MAGRPPERR ,"PCI MA group FIFO parity error" ,-1 ,1 }, + {PIOTAGPERR ,"PCI PIO tag parity error" ,-1 ,1 }, + {IPRXHDRGRPPERR ,"PCI IP Rx header group parity error" , +-1 ,1 }, + {IPRXDATAGRPPERR ,"PCI IP Rx data group parity error" , +-1 ,1 }, + {RPLPERR ,"PCI IP replay buffer parity error" ,-1 ,1 }, + {IPSOTPERR ,"PCI IP SOT buffer parity error" ,-1 ,1 }, + {TRGT1GRPPERR ,"PCI TRGT1 group FIFOs parity error" ,-1 ,1 }, + {READRSPERR ,"Outbound read error" ,-1 ,0 }, + {0 ,NULL ,0 ,0 } + }; + +int fat; + fat =csio_handle_intr_status (hw, +PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS , + sysbus_intr_info) + +csio_handle_intr_status (hw, +PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS , + pcie_port_intr_info) + +csio_handle_intr_status (hw,PCIE_INT_CAUSE , pcie_intr_info); +if (fat) +csio_hw_fatal_err (hw); +} + +/* +* csio_t5_flash_cfg_addr - return the address of the flash configuration file +* @hw: the HW module +* +* Return the address within the flash where the Firmware Configuration +* File is stored. +*/ +static unsigned int +csio_t5_flash_cfg_addr (struct csio_hw *hw) +{ +return FLASH_CFG_START ; +} + +/* +* csio_t5_mc_read - read from MC through backdoor accesses +* @hw: the hw module +* @idx: index to the register +* @addr: address of first byte requested +* @data: 64 bytes of data containing the requested address +* @ecc: where to store the corresponding 64-bit ECC word +* +* Read 64 bytes of data from MC starting at a 64-byte-aligned address +* that covers the requested address @addr. If @parity is not %NULL it +* is assigned the 64-bit ECC word for the read data. +*/ +static int +csio_t5_mc_read (struct csio_hw *hw,int idx,uint32_t addr,__be32 *data, +uint64_t *ecc) +{ +int i; +uint32_t mc_bist_cmd_reg, mc_bist_cmd_addr_reg, mc_bist_cmd_len_reg; +uint32_t mc_bist_status_rdata_reg, mc_bist_data_pattern_reg; + + mc_bist_cmd_reg =MC_REG (MC_P_BIST_CMD , idx); + mc_bist_cmd_addr_reg =MC_REG (MC_P_BIST_CMD_ADDR , idx); + mc_bist_cmd_len_reg =MC_REG (MC_P_BIST_CMD_LEN , idx); + mc_bist_status_rdata_reg =MC_REG (MC_P_BIST_STATUS_RDATA , idx); + mc_bist_data_pattern_reg =MC_REG (MC_P_BIST_DATA_PATTERN , idx); + +if (csio_rd_reg32 (hw, mc_bist_cmd_reg) &START_BIST ) +return -EBUSY ; +csio_wr_reg32 (hw, addr & ~0x3fU , mc_bist_cmd_addr_reg); +csio_wr_reg32 (hw,64 , mc_bist_cmd_len_reg); +csio_wr_reg32 (hw,0xc , mc_bist_data_pattern_reg); +csio_wr_reg32 (hw,BIST_OPCODE (1 ) |START_BIST |BIST_CMD_GAP (1 ), + mc_bist_cmd_reg); + i =csio_hw_wait_op_done_val (hw, mc_bist_cmd_reg,START_BIST , +0 ,10 ,1 ,NULL ); +if (i) +return i; + +#define MC_DATA (i) MC_BIST_STATUS_REG(MC_BIST_STATUS_RDATA, i) + +for (i =15 ; i >=0 ; i--) + *data++ =htonl (csio_rd_reg32 (hw,MC_DATA (i))); +if (ecc) + *ecc =csio_rd_reg64 (hw,MC_DATA (16 )); +#undef MC_DATA +return 0 ; +} + +/* +* csio_t5_edc_read - read from EDC through backdoor accesses +* @hw: the hw module +* @idx: which EDC to access +* @addr: address of first byte requested +* @data: 64 bytes of data containing the requested address +* @ecc: where to store the corresponding 64-bit ECC word +* +* Read 64 bytes of data from EDC starting at a 64-byte-aligned address +* that covers the requested address @addr. If @parity is not %NULL it +* is assigned the 64-bit ECC word for the read data. +*/ +static int +csio_t5_edc_read (struct csio_hw *hw,int idx,uint32_t addr,__be32 *data, +uint64_t *ecc) +{ +int i; +uint32_t edc_bist_cmd_reg, edc_bist_cmd_addr_reg, edc_bist_cmd_len_reg; +uint32_t edc_bist_cmd_data_pattern, edc_bist_status_rdata_reg; + +/* +* These macro are missing in t4_regs.h file. +*/ +#define EDC_STRIDE_T5 (EDC_T51_BASE_ADDR - EDC_T50_BASE_ADDR) +#define EDC_REG_T5 (reg, idx) (reg + EDC_STRIDE_T5 * idx) + + edc_bist_cmd_reg =EDC_REG_T5 (EDC_H_BIST_CMD , idx); + edc_bist_cmd_addr_reg =EDC_REG_T5 (EDC_H_BIST_CMD_ADDR , idx); + edc_bist_cmd_len_reg =EDC_REG_T5 (EDC_H_BIST_CMD_LEN , idx); + edc_bist_cmd_data_pattern =EDC_REG_T5 (EDC_H_BIST_DATA_PATTERN , idx); + edc_bist_status_rdata_reg =EDC_REG_T5 (EDC_H_BIST_STATUS_RDATA , idx); +#undef EDC_REG_T5 +#undef EDC_STRIDE_T5 + +if (csio_rd_reg32 (hw, edc_bist_cmd_reg) &START_BIST ) +return -EBUSY ; +csio_wr_reg32 (hw, addr & ~0x3fU , edc_bist_cmd_addr_reg); +csio_wr_reg32 (hw,64 , edc_bist_cmd_len_reg); +csio_wr_reg32 (hw,0xc , edc_bist_cmd_data_pattern); +csio_wr_reg32 (hw,BIST_OPCODE (1 ) |START_BIST |BIST_CMD_GAP (1 ), + edc_bist_cmd_reg); + i =csio_hw_wait_op_done_val (hw, edc_bist_cmd_reg,START_BIST , +0 ,10 ,1 ,NULL ); +if (i) +return i; + +#define EDC_DATA (i) (EDC_BIST_STATUS_REG(EDC_BIST_STATUS_RDATA, i) + idx) + +for (i =15 ; i >=0 ; i--) + *data++ =htonl (csio_rd_reg32 (hw,EDC_DATA (i))); +if (ecc) + *ecc =csio_rd_reg64 (hw,EDC_DATA (16 )); +#undef EDC_DATA +return 0 ; +} + +/* +* csio_t5_memory_rw - read/write EDC 0, EDC 1 or MC via PCIE memory window +* @hw: the csio_hw +* @win: PCI-E memory Window to use +* @mtype: memory type: MEM_EDC0, MEM_EDC1, MEM_MC0 (or MEM_MC) or MEM_MC1 +* @addr: address within indicated memory type +* @len: amount of memory to transfer +* @buf: host memory buffer +* @dir: direction of transfer 1 => read, 0 => write +* +* Reads/writes an [almost] arbitrary memory region in the firmware: the +* firmware memory address, length and host buffer must be aligned on +* 32-bit boudaries. The memory is transferred as a raw byte sequence +* from/to the firmware's memory. If this memory contains data +* structures which contain multi-byte integers, it's the callers +* responsibility to perform appropriate byte order conversions. +*/ +static int +csio_t5_memory_rw (struct csio_hw *hw,u32 win,int mtype,u32 addr, +u32 len,uint32_t *buf,int dir) +{ +u32 pos, start, offset, memoffset; +u32 edc_size, mc_size, win_pf, mem_reg, mem_aperture, mem_base; + +/* +* Argument sanity checks ... +*/ +if ((addr &0x3 ) || (len &0x3 )) +return -EINVAL ; + +/* Offset into the region of memory which is being accessed +* MEM_EDC0 = 0 +* MEM_EDC1 = 1 +* MEM_MC = 2 -- T4 +* MEM_MC0 = 2 -- For T5 +* MEM_MC1 = 3 -- For T5 +*/ + edc_size =EDRAM_SIZE_GET (csio_rd_reg32 (hw,MA_EDRAM0_BAR )); +if (mtype !=MEM_MC1 ) + memoffset = (mtype * (edc_size *1024 *1024 )); +else { + mc_size =EXT_MEM_SIZE_GET (csio_rd_reg32 (hw, +MA_EXT_MEMORY_BAR )); + memoffset = (MEM_MC0 * edc_size + mc_size) *1024 *1024 ; + } + +/* Determine the PCIE_MEM_ACCESS_OFFSET */ + addr = addr + memoffset; + +/* +* Each PCI-E Memory Window is programmed with a window size -- or +* "aperture" -- which controls the granularity of its mapping onto +* adapter memory. We need to grab that aperture in order to know +* how to use the specified window. The window is also programmed +* with the base address of the Memory Window in BAR0's address +* space. For T4 this is an absolute PCI-E Bus Address. For T5 +* the address is relative to BAR0. +*/ + mem_reg =csio_rd_reg32 (hw, +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_BASE_WIN , win)); + mem_aperture =1 << (WINDOW (mem_reg) +10 ); + mem_base =GET_PCIEOFST (mem_reg) <<10 ; + + start = addr & ~(mem_aperture-1 ); + offset = addr - start; + win_pf =V_PFNUM (hw->pfn); + +csio_dbg (hw,"csio_t5_memory_rw: mem_reg: 0x%x, mem_aperture: 0x%x\n" , + mem_reg, mem_aperture); +csio_dbg (hw,"csio_t5_memory_rw: mem_base: 0x%x, mem_offset: 0x%x\n" , + mem_base, memoffset); +csio_dbg (hw,"csio_t5_memory_rw: start:0x%x, offset:0x%x, win_pf:%d\n" , + start, offset, win_pf); +csio_dbg (hw,"csio_t5_memory_rw: mtype: %d, addr: 0x%x, len: %d\n" , + mtype, addr, len); + +for (pos = start; len >0 ; pos += mem_aperture, offset =0 ) { +/* +* Move PCI-E Memory Window to our current transfer +* position. Read it back to ensure that changes propagate +* before we attempt to use the new value. +*/ +csio_wr_reg32 (hw, pos | win_pf, +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_OFFSET , win)); +csio_rd_reg32 (hw, +PCIE_MEM_ACCESS_REG (PCIE_MEM_ACCESS_OFFSET , win)); + +while (offset < mem_aperture && len >0 ) { +if (dir) + *buf++ =csio_rd_reg32 (hw, mem_base + offset); +else +csio_wr_reg32 (hw, *buf++, mem_base + offset); + + offset +=sizeof (__be32); + len -=sizeof (__be32); + } + } +return 0 ; +} + +/* +* csio_t5_dfs_create_ext_mem - setup debugfs for MC0 or MC1 to read the values +* @hw: the csio_hw +* +* This function creates files in the debugfs with external memory region +* MC0 & MC1. +*/ +static void +csio_t5_dfs_create_ext_mem (struct csio_hw *hw) +{ +u32 size; +int i =csio_rd_reg32 (hw,MA_TARGET_MEM_ENABLE ); +if (i &EXT_MEM_ENABLE ) { + size =csio_rd_reg32 (hw,MA_EXT_MEMORY_BAR ); +csio_add_debugfs_mem (hw,"mc0" ,MEM_MC0 , +EXT_MEM_SIZE_GET (size)); + } +if (i &EXT_MEM1_ENABLE ) { + size =csio_rd_reg32 (hw,MA_EXT_MEMORY1_BAR ); +csio_add_debugfs_mem (hw,"mc1" ,MEM_MC1 , +EXT_MEM_SIZE_GET (size)); + } +} + +/* T5 adapter specific function */ +struct csio_hw_chip_ops t5_ops = { + .chip_set_mem_win = csio_t5_set_mem_win, + .chip_pcie_intr_handler = csio_t5_pcie_intr_handler, + .chip_flash_cfg_addr = csio_t5_flash_cfg_addr, + .chip_mc_read = csio_t5_mc_read, + .chip_edc_read = csio_t5_edc_read, + .chip_memory_rw = csio_t5_memory_rw, + .chip_dfs_create_ext_mem = csio_t5_dfs_create_ext_mem, +};
Signature · 1 line
1.7.1
PATCH 21/22 csiostor: Header file modifications for chip support and bug fixes.
In reply to Vipul PandyaFrom: Arvind Bhushan <[email protected]>
This patch defines the common operations to support multiple chips. It includes common header file modifications to support the current chips (T4 and T5). It also includes the following bug fixes:
- reconfirms the rnode state after an implicit logo.
- corrects the stats array size.
- sets up and checks flags correctly when coming up as master and finding the card initialized
--- drivers/scsi/csiostor/csio_hw_chip.h | 175 ++++++++++++++++++++++++++++++++++ drivers/scsi/csiostor/csio_lnode.h | 2 +- drivers/scsi/csiostor/csio_rnode.c | 10 ++- drivers/scsi/csiostor/csio_rnode.h | 2 +- drivers/scsi/csiostor/csio_wr.c | 41 +++++--- 5 files changed, 212 insertions(+), 18 deletions(-) create mode 100644 drivers/scsi/csiostor/csio_hw_chip.h
drivers/scsi/csiostor/csio_hw_chip.h new file +175 -0
@@ -0,0 +1,175 @@ +/* +* This file is part of the Chelsio FCoE driver for Linux. +* +* Copyright (c) 2008-2013 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 +* 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 __CSIO_HW_CHIP_H__ +#define __CSIO_HW_CHIP_H__ + +#include "csio_defs.h" + +/* FCoE device IDs for T4 */ +#define CSIO_DEVID_T440DBG_FCOE 0x4600 +#define CSIO_DEVID_T420CR_FCOE 0x4601 +#define CSIO_DEVID_T422CR_FCOE 0x4602 +#define CSIO_DEVID_T440CR_FCOE 0x4603 +#define CSIO_DEVID_T420BCH_FCOE 0x4604 +#define CSIO_DEVID_T440BCH_FCOE 0x4605 +#define CSIO_DEVID_T440CH_FCOE 0x4606 +#define CSIO_DEVID_T420SO_FCOE 0x4607 +#define CSIO_DEVID_T420CX_FCOE 0x4608 +#define CSIO_DEVID_T420BT_FCOE 0x4609 +#define CSIO_DEVID_T404BT_FCOE 0x460A +#define CSIO_DEVID_B420_FCOE 0x460B +#define CSIO_DEVID_B404_FCOE 0x460C +#define CSIO_DEVID_T480CR_FCOE 0x460D +#define CSIO_DEVID_T440LPCR_FCOE 0x460E +#define CSIO_DEVID_AMSTERDAM_T4_FCOE 0x460F +#define CSIO_DEVID_HUAWEI_T480_FCOE 0x4680 +#define CSIO_DEVID_HUAWEI_T440_FCOE 0x4681 +#define CSIO_DEVID_HUAWEI_STG310_FCOE 0x4682 +#define CSIO_DEVID_ACROMAG_XMC_XAUI 0x4683 +#define CSIO_DEVID_ACROMAG_XMC_SFP_FCOE 0x4684 +#define CSIO_DEVID_QUANTA_MEZZ_SFP_FCOE 0x4685 +#define CSIO_DEVID_HUAWEI_10GT_FCOE 0x4686 +#define CSIO_DEVID_HUAWEI_T440_TOE_FCOE 0x4687 + +/* FCoE device IDs for T5 */ +#define CSIO_DEVID_T580DBG_FCOE 0x5600 +#define CSIO_DEVID_T520CR_FCOE 0x5601 +#define CSIO_DEVID_T522CR_FCOE 0x5602 +#define CSIO_DEVID_T540CR_FCOE 0x5603 +#define CSIO_DEVID_T520BCH_FCOE 0x5604 +#define CSIO_DEVID_T540BCH_FCOE 0x5605 +#define CSIO_DEVID_T540CH_FCOE 0x5606 +#define CSIO_DEVID_T520SO_FCOE 0x5607 +#define CSIO_DEVID_T520CX_FCOE 0x5608 +#define CSIO_DEVID_T520BT_FCOE 0x5609 +#define CSIO_DEVID_T504BT_FCOE 0x560A +#define CSIO_DEVID_B520_FCOE 0x560B +#define CSIO_DEVID_B504_FCOE 0x560C +#define CSIO_DEVID_T580CR2_FCOE 0x560D +#define CSIO_DEVID_T540LPCR_FCOE 0x560E +#define CSIO_DEVID_AMSTERDAM_T5_FCOE 0x560F +#define CSIO_DEVID_T580LPCR_FCOE 0x5610 +#define CSIO_DEVID_T520LLCR_FCOE 0x5611 +#define CSIO_DEVID_T560CR_FCOE 0x5612 +#define CSIO_DEVID_T580CR_FCOE 0x5613 + +/* Define MACRO values */ +#define CSIO_HW_T4 0x4000 +#define CSIO_T4_FCOE_ASIC 0x4600 +#define CSIO_HW_T5 0x5000 +#define CSIO_T5_FCOE_ASIC 0x5600 +#define CSIO_HW_CHIP_MASK 0xF000 +#define T4_REGMAP_SIZE (160 * 1024) +#define T5_REGMAP_SIZE (332 * 1024) +#define FW_FNAME_T4 "cxgb4/t4fw.bin" +#define FW_FNAME_T5 "cxgb4/t5fw.bin" +#define FW_CFG_NAME_T4 "cxgb4/t4-config.txt" +#define FW_CFG_NAME_T5 "cxgb4/t5-config.txt" + +/* Define static functions */ +static inline int csio_is_t4 (uint16_t chip) +{ +return (chip ==CSIO_HW_T4 ); +} + +static inline int csio_is_t5 (uint16_t chip) +{ +return (chip ==CSIO_HW_T5 ); +} + +/* Define MACRO DEFINITIONS */ +#define CSIO_DEVICE (devid, idx) \ + { PCI_VENDOR_ID_CHELSIO, (devid), PCI_ANY_ID, PCI_ANY_ID, 0, 0, (idx) } + +#define CSIO_HW_PIDX (hw, index) \ + (csio_is_t4(hw->chip_id) ? (PIDX(index)) : \ + (PIDX_T5(index) | DBTYPE(1U))) + +#define CSIO_HW_LP_INT_THRESH (hw, val) \ + (csio_is_t4(hw->chip_id) ? (LP_INT_THRESH(val)) : \ + (V_LP_INT_THRESH_T5(val))) + +#define CSIO_HW_M_LP_INT_THRESH (hw) \ + (csio_is_t4(hw->chip_id) ? (LP_INT_THRESH_MASK) : (M_LP_INT_THRESH_T5)) + +#define CSIO_MAC_INT_CAUSE_REG (hw, port) \ + (csio_is_t4(hw->chip_id) ? (PORT_REG(port, XGMAC_PORT_INT_CAUSE)) : \ + (T5_PORT_REG(port, MAC_PORT_INT_CAUSE))) + +#define FW_VERSION_MAJOR (hw) (csio_is_t4(hw->chip_id) ? 1 : 0) +#define FW_VERSION_MINOR (hw) (csio_is_t4(hw->chip_id) ? 2 : 0) +#define FW_VERSION_MICRO (hw) (csio_is_t4(hw->chip_id) ? 8 : 0) + +#define CSIO_FW_FNAME (hw) \ + (csio_is_t4(hw->chip_id) ? FW_FNAME_T4 : FW_FNAME_T5) + +#define CSIO_CF_FNAME (hw) \ + (csio_is_t4(hw->chip_id) ? FW_CFG_NAME_T4 : FW_CFG_NAME_T5) + +/* Declare ENUMS */ +enum {MEM_EDC0 ,MEM_EDC1 ,MEM_MC ,MEM_MC0 =MEM_MC ,MEM_MC1 }; + +enum { +MEMWIN_APERTURE =2048 , +MEMWIN_BASE =0x1b800 , +MEMWIN_CSIOSTOR =6 ,/* PCI-e Memory Window access */ +}; + +/* Slow path handlers */ +struct intr_info { +unsigned int mask;/* bits to check in interrupt status */ +const char *msg;/* message to print or NULL */ +short stat_idx;/* stat counter to increment or -1 */ +unsigned short fatal;/* whether the condition reported is fatal */ +}; + +/* T4/T5 Chip specific ops */ +struct csio_hw ; +struct csio_hw_chip_ops { +int (*chip_set_mem_win)(struct csio_hw *,uint32_t ); +void (*chip_pcie_intr_handler)(struct csio_hw *); +uint32_t (*chip_flash_cfg_addr)(struct csio_hw *); +int (*chip_mc_read)(struct csio_hw *,int ,uint32_t , +__be32 *,uint64_t *); +int (*chip_edc_read)(struct csio_hw *,int ,uint32_t , +__be32 *,uint64_t *); +int (*chip_memory_rw)(struct csio_hw *,u32 ,int ,u32 , +u32 ,uint32_t *,int ); +void (*chip_dfs_create_ext_mem)(struct csio_hw *); +}; + +extern struct csio_hw_chip_ops t4_ops; +extern struct csio_hw_chip_ops t5_ops; + +#endif /* #ifndef __CSIO_HW_CHIP_H__ */
drivers/scsi/csiostor/csio_lnode.h +1 -1
@@ -114,7 +114,7 @@ struct csio_lnode_stats {uint32_t n_rnode_match;/* matched rnode */ uint32_t n_dev_loss_tmo;/* Device loss timeout */ uint32_t n_fdmi_err;/* fdmi err */ -uint32_t n_evt_fw[RSCN_DEV_LOST ];/* fw events */ +uint32_t n_evt_fw[PROTO_ERR_IMPL_LOGO ];/* fw events */ enum csio_ln_ev n_evt_sm[CSIO_LNE_MAX_EVENT ];/* State m/c events */ uint32_t n_rnode_alloc;/* rnode allocated */ uint32_t n_rnode_free;/* rnode freed */
drivers/scsi/csiostor/csio_rnode.c +9 -1
@@ -302,7 +302,7 @@ csio_confirm_rnode(struct csio_lnode *ln, uint32_t rdev_flowid, {uint8_t rport_type;struct csio_rnode *rn, *match_rn; -uint32_t vnp_flowid; +uint32_t vnp_flowid =0 ;__be32 *port_id; port_id = (__be32 *)&rdevp->r_id[0 ];
@@ -350,6 +350,14 @@ csio_confirm_rnode(struct csio_lnode *ln, uint32_t rdev_flowid,* Else, go ahead and alloc a new rnode. */ if (!memcmp (csio_rn_wwpn (match_rn), rdevp->wwpn,8 )) { +if (rn == match_rn) + goto found_rnode; +csio_ln_dbg (ln, +"nport_id:x%x and wwpn:%llx" +" match for ssni:x%x\n" , + rn->nport_id, +wwn_to_u64 (rdevp->wwpn), + rdev_flowid);if (csio_is_rnode_ready (rn)) {csio_ln_warn (ln, "rnode is already"
drivers/scsi/csiostor/csio_rnode.h +1 -1
@@ -63,7 +63,7 @@ struct csio_rnode_stats {uint32_t n_err_nomem;/* error nomem */ uint32_t n_evt_unexp;/* unexpected event */ uint32_t n_evt_drop;/* unexpected event */ -uint32_t n_evt_fw[RSCN_DEV_LOST ];/* fw events */ +uint32_t n_evt_fw[PROTO_ERR_IMPL_LOGO ];/* fw events */ enum csio_rn_ev n_evt_sm[CSIO_RNFE_MAX_EVENT ];/* State m/c events */ uint32_t n_lun_rst;/* Number of resets of * of LUNs under this
drivers/scsi/csiostor/csio_wr.c +26 -15
70 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 22/22 csiostor: Cleanup chip specific operations.
In reply to Vipul PandyaFrom: Arvind Bhushan <[email protected]>
This patch removes chip specific operations from the common hardware paths, as well as the Makefile change to accomodate the new files.
--- drivers/scsi/csiostor/Makefile | 3 +- drivers/scsi/csiostor/csio_hw.c | 559 ++++++++----------------------------- drivers/scsi/csiostor/csio_hw.h | 47 ++-- drivers/scsi/csiostor/csio_init.c | 48 +++- drivers/scsi/csiostor/csio_init.h | 29 +-- drivers/scsi/csiostor/csio_wr.c | 19 +- 6 files changed, 193 insertions(+), 512 deletions(-)
drivers/scsi/csiostor/Makefile +2 -1
@@ -8,4 +8,5 @@ ccflags-y += -I$(srctree)/drivers/net/ethernet/chelsio/cxgb4 obj-$(CONFIG_SCSI_CHELSIO_FCOE) += csiostor.o csiostor-objs := csio_attr.o csio_init.o csio_lnode.o csio_scsi.o \ - csio_hw.o csio_isr.o csio_mb.o csio_rnode.o csio_wr.o + csio_hw.o csio_hw_t4.o csio_hw_t5.o csio_isr.o \ + csio_mb.o csio_rnode.o csio_wr.o
drivers/scsi/csiostor/csio_hw.c +119 -440
757 lines not on this page · raw message
drivers/scsi/csiostor/csio_hw.h +18 -29
124 lines not on this page · raw message
drivers/scsi/csiostor/csio_init.c +38 -10
82 lines not on this page · raw message
drivers/scsi/csiostor/csio_init.h +4 -25
@@ -52,31 +52,6 @@#define CSIO_DRV_DESC "Chelsio FCoE driver"#define CSIO_DRV_VERSION "1.0.0" -#define CSIO_DEVICE (devid, idx) \ -{ PCI_VENDOR_ID_CHELSIO, (devid), PCI_ANY_ID, PCI_ANY_ID, 0, 0, (idx) } - -#define CSIO_IS_T4_FPGA (_dev) (((_dev) == CSIO_DEVID_PE10K) ||\ - ((_dev) == CSIO_DEVID_PE10K_PF1)) - -/* FCoE device IDs */ -#define CSIO_DEVID_PE10K 0xA000 -#define CSIO_DEVID_PE10K_PF1 0xA001 -#define CSIO_DEVID_T440DBG_FCOE 0x4600 -#define CSIO_DEVID_T420CR_FCOE 0x4601 -#define CSIO_DEVID_T422CR_FCOE 0x4602 -#define CSIO_DEVID_T440CR_FCOE 0x4603 -#define CSIO_DEVID_T420BCH_FCOE 0x4604 -#define CSIO_DEVID_T440BCH_FCOE 0x4605 -#define CSIO_DEVID_T440CH_FCOE 0x4606 -#define CSIO_DEVID_T420SO_FCOE 0x4607 -#define CSIO_DEVID_T420CX_FCOE 0x4608 -#define CSIO_DEVID_T420BT_FCOE 0x4609 -#define CSIO_DEVID_T404BT_FCOE 0x460A -#define CSIO_DEVID_B420_FCOE 0x460B -#define CSIO_DEVID_B404_FCOE 0x460C -#define CSIO_DEVID_T480CR_FCOE 0x460D -#define CSIO_DEVID_T440LPCR_FCOE 0x460E -extern struct fc_function_template csio_fc_transport_funcs;extern struct fc_function_template csio_fc_transport_vport_funcs;
@@ -100,6 +75,10 @@ struct csio_lnode *csio_shost_init(struct csio_hw *, struct device *, bool,void csio_shost_exit (struct csio_lnode *);void csio_lnodes_exit (struct csio_hw *,bool ); +/* DebugFS helper routines */ +void csio_add_debugfs_mem (struct csio_hw *,const char *, +unsigned int ,unsigned int ); +static inline struct Scsi_Host *csio_ln_to_shost (struct csio_lnode *ln) {
drivers/scsi/csiostor/csio_wr.c +12 -7
@@ -85,8 +85,8 @@ csio_wr_ring_fldb(struct csio_hw *hw, struct csio_q *flq)*/ if (flq->inc_idx >=8 ) {csio_wr_reg32 (hw,DBPRIO (1 ) |QID (flq->un.fl.flid) | -PIDX (flq->inc_idx /8 ), -MYPF_REG (SGE_PF_KDOORBELL )); +CSIO_HW_PIDX (hw, flq->inc_idx /8 ), +MYPF_REG (SGE_PF_KDOORBELL )); flq->inc_idx &=7 ; } }
@@ -989,7 +989,8 @@ csio_wr_issue(struct csio_hw *hw, int qidx, bool prio)wmb ();/* Ring SGE Doorbell writing q->pidx into it */ csio_wr_reg32 (hw,DBPRIO (prio) |QID (q->un.eq.physeqid) | -PIDX (q->inc_idx),MYPF_REG (SGE_PF_KDOORBELL )); +CSIO_HW_PIDX (hw, q->inc_idx), +MYPF_REG (SGE_PF_KDOORBELL )); q->inc_idx =0 ;return 0 ;
@@ -1352,6 +1353,9 @@ csio_wr_fixup_host_params(struct csio_hw *hw)/* default value of rx_dma_offset of the NIC driver */ csio_set_reg_field (hw,SGE_CONTROL ,PKTSHIFT_MASK ,PKTSHIFT (CSIO_SGE_RX_DMA_OFFSET )); + +csio_hw_tp_wr_bits_indirect (hw,TP_INGRESS_CONFIG , +CSUM_HAS_PSEUDO_HDR ,0 ); } static void
@@ -1467,10 +1471,11 @@ csio_wr_set_sge(struct csio_hw *hw)* and generate an interrupt when this occurs so we can recover. */ csio_set_reg_field (hw,SGE_DBFIFO_STATUS , -HP_INT_THRESH (HP_INT_THRESH_MASK ) | -LP_INT_THRESH (LP_INT_THRESH_MASK ), -HP_INT_THRESH (CSIO_SGE_DBFIFO_INT_THRESH ) | -LP_INT_THRESH (CSIO_SGE_DBFIFO_INT_THRESH )); +HP_INT_THRESH (HP_INT_THRESH_MASK ) | +CSIO_HW_LP_INT_THRESH (hw,CSIO_HW_M_LP_INT_THRESH (hw)), +HP_INT_THRESH (CSIO_SGE_DBFIFO_INT_THRESH ) | +CSIO_HW_LP_INT_THRESH (hw,CSIO_SGE_DBFIFO_INT_THRESH )); +csio_set_reg_field (hw,SGE_DOORBELL_CONTROL ,ENABLE_DROP ,ENABLE_DROP );
Signature · 1 line
1.7.1