Re: [Open-FCoE] [PATCH RFC net-next 1/5] qed: Add support for hardware offloaded FCoE.

2017-01-10 Thread Arun Easi
Hi Hannes,

Thank you for the review. Please see my comment inline..

On Wed, 28 Dec 2016, 12:41am, Hannes Reinecke wrote:

> On 12/23/2016 08:17 PM, Dupuis, Chad wrote:
> > From: Arun Easi 
> > 
> > This adds the backbone required for the various HW initalizations
> > which are necessary for the FCoE driver (qedf) for QLogic FastLinQ
> > 4 line of adapters - FW notification, resource initializations, etc.
> > 
> > Signed-off-by: Arun Easi 
> > Signed-off-by: Yuval Mintz 
> > ---

--8<-- snipped --

> > diff --git a/include/linux/qed/qed_fcoe_if.h 
> > b/include/linux/qed/qed_fcoe_if.h
> > new file mode 100644
> > index 000..bd6bcb8
> > --- /dev/null
> > +++ b/include/linux/qed/qed_fcoe_if.h
> > @@ -0,0 +1,145 @@
> > +#ifndef _QED_FCOE_IF_H
> > +#define _QED_FCOE_IF_H
> > +#include 
> > +#include 
> > +struct qed_fcoe_stats {
> > +   u64 fcoe_rx_byte_cnt;
> > +   u64 fcoe_rx_data_pkt_cnt;
> > +   u64 fcoe_rx_xfer_pkt_cnt;
> > +   u64 fcoe_rx_other_pkt_cnt;
> > +   u32 fcoe_silent_drop_pkt_cmdq_full_cnt;
> > +   u32 fcoe_silent_drop_pkt_rq_full_cnt;
> > +   u32 fcoe_silent_drop_pkt_crc_error_cnt;
> > +   u32 fcoe_silent_drop_pkt_task_invalid_cnt;
> > +   u32 fcoe_silent_drop_total_pkt_cnt;
> > +
> > +   u64 fcoe_tx_byte_cnt;
> > +   u64 fcoe_tx_data_pkt_cnt;
> > +   u64 fcoe_tx_xfer_pkt_cnt;
> > +   u64 fcoe_tx_other_pkt_cnt;
> > +};
> > +
> > +struct qed_dev_fcoe_info {
> > +   struct qed_dev_info common;
> > +
> > +   void __iomem *primary_dbq_rq_addr;
> > +   void __iomem *secondary_bdq_rq_addr;
> > +};
> > +
> > +struct qed_fcoe_params_offload {
> > +   dma_addr_t sq_pbl_addr;
> > +   dma_addr_t sq_curr_page_addr;
> > +   dma_addr_t sq_next_page_addr;
> > +
> > +   u8 src_mac[ETH_ALEN];
> > +   u8 dst_mac[ETH_ALEN];
> > +
> > +   u16 tx_max_fc_pay_len;
> > +   u16 e_d_tov_timer_val;
> > +   u16 rec_tov_timer_val;
> > +   u16 rx_max_fc_pay_len;
> > +   u16 vlan_tag;
> > +
> > +   struct fc_addr_nw s_id;
> > +   u8 max_conc_seqs_c3;
> > +   struct fc_addr_nw d_id;
> > +   u8 flags;
> > +   u8 def_q_idx;
> > +};
> > +
> > +#define MAX_TID_BLOCKS_FCOE (512)
> > +struct qed_fcoe_tid {
> > +   u32 size;   /* In bytes per task */
> > +   u32 num_tids_per_block;
> > +   u8 *blocks[MAX_TID_BLOCKS_FCOE];
> > +};
> > +
> > +struct qed_fcoe_cb_ops {
> > +   struct qed_common_cb_ops common;
> > +u32 (*get_login_failures)(void *cookie);
> > +};
> > +
> > +void qed_fcoe_set_pf_params(struct qed_dev *cdev,
> > +   struct qed_fcoe_pf_params *params);
> > +
> > +/**
> > + * struct qed_fcoe_ops - qed FCoE operations.
> > + * @common:common operations pointer
> > + * @fill_dev_info: fills FCoE specific information
> > + * @param cdev
> > + * @param info
> > + * @return 0 on sucesss, otherwise error value.
> > + * @register_ops:  register FCoE operations
> > + * @param cdev
> > + * @param ops - specified using qed_iscsi_cb_ops
> > + * @param cookie - driver private
> > + * @ll2:   light L2 operations pointer
> > + * @start: fcoe in FW
> > + * @param cdev
> > + * @param tasks - qed will fill information about tasks
> > + * return 0 on success, otherwise error value.
> > + * @stop:  stops fcoe in FW
> > + * @param cdev
> > + * return 0 on success, otherwise error value.
> > + * @acquire_conn:  acquire a new fcoe connection
> > + * @param cdev
> > + * @param handle - qed will fill handle that should be
> > + * used henceforth as identifier of the
> > + * connection.
> > + * @param p_doorbell - qed will fill the address of the
> > + * doorbell.
> > + * return 0 on sucesss, otherwise error value.
> > + * @release_conn:  release a previously acquired fcoe connection
> > + * @param cdev
> > + * @param handle - the connection handle.
> > + * return 0 on success, otherwise error value.
> > + * @offload_conn:  configures an offloaded connection
> > + * @param cdev
> > + * @param handle - the connection handle.
> > + * @param conn_info - the configuration to use for the
> > + * offload.
> > + * return 0 on success, otherwise error value.
> > + * @destroy_conn:  stops an offloaded connection
> > + * @param cdev
> > + * @param handle - the connection handle.
> > + * @param terminate_params
> > + * return 0 on success, otherwise error value.
> > + * @get_stats: gets FCoE related statistics
> > + * @param cdev
> > + * @param stats - pointer to 

RE: [Open-FCoE] [PATCH RFC net-next 1/5] qed: Add support for hardware offloaded FCoE.

2016-12-29 Thread Mintz, Yuval
> > +struct fcoe_tstorm_fcoe_task_st_ctx_read_write {
> > +   union fcoe_cleanup_addr_exp_ro_union
> cleanup_addr_exp_ro_union;
> > +   __le16 flags;
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RX_SGL_MODE_MASK
> 0x7
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RX_SGL_MODE_SHIFT  0
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_EXP_FIRST_FRAME_MASK
> 0x1
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_EXP_FIRST_FRAME_SHIFT
> 3
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_ACTIVE_MASK
> 0x1
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_ACTIVE_SHIFT   4
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_TIMEOUT_MASK
> 0x1
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SEQ_TIMEOUT_SHIFT  5
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SINGLE_PKT_IN_EX_MASK
> 0x1
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_SINGLE_PKT_IN_EX_SHIFT
> 6
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_OOO_RX_SEQ_STAT_MAS
> K   0x1
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_OOO_RX_SEQ_STAT_SHIFT
> 7
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_CQ_ADD_ADV_MASK
> 0x3
> > +#define
> FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_CQ_ADD_ADV_SHIFT   8
> > +#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RSRV1_MASK
> 0x3F
> > +#define FCOE_TSTORM_FCOE_TASK_ST_CTX_READ_WRITE_RSRV1_SHIFT
> 10
> 
> A very odd way of defining a bitfield ...
> Why not use a 'normal' bitfield here?

This is the format of our generated firmware HSI; We already have
Thousands of definitions using this same format.



Re: [Open-FCoE] [PATCH RFC net-next 1/5] qed: Add support for hardware offloaded FCoE.

2016-12-28 Thread Hannes Reinecke
On 12/23/2016 08:17 PM, Dupuis, Chad wrote:
> From: Arun Easi 
> 
> This adds the backbone required for the various HW initalizations
> which are necessary for the FCoE driver (qedf) for QLogic FastLinQ
> 4 line of adapters - FW notification, resource initializations, etc.
> 
> Signed-off-by: Arun Easi 
> Signed-off-by: Yuval Mintz 
> ---
>  drivers/net/ethernet/qlogic/Kconfig   |   3 +
>  drivers/net/ethernet/qlogic/qed/Makefile  |   1 +
>  drivers/net/ethernet/qlogic/qed/qed.h |  11 +
>  drivers/net/ethernet/qlogic/qed/qed_cxt.c |  98 ++-
>  drivers/net/ethernet/qlogic/qed/qed_cxt.h |   3 +
>  drivers/net/ethernet/qlogic/qed/qed_dcbx.c|  11 +
>  drivers/net/ethernet/qlogic/qed/qed_dcbx.h|   1 +
>  drivers/net/ethernet/qlogic/qed/qed_dev.c | 205 -
>  drivers/net/ethernet/qlogic/qed/qed_dev_api.h |  42 +
>  drivers/net/ethernet/qlogic/qed/qed_fcoe.c| 990 
> ++
>  drivers/net/ethernet/qlogic/qed/qed_fcoe.h|  52 ++
>  drivers/net/ethernet/qlogic/qed/qed_hsi.h | 781 -
>  drivers/net/ethernet/qlogic/qed/qed_hw.c  |   3 +
>  drivers/net/ethernet/qlogic/qed/qed_ll2.c |  25 +
>  drivers/net/ethernet/qlogic/qed/qed_ll2.h |   2 +-
>  drivers/net/ethernet/qlogic/qed/qed_main.c|   7 +
>  drivers/net/ethernet/qlogic/qed/qed_mcp.c |   3 +
>  drivers/net/ethernet/qlogic/qed/qed_mcp.h |   1 +
>  drivers/net/ethernet/qlogic/qed/qed_reg_addr.h|   8 +
>  drivers/net/ethernet/qlogic/qed/qed_sp.h  |   4 +
>  drivers/net/ethernet/qlogic/qed/qed_sp_commands.c |   3 +
>  include/linux/qed/common_hsi.h|  10 +-
>  include/linux/qed/fcoe_common.h   | 715 
>  include/linux/qed/qed_fcoe_if.h   | 145 
>  include/linux/qed/qed_if.h|  39 +
>  25 files changed, 3152 insertions(+), 11 deletions(-)
>  create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.c
>  create mode 100644 drivers/net/ethernet/qlogic/qed/qed_fcoe.h
>  create mode 100644 include/linux/qed/fcoe_common.h
>  create mode 100644 include/linux/qed/qed_fcoe_if.h
> 
> diff --git a/drivers/net/ethernet/qlogic/Kconfig 
> b/drivers/net/ethernet/qlogic/Kconfig
> index 3cfd105..737b303 100644
> --- a/drivers/net/ethernet/qlogic/Kconfig
> +++ b/drivers/net/ethernet/qlogic/Kconfig
> @@ -113,4 +113,7 @@ config QED_RDMA
>  config QED_ISCSI
>   bool
>  
> +config QED_FCOE
> + bool
> +
>  endif # NET_VENDOR_QLOGIC
> diff --git a/drivers/net/ethernet/qlogic/qed/Makefile 
> b/drivers/net/ethernet/qlogic/qed/Makefile
> index 729e437..e234083 100644
> --- a/drivers/net/ethernet/qlogic/qed/Makefile
> +++ b/drivers/net/ethernet/qlogic/qed/Makefile
> @@ -7,3 +7,4 @@ qed-$(CONFIG_QED_SRIOV) += qed_sriov.o qed_vf.o
>  qed-$(CONFIG_QED_LL2) += qed_ll2.o
>  qed-$(CONFIG_QED_RDMA) += qed_roce.o
>  qed-$(CONFIG_QED_ISCSI) += qed_iscsi.o qed_ooo.o
> +qed-$(CONFIG_QED_FCOE) += qed_fcoe.o
> diff --git a/drivers/net/ethernet/qlogic/qed/qed.h 
> b/drivers/net/ethernet/qlogic/qed/qed.h
> index 44c184e..cbb4ebc 100644
> --- a/drivers/net/ethernet/qlogic/qed/qed.h
> +++ b/drivers/net/ethernet/qlogic/qed/qed.h
> @@ -36,6 +36,7 @@
>  #define QED_WFQ_UNIT 100
>  
>  #define ISCSI_BDQ_ID(_port_id) (_port_id)
> +#define FCOE_BDQ_ID(_port_id) ((_port_id) + 2)
>  #define QED_WID_SIZE(1024)
>  #define QED_PF_DEMS_SIZE(4)
>  
> @@ -143,6 +144,7 @@ struct qed_tunn_update_params {
>   */
>  enum qed_pci_personality {
>   QED_PCI_ETH,
> + QED_PCI_FCOE,
>   QED_PCI_ISCSI,
>   QED_PCI_ETH_ROCE,
>   QED_PCI_DEFAULT /* default in shmem */
> @@ -180,6 +182,7 @@ enum QED_FEATURE {
>   QED_VF,
>   QED_RDMA_CNQ,
>   QED_VF_L2_QUE,
> + QED_FCOE_CQ,
>   QED_MAX_FEATURES,
>  };
>  
> @@ -197,6 +200,7 @@ enum QED_PORT_MODE {
>  
>  enum qed_dev_cap {
>   QED_DEV_CAP_ETH,
> + QED_DEV_CAP_FCOE,
>   QED_DEV_CAP_ISCSI,
>   QED_DEV_CAP_ROCE,
>  };
> @@ -231,6 +235,10 @@ struct qed_hw_info {
>   u32 part_num[4];
>  
>   unsigned char   hw_mac_addr[ETH_ALEN];
> + u64 node_wwn;
> + u64 port_wwn;
> +
> + u16 num_fcoe_conns;
>  
>   struct qed_igu_info *p_igu_info;
>  
> @@ -386,6 +394,7 @@ struct qed_hwfn {
>   struct qed_ooo_info *p_ooo_info;
>   struct qed_rdma_info*p_rdma_info;
>   struct qed_iscsi_info   *p_iscsi_info;
> + struct qed_fcoe_info*p_fcoe_info;
>   struct qed_pf_paramspf_params;
>  
>   bool b_rdma_enabled_in_prs;
> @@ -594,11 +603,13 @@ struct qed_dev {
>  
>   u8  protocol;
>  #define IS_QED_ETH_IF(cdev) ((cdev)->protocol ==