cxgb4: add FCoE DDP and RSS
Subsystems (4)
cover cxgb4: add FCoE DDP and RSS
This patch series enables RSS for FCoE frames and adds DDP support for FCoE target.
Varun Prakash (3):
cxgb4: add structure and macro definitions for FCoE DDP
cxgb4: add DDP support for FCoE target
cxgb4: enable RSS for FCoE frames
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 1 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 605 +++++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h | 54 ++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 47 ++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 7 + drivers/net/ethernet/chelsio/cxgb4/sge.c | 328 ++++++++++++- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 1 + drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 29 ++ drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 67 +++ drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 8 + drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h | 90 ++++ drivers/net/ethernet/chelsio/cxgb4/t4_values.h | 3 + drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 11 +- 13 files changed, 1243 insertions(+), 8 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h
PATCH 1/3 cxgb4: add structure and macro definitions for FCoE DDP
This patch adds new header file t4_tcb.h and
structure, macro definitions for FCoE DDP support
in cxgb4 driver.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h | 54 +++++++++++++- drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 7 ++ drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 29 +++++++ drivers/net/ethernet/chelsio/cxgb4/t4_msg.h | 67 +++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h | 90 +++++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/t4_values.h | 3 + drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 11 +++- 7 files changed, 259 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.h +53 -1
@@ -40,18 +40,70 @@#define CXGB_FCOE_TXPKT_CSUM_START 28#define CXGB_FCOE_TXPKT_CSUM_END 8 +#define CXGB_FCOE_ATID 13 +#define CXGB_FCOE_GET_XID (x) ((x) & 0x3FF) + +#define CXGB_FCOE_SHIFT_PORTID 11 +#define CXGB_FCOE_MASK_PORTID 0x3 +#define CXGB_FCOE_GET_PORTID (x) \ + (((x) >> CXGB_FCOE_SHIFT_PORTID) & CXGB_FCOE_MASK_PORTID) + +/* # of sentinel invalid page pods at the end of a group of valid page pods */ +#define CXGB_FCOE_NUM_SENTINEL_PPODS 0 + +#define CXGB_FCOE_PPOD_SIZE sizeof(struct pagepod) + +#define CXGB_FCOE_MAX_XCHGS_PORT 1024/* Per netdev */ +#define CXGB_FCOE_MAX_PAGE_CNT ((10485760) / PAGE_SIZE) + +/* ddp flags */ +enum { +CXGB_FCOE_DDP_ERROR = (1 <<0 ), +CXGB_FCOE_DDP_TID_VALID = (1 <<1 ), +}; + +struct cxgb_fcoe_ddp { +u8 h_source[ETH_ALEN ]; +u8 h_dest[ETH_ALEN ]; +unsigned int sgc; +struct scatterlist *sgl; +int ddp_len; +unsigned int tid; +unsigned int nppods; +unsigned int npages; +unsigned int ppod_tag; +unsigned int first_pg_off; +unsigned int xfer_len; +u16 vlan_tci; +u16 xid; +u8 d_id[3 ]; +u8 flags; +dma_addr_t *ppod_gl; +}; +/* fcoe flags */ enum {CXGB_FCOE_ENABLED = (1 <<0 ), };struct cxgb_fcoe { -u8 flags; +u8 flags; +struct completion *cmpl; +struct cxgb_fcoe_ddp ddp[CXGB_FCOE_MAX_XCHGS_PORT ]; };int cxgb_fcoe_enable (struct net_device *);int cxgb_fcoe_disable (struct net_device *);bool cxgb_fcoe_sof_eof_supported (struct adapter *,struct sk_buff *); +void cxgb_fcoe_init_ddp (struct adapter *); +void cxgb_fcoe_exit_ddp (struct adapter *); +void cxgb_fcoe_cpl_act_open_rpl (struct adapter *,unsigned int , +unsigned int ,unsigned int ); +int cxgb_fcoe_rx_handler (struct sge_rspq *,const __be64 *); +void cxgb_fcoe_free_ppods (struct adapter *,unsigned int ,unsigned int ); +int cxgb_fcoe_ddp_setup (struct net_device *,u16 , +struct scatterlist *,unsigned int ); +int cxgb_fcoe_ddp_done (struct net_device *,u16 );#endif /* CONFIG_CHELSIO_T4_FCOE */ #endif /* __CXGB4_FCOE_H__ */
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +7 -0
@@ -218,6 +218,13 @@ struct cxgb4_virt_res { /* virtualized HW resources */struct cxgb4_range qp;struct cxgb4_range cq;struct cxgb4_range ocq; +#ifdef CONFIG_CHELSIO_T4_FCOE +u8 *ppod_map; +u16 *tid2xid; +unsigned int toe_nppods; +unsigned int fcoe_nppods; +spinlock_t ppod_map_lock;/* page pod map lock */ +#endif /* CONFIG_CHELSIO_T4_FCOE */ };#define OCQ_WIN_OFFSET (pdev, vres) \
drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +29 -0
@@ -164,6 +164,35 @@ struct rsp_ctrl {#define QINTR_TIMER_IDX (x) ((x) << 1)#define QINTR_TIMER_IDX_GET (x) (((x) >> 1) & 0x7) +/* # of pages a pagepod can hold without needing another pagepod */ +#define PPOD_PAGES 4U + +struct pagepod { +__be64 vld_tid_pgsz_tag_color; +__be64 len_offset; +__be64 rsvd; +__be64 addr[PPOD_PAGES +1 ]; +}; + +#define PPOD_COLOR_S 0 +#define PPOD_COLOR_V (x) ((x) << PPOD_COLOR_S) + +#define PPOD_TAG_S 6 +#define PPOD_TAG_V (x) ((x) << PPOD_TAG_S) + +#define PPOD_TID_S 32 +#define PPOD_TID_V (x) ((__u64)(x) << PPOD_TID_S) + +#define PPOD_VALID_S 56 +#define PPOD_VALID_V (x) ((__u64)(x) << PPOD_VALID_S) +#define PPOD_VALID_F PPOD_VALID_V(1ULL) + +#define PPOD_LEN_S 32 +#define PPOD_LEN_V (x) ((__u64)(x) << PPOD_LEN_S) + +#define PPOD_OFST_S 0 +#define PPOD_OFST_V (x) ((x) << PPOD_OFST_S) +/* * Flash layout. */
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h +67 -0
107 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h new file +90 -0
90 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4_values.h +3 -0
@@ -61,6 +61,9 @@#define SGE_TIMERREGS 6#define TIMERREG_COUNTER0_X 0 +/* Egress Context field values */ +#define IDXSIZE_UNIT_X 64 +/* T5 and later support a new BAR2-based doorbell mechanism for Egress Queues. * The User Doorbells are each 128 bytes in length with a Simple Doorbell at * offsets 8x and a Write Combining single 64-byte Egress Queue Unit
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +10 -1
@@ -101,7 +101,8 @@ enum fw_wr_opcodes {FW_RI_BIND_MW_WR =0x18 ,FW_RI_FR_NSMR_WR =0x19 ,FW_RI_INV_LSTAG_WR =0x1a , -FW_LASTC2E_WR =0x40 +FW_POFCOE_ULPTX_WR =0x43 , +FW_LASTC2E_WR =0x70 }; struct fw_wr_hdr {
@@ -631,6 +632,12 @@ struct fw_eth_tx_pkt_vm_wr {__be16 vlantci; }; +struct fw_pofcoe_ulptx_wr { +__be32 op_pkd; +__be32 equiq_to_len16; +__u64 cookie; +}; +#define FW_CMD_MAX_TIMEOUT 10000/*
@@ -985,6 +992,8 @@ enum fw_caps_config_fcoe {FW_CAPS_CONFIG_FCOE_INITIATOR =0x00000001 ,FW_CAPS_CONFIG_FCOE_TARGET =0x00000002 ,FW_CAPS_CONFIG_FCOE_CTRL_OFLD =0x00000004 , +FW_CAPS_CONFIG_POFCOE_INITIATOR =0x00000008 , + FW_CAPS_CONFIG_POFCOE_TARGET = 0x00000010, }; enum fw_memtype_cf {
Signature · 1 line
1.7.1
PATCH 2/3 cxgb4: add DDP support for FCoE target
In reply to Varun PrakashThis patch adds code for ndo_fcoe_ddp_target andndo_fcoe_ddp_done.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 1 + drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c | 605 +++++++++++++++++++++++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 39 ++- drivers/net/ethernet/chelsio/cxgb4/sge.c | 328 ++++++++++++- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 1 + 5 files changed, 968 insertions(+), 6 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +1 -0
@@ -242,6 +242,7 @@ struct tp_params {* places we store their offsets here, or a -1 if the field isn't * present. */ +int fcoe_shift;int vlan_shift;int vnic_shift;int port_shift;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_fcoe.c +605 -0
646 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +38 -1
@@ -552,6 +552,23 @@ static void clear_filter(struct adapter *adap, struct filter_entry *f)memset (f,0 ,sizeof (*f)); } +#ifdef CONFIG_CHELSIO_T4_FCOE +static void hash_filter_rpl (struct adapter *adap, +const struct cpl_act_open_rpl *rpl) +{ +unsigned int tid =GET_TID (rpl); +unsigned int ftid =TID_TID_G (AOPEN_ATID_G (ntohl (rpl->atid_status))); +unsigned int status =AOPEN_STATUS_G (ntohl (rpl->atid_status)); + +/* ATID is 14 bit value [0..13], MAX_ATIDS is 8192 +* ATID needs max 13 bits [0..12], using 13th bit in +* ATID for FCoE CPL_ACT_OPEN_REQ. +*/ +if (ftid &BIT (CXGB_FCOE_ATID )) +cxgb_fcoe_cpl_act_open_rpl (adap, ftid, tid, status); +} +#endif /* CONFIG_CHELSIO_T4_FCOE */ +/* Handle a filter write/deletion reply. */ static void filter_rpl (struct adapter *adap,const struct cpl_set_tcb_rpl *rpl)
@@ -669,7 +686,15 @@ static int fwevtq_handler(struct sge_rspq *q, const __be64 *rsp,const struct cpl_set_tcb_rpl *p = (void *)rsp;filter_rpl (q->adap, p); - }else + } +#ifdef CONFIG_CHELSIO_T4_FCOE + else if (opcode == CPL_ACT_OPEN_RPL) { +const struct cpl_act_open_rpl *p = (void *)rsp; + +hash_filter_rpl (q->adap, p); + } +#endif /* CONFIG_CHELSIO_T4_FCOE */ + else dev_err(q->adap->pdev_dev, "unexpected CPL %#x on FW event queue\n", opcode); out:
@@ -4585,6 +4610,8 @@ static const struct net_device_ops cxgb4_netdev_ops = {#ifdef CONFIG_CHELSIO_T4_FCOE .ndo_fcoe_enable = cxgb_fcoe_enable, .ndo_fcoe_disable = cxgb_fcoe_disable, + .ndo_fcoe_ddp_target = cxgb_fcoe_ddp_setup, + .ndo_fcoe_ddp_done = cxgb_fcoe_ddp_done,#endif /* CONFIG_CHELSIO_T4_FCOE */ #ifdef CONFIG_NET_RX_BUSY_POLL .ndo_busy_poll = cxgb_busy_poll,
@@ -5393,6 +5420,10 @@ static int adap_init0(struct adapter *adap) adap->vres.ddp.start = val[3 ]; adap->vres.ddp.size = val[4 ] - val[3 ] +1 ; adap->params.ofldq_wr_cred = val[5 ]; +#ifdef CONFIG_CHELSIO_T4_FCOE +if (ntohs (caps_cmd.fcoecaps) &FW_CAPS_CONFIG_POFCOE_TARGET ) +cxgb_fcoe_init_ddp (adap); +#endif /* CONFIG_CHELSIO_T4_FCOE */ adap->params.offload =1 ; }
@@ -5509,6 +5540,9 @@ static int adap_init0(struct adapter *adap) bye:if (ret != -ETIMEDOUT && ret != -EIO )t4_fw_bye (adap, adap->mbox); +#ifdef CONFIG_CHELSIO_T4_FCOE +cxgb_fcoe_exit_ddp (adap); +#endif /* CONFIG_CHELSIO_T4_FCOE */ return ret; }
@@ -6294,6 +6328,9 @@ static void remove_one(struct pci_dev *pdev)iounmap (adapter->regs);if (!is_t4 (adapter->params.chip))iounmap (adapter->bar2); +#ifdef CONFIG_CHELSIO_T4_FCOE +cxgb_fcoe_exit_ddp (adapter); +#endif /* CONFIG_CHELSIO_T4_FCOE */ pci_disable_pcie_error_reporting (pdev);if ((adapter->flags &DEV_ENABLED )) {pci_disable_device (pdev);
drivers/net/ethernet/chelsio/cxgb4/sge.c +323 -5
361 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +1 -0
@@ -4522,6 +4522,7 @@ int t4_init_tp_params(struct adapter *adap)* shift positions of several elements of the Compressed Filter Tuple * for this adapter which we need frequently ... */ + adap->params.tp.fcoe_shift =t4_filter_field_shift (adap,FCOE_F ); adap->params.tp.vlan_shift =t4_filter_field_shift (adap,VLAN_F ); adap->params.tp.vnic_shift =t4_filter_field_shift (adap,VNIC_ID_F ); adap->params.tp.port_shift =t4_filter_field_shift (adap,PORT_F );
Signature · 1 line
1.7.1
PATCH 3/3 cxgb4: enable RSS for FCoE frames
In reply to Varun Prakash--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 8 ++++++++ drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 8 ++++++++ 2 files changed, 16 insertions(+), 0 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +8 -0
@@ -918,6 +918,9 @@ static int write_rss(const struct port_info *pi, const u16 *queues)static int setup_rss (struct adapter *adap) {int i, err; +#ifdef CONFIG_CHELSIO_T4_FCOE +u32 rss_config; +#endif for_each_port (adap, i) {const struct port_info *pi =adap2pinfo (adap, i);
@@ -926,6 +929,11 @@ static int setup_rss(struct adapter *adap)if (err)return err; } +#ifdef CONFIG_CHELSIO_T4_FCOE + rss_config =t4_read_reg (adap,TP_RSS_CONFIG_A ); + rss_config |=TNLFCOEEN_F |TNLFCOEMODE_F ; +t4_write_reg (adap,TP_RSS_CONFIG_A , rss_config); +#endif return 0 ; }
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +8 -0
@@ -1853,6 +1853,14 @@#define DISABLE_V (x) ((x) << DISABLE_S)#define DISABLE_F DISABLE_V(1U) +#define TNLFCOEMODE_S 23 +#define TNLFCOEMODE_V (x) ((x) << TNLFCOEMODE_S) +#define TNLFCOEMODE_F TNLFCOEMODE_V(1U) + +#define TNLFCOEEN_S 21 +#define TNLFCOEEN_V (x) ((x) << TNLFCOEEN_S) +#define TNLFCOEEN_F TNLFCOEEN_V(1U) +#define TP_RSS_CONFIG_TNL_A 0x7df4#define MASKSIZE_S 28
Signature · 1 line
1.7.1
David Miller
maintainerFrom: Varun Prakash <[email protected]>
Date: Fri, 27 Mar 2015 20:29:36 +0530
Quoted 2 lines
This patch series enables RSS for FCoE frames and adds DDP support for FCoE target.
Series applied, thanks Varun.
David Miller
maintainerFrom: David Miller <[email protected]>
Date: Tue, 31 Mar 2015 12:04:13 -0400 (EDT)
Quoted 7 lines
From: Varun Prakash <[email protected]>
Date: Fri, 27 Mar 2015 20:29:36 +0530Quoted 2 lines
This patch series enables RSS for FCoE frames and adds DDP support for FCoE target.
Series applied, thanks Varun.
I have to revert, this series breaks the build:
[davem@localhost net-next]$ make -s -j8
In file included from drivers/infiniband/hw/cxgb4/t4.h:37:0,
from drivers/infiniband/hw/cxgb4/iw_cxgb4.h:73,
from drivers/infiniband/hw/cxgb4/device.c:40:
drivers/infiniband/hw/cxgb4/t4fw_ri_api.h:821:8: error: redefinition of ‘struct ulptx_idata’
struct ulptx_idata {
^
In file included from drivers/infiniband/hw/cxgb4/t4.h:36:0,
from drivers/infiniband/hw/cxgb4/iw_cxgb4.h:73,
from drivers/infiniband/hw/cxgb4/device.c:40:
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h:1110:8: note: originally defined here
struct ulptx_idata {
^scripts/Makefile.build:258: recipe for target 'drivers/infiniband/hw/cxgb4/device.o' failed make[4]: *** [drivers/infiniband/hw/cxgb4/device.o] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from drivers/infiniband/hw/cxgb4/t4.h:37:0,
from drivers/infiniband/hw/cxgb4/iw_cxgb4.h:73,
from drivers/infiniband/hw/cxgb4/cm.c:52:
drivers/infiniband/hw/cxgb4/t4fw_ri_api.h:821:8: error: redefinition of ‘struct ulptx_idata’
struct ulptx_idata {
^
In file included from drivers/infiniband/hw/cxgb4/t4.h:36:0,
from drivers/infiniband/hw/cxgb4/iw_cxgb4.h:73,
from drivers/infiniband/hw/cxgb4/cm.c:52:
drivers/net/ethernet/chelsio/cxgb4/t4_msg.h:1110:8: note: originally defined here
struct ulptx_idata {
^scripts/Makefile.build:258: recipe for target 'drivers/infiniband/hw/cxgb4/cm.o' failed make[4]: *** [drivers/infiniband/hw/cxgb4/cm.o] Error 1 scripts/Makefile.build:403: recipe for target 'drivers/infiniband/hw/cxgb4' failed make[3]: *** [drivers/infiniband/hw/cxgb4] Error 2
make[3]: *** Waiting for unfinished jobs....scripts/Makefile.build:403: recipe for target 'drivers/infiniband/hw' failed make[2]: *** [drivers/infiniband/hw] Error 2
make[2]: *** Waiting for unfinished jobs....scripts/Makefile.build:403: recipe for target 'drivers/infiniband' failed make[1]: *** [drivers/infiniband] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:947: recipe for target 'drivers' failed
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs....
[davem@localhost net-next]$