mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 09:14:19 +08:00
qed: Add support for hardware offloaded iSCSI.
This adds the backbone required for the various HW initalizations which are necessary for the iSCSI driver (qedi) for QLogic FastLinQ 4xxxx line of adapters - FW notification, resource initializations, etc. Signed-off-by: Arun Easi <arun.easi@cavium.com> Signed-off-by: Yuval Mintz <yuval.mintz@cavium.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b14945ac3e
commit
fc831825f9
@ -110,4 +110,7 @@ config QEDE
|
||||
config QED_RDMA
|
||||
bool
|
||||
|
||||
config QED_ISCSI
|
||||
bool
|
||||
|
||||
endif # NET_VENDOR_QLOGIC
|
||||
|
@ -6,3 +6,4 @@ qed-y := qed_cxt.o qed_dev.o qed_hw.o qed_init_fw_funcs.o qed_init_ops.o \
|
||||
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
|
||||
|
@ -35,6 +35,7 @@ extern const struct qed_common_ops qed_common_ops_pass;
|
||||
|
||||
#define QED_WFQ_UNIT 100
|
||||
|
||||
#define ISCSI_BDQ_ID(_port_id) (_port_id)
|
||||
#define QED_WID_SIZE (1024)
|
||||
#define QED_PF_DEMS_SIZE (4)
|
||||
|
||||
@ -383,6 +384,7 @@ struct qed_hwfn {
|
||||
bool using_ll2;
|
||||
struct qed_ll2_info *p_ll2_info;
|
||||
struct qed_rdma_info *p_rdma_info;
|
||||
struct qed_iscsi_info *p_iscsi_info;
|
||||
struct qed_pf_params pf_params;
|
||||
|
||||
bool b_rdma_enabled_in_prs;
|
||||
@ -581,6 +583,8 @@ struct qed_dev {
|
||||
/* Linux specific here */
|
||||
struct qede_dev *edev;
|
||||
struct pci_dev *pdev;
|
||||
u32 flags;
|
||||
#define QED_FLAG_STORAGE_STARTED (BIT(0))
|
||||
int msg_enable;
|
||||
|
||||
struct pci_params pci_params;
|
||||
@ -594,6 +598,7 @@ struct qed_dev {
|
||||
union {
|
||||
struct qed_common_cb_ops *common;
|
||||
struct qed_eth_cb_ops *eth;
|
||||
struct qed_iscsi_cb_ops *iscsi;
|
||||
} protocol_ops;
|
||||
void *ops_cookie;
|
||||
|
||||
@ -603,7 +608,7 @@ struct qed_dev {
|
||||
struct qed_cb_ll2_info *ll2;
|
||||
u8 ll2_mac_address[ETH_ALEN];
|
||||
#endif
|
||||
|
||||
DECLARE_HASHTABLE(connections, 10);
|
||||
const struct firmware *firmware;
|
||||
|
||||
u32 rdma_max_sge;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "qed_hw.h"
|
||||
#include "qed_init_ops.h"
|
||||
#include "qed_int.h"
|
||||
#include "qed_iscsi.h"
|
||||
#include "qed_ll2.h"
|
||||
#include "qed_mcp.h"
|
||||
#include "qed_reg_addr.h"
|
||||
@ -146,6 +147,8 @@ void qed_resc_free(struct qed_dev *cdev)
|
||||
#ifdef CONFIG_QED_LL2
|
||||
qed_ll2_free(p_hwfn, p_hwfn->p_ll2_info);
|
||||
#endif
|
||||
if (p_hwfn->hw_info.personality == QED_PCI_ISCSI)
|
||||
qed_iscsi_free(p_hwfn, p_hwfn->p_iscsi_info);
|
||||
qed_iov_free(p_hwfn);
|
||||
qed_dmae_info_free(p_hwfn);
|
||||
qed_dcbx_info_free(p_hwfn, p_hwfn->p_dcbx_info);
|
||||
@ -402,6 +405,7 @@ int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
|
||||
|
||||
int qed_resc_alloc(struct qed_dev *cdev)
|
||||
{
|
||||
struct qed_iscsi_info *p_iscsi_info;
|
||||
#ifdef CONFIG_QED_LL2
|
||||
struct qed_ll2_info *p_ll2_info;
|
||||
#endif
|
||||
@ -507,6 +511,12 @@ int qed_resc_alloc(struct qed_dev *cdev)
|
||||
p_hwfn->p_ll2_info = p_ll2_info;
|
||||
}
|
||||
#endif
|
||||
if (p_hwfn->hw_info.personality == QED_PCI_ISCSI) {
|
||||
p_iscsi_info = qed_iscsi_alloc(p_hwfn);
|
||||
if (!p_iscsi_info)
|
||||
goto alloc_no_mem;
|
||||
p_hwfn->p_iscsi_info = p_iscsi_info;
|
||||
}
|
||||
|
||||
/* DMA info initialization */
|
||||
rc = qed_dmae_info_alloc(p_hwfn);
|
||||
@ -560,6 +570,8 @@ void qed_resc_setup(struct qed_dev *cdev)
|
||||
if (p_hwfn->using_ll2)
|
||||
qed_ll2_setup(p_hwfn, p_hwfn->p_ll2_info);
|
||||
#endif
|
||||
if (p_hwfn->hw_info.personality == QED_PCI_ISCSI)
|
||||
qed_iscsi_setup(p_hwfn, p_hwfn->p_iscsi_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
1277
drivers/net/ethernet/qlogic/qed/qed_iscsi.c
Normal file
1277
drivers/net/ethernet/qlogic/qed/qed_iscsi.c
Normal file
File diff suppressed because it is too large
Load Diff
52
drivers/net/ethernet/qlogic/qed/qed_iscsi.h
Normal file
52
drivers/net/ethernet/qlogic/qed/qed_iscsi.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* QLogic qed NIC Driver
|
||||
* Copyright (c) 2015 QLogic Corporation
|
||||
*
|
||||
* This software is available under the terms of the GNU General Public License
|
||||
* (GPL) Version 2, available from the file COPYING in the main directory of
|
||||
* this source tree.
|
||||
*/
|
||||
|
||||
#ifndef _QED_ISCSI_H
|
||||
#define _QED_ISCSI_H
|
||||
#include <linux/types.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/qed/tcp_common.h>
|
||||
#include <linux/qed/qed_iscsi_if.h>
|
||||
#include <linux/qed/qed_chain.h>
|
||||
#include "qed.h"
|
||||
#include "qed_hsi.h"
|
||||
#include "qed_mcp.h"
|
||||
#include "qed_sp.h"
|
||||
|
||||
struct qed_iscsi_info {
|
||||
spinlock_t lock; /* Connection resources. */
|
||||
struct list_head free_list;
|
||||
u16 max_num_outstanding_tasks;
|
||||
void *event_context;
|
||||
iscsi_event_cb_t event_cb;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_QED_LL2
|
||||
extern const struct qed_ll2_ops qed_ll2_ops_pass;
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_QED_ISCSI)
|
||||
struct qed_iscsi_info *qed_iscsi_alloc(struct qed_hwfn *p_hwfn);
|
||||
|
||||
void qed_iscsi_setup(struct qed_hwfn *p_hwfn,
|
||||
struct qed_iscsi_info *p_iscsi_info);
|
||||
|
||||
void qed_iscsi_free(struct qed_hwfn *p_hwfn,
|
||||
struct qed_iscsi_info *p_iscsi_info);
|
||||
#else /* IS_ENABLED(CONFIG_QED_ISCSI) */
|
||||
static inline struct qed_iscsi_info *qed_iscsi_alloc(
|
||||
struct qed_hwfn *p_hwfn) { return NULL; }
|
||||
static inline void qed_iscsi_setup(struct qed_hwfn *p_hwfn,
|
||||
struct qed_iscsi_info *p_iscsi_info) {}
|
||||
static inline void qed_iscsi_free(struct qed_hwfn *p_hwfn,
|
||||
struct qed_iscsi_info *p_iscsi_info) {}
|
||||
#endif /* IS_ENABLED(CONFIG_QED_ISCSI) */
|
||||
|
||||
#endif
|
@ -1517,6 +1517,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
|
||||
enum qed_ll2_conn_type conn_type;
|
||||
struct qed_ptt *p_ptt;
|
||||
int rc, i;
|
||||
u8 gsi_enable = 1;
|
||||
|
||||
/* Initialize LL2 locks & lists */
|
||||
INIT_LIST_HEAD(&cdev->ll2->list);
|
||||
@ -1548,6 +1549,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
|
||||
switch (QED_LEADING_HWFN(cdev)->hw_info.personality) {
|
||||
case QED_PCI_ISCSI:
|
||||
conn_type = QED_LL2_TYPE_ISCSI;
|
||||
gsi_enable = 0;
|
||||
break;
|
||||
case QED_PCI_ETH_ROCE:
|
||||
conn_type = QED_LL2_TYPE_ROCE;
|
||||
@ -1564,7 +1566,7 @@ static int qed_ll2_start(struct qed_dev *cdev, struct qed_ll2_params *params)
|
||||
ll2_info.rx_vlan_removal_en = params->rx_vlan_stripping;
|
||||
ll2_info.tx_tc = 0;
|
||||
ll2_info.tx_dest = CORE_TX_DEST_NW;
|
||||
ll2_info.gsi_enable = 1;
|
||||
ll2_info.gsi_enable = gsi_enable;
|
||||
|
||||
rc = qed_ll2_acquire_connection(QED_LEADING_HWFN(cdev), &ll2_info,
|
||||
QED_LL2_RX_SIZE, QED_LL2_TX_SIZE,
|
||||
|
@ -82,6 +82,8 @@
|
||||
0x1c80000UL
|
||||
#define BAR0_MAP_REG_XSDM_RAM \
|
||||
0x1e00000UL
|
||||
#define BAR0_MAP_REG_YSDM_RAM \
|
||||
0x1e80000UL
|
||||
#define NIG_REG_RX_LLH_BRB_GATE_DNTFWD_PERPF \
|
||||
0x5011f4UL
|
||||
#define PRS_REG_SEARCH_TCP \
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "qed_hsi.h"
|
||||
#include "qed_hw.h"
|
||||
#include "qed_int.h"
|
||||
#include "qed_iscsi.h"
|
||||
#include "qed_mcp.h"
|
||||
#include "qed_reg_addr.h"
|
||||
#include "qed_sp.h"
|
||||
@ -277,6 +278,20 @@ qed_async_event_completion(struct qed_hwfn *p_hwfn,
|
||||
return qed_sriov_eqe_event(p_hwfn,
|
||||
p_eqe->opcode,
|
||||
p_eqe->echo, &p_eqe->data);
|
||||
case PROTOCOLID_ISCSI:
|
||||
if (!IS_ENABLED(CONFIG_QED_ISCSI))
|
||||
return -EINVAL;
|
||||
|
||||
if (p_hwfn->p_iscsi_info->event_cb) {
|
||||
struct qed_iscsi_info *p_iscsi = p_hwfn->p_iscsi_info;
|
||||
|
||||
return p_iscsi->event_cb(p_iscsi->event_context,
|
||||
p_eqe->opcode, &p_eqe->data);
|
||||
} else {
|
||||
DP_NOTICE(p_hwfn,
|
||||
"iSCSI async completion is not set\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
default:
|
||||
DP_NOTICE(p_hwfn,
|
||||
"Unknown Async completion for protocol: %d\n",
|
||||
|
@ -166,6 +166,7 @@ struct qed_iscsi_pf_params {
|
||||
u32 max_cwnd;
|
||||
u16 cq_num_entries;
|
||||
u16 cmdq_num_entries;
|
||||
u32 two_msl_timer;
|
||||
u16 dup_ack_threshold;
|
||||
u16 tx_sws_timer;
|
||||
u16 min_rto;
|
||||
@ -275,6 +276,7 @@ struct qed_dev_info {
|
||||
enum qed_sb_type {
|
||||
QED_SB_TYPE_L2_QUEUE,
|
||||
QED_SB_TYPE_CNQ,
|
||||
QED_SB_TYPE_STORAGE,
|
||||
};
|
||||
|
||||
enum qed_protocol {
|
||||
|
229
include/linux/qed/qed_iscsi_if.h
Normal file
229
include/linux/qed/qed_iscsi_if.h
Normal file
@ -0,0 +1,229 @@
|
||||
/* QLogic qed NIC Driver
|
||||
* Copyright (c) 2015 QLogic Corporation
|
||||
*
|
||||
* This software is available under the terms of the GNU General Public License
|
||||
* (GPL) Version 2, available from the file COPYING in the main directory of
|
||||
* this source tree.
|
||||
*/
|
||||
|
||||
#ifndef _QED_ISCSI_IF_H
|
||||
#define _QED_ISCSI_IF_H
|
||||
#include <linux/types.h>
|
||||
#include <linux/qed/qed_if.h>
|
||||
|
||||
typedef int (*iscsi_event_cb_t) (void *context,
|
||||
u8 fw_event_code, void *fw_handle);
|
||||
struct qed_iscsi_stats {
|
||||
u64 iscsi_rx_bytes_cnt;
|
||||
u64 iscsi_rx_packet_cnt;
|
||||
u64 iscsi_rx_new_ooo_isle_events_cnt;
|
||||
u32 iscsi_cmdq_threshold_cnt;
|
||||
u32 iscsi_rq_threshold_cnt;
|
||||
u32 iscsi_immq_threshold_cnt;
|
||||
|
||||
u64 iscsi_rx_dropped_pdus_task_not_valid;
|
||||
|
||||
u64 iscsi_rx_data_pdu_cnt;
|
||||
u64 iscsi_rx_r2t_pdu_cnt;
|
||||
u64 iscsi_rx_total_pdu_cnt;
|
||||
|
||||
u64 iscsi_tx_go_to_slow_start_event_cnt;
|
||||
u64 iscsi_tx_fast_retransmit_event_cnt;
|
||||
|
||||
u64 iscsi_tx_data_pdu_cnt;
|
||||
u64 iscsi_tx_r2t_pdu_cnt;
|
||||
u64 iscsi_tx_total_pdu_cnt;
|
||||
|
||||
u64 iscsi_tx_bytes_cnt;
|
||||
u64 iscsi_tx_packet_cnt;
|
||||
};
|
||||
|
||||
struct qed_dev_iscsi_info {
|
||||
struct qed_dev_info common;
|
||||
|
||||
void __iomem *primary_dbq_rq_addr;
|
||||
void __iomem *secondary_bdq_rq_addr;
|
||||
};
|
||||
|
||||
struct qed_iscsi_id_params {
|
||||
u8 mac[ETH_ALEN];
|
||||
u32 ip[4];
|
||||
u16 port;
|
||||
};
|
||||
|
||||
struct qed_iscsi_params_offload {
|
||||
u8 layer_code;
|
||||
dma_addr_t sq_pbl_addr;
|
||||
u32 initial_ack;
|
||||
|
||||
struct qed_iscsi_id_params src;
|
||||
struct qed_iscsi_id_params dst;
|
||||
u16 vlan_id;
|
||||
u8 tcp_flags;
|
||||
u8 ip_version;
|
||||
u8 default_cq;
|
||||
|
||||
u8 ka_max_probe_cnt;
|
||||
u8 dup_ack_theshold;
|
||||
u32 rcv_next;
|
||||
u32 snd_una;
|
||||
u32 snd_next;
|
||||
u32 snd_max;
|
||||
u32 snd_wnd;
|
||||
u32 rcv_wnd;
|
||||
u32 snd_wl1;
|
||||
u32 cwnd;
|
||||
u32 ss_thresh;
|
||||
u16 srtt;
|
||||
u16 rtt_var;
|
||||
u32 ts_time;
|
||||
u32 ts_recent;
|
||||
u32 ts_recent_age;
|
||||
u32 total_rt;
|
||||
u32 ka_timeout_delta;
|
||||
u32 rt_timeout_delta;
|
||||
u8 dup_ack_cnt;
|
||||
u8 snd_wnd_probe_cnt;
|
||||
u8 ka_probe_cnt;
|
||||
u8 rt_cnt;
|
||||
u32 flow_label;
|
||||
u32 ka_timeout;
|
||||
u32 ka_interval;
|
||||
u32 max_rt_time;
|
||||
u32 initial_rcv_wnd;
|
||||
u8 ttl;
|
||||
u8 tos_or_tc;
|
||||
u16 remote_port;
|
||||
u16 local_port;
|
||||
u16 mss;
|
||||
u8 snd_wnd_scale;
|
||||
u8 rcv_wnd_scale;
|
||||
u32 ts_ticks_per_second;
|
||||
u16 da_timeout_value;
|
||||
u8 ack_frequency;
|
||||
};
|
||||
|
||||
struct qed_iscsi_params_update {
|
||||
u8 update_flag;
|
||||
#define QED_ISCSI_CONN_HD_EN BIT(0)
|
||||
#define QED_ISCSI_CONN_DD_EN BIT(1)
|
||||
#define QED_ISCSI_CONN_INITIAL_R2T BIT(2)
|
||||
#define QED_ISCSI_CONN_IMMEDIATE_DATA BIT(3)
|
||||
|
||||
u32 max_seq_size;
|
||||
u32 max_recv_pdu_length;
|
||||
u32 max_send_pdu_length;
|
||||
u32 first_seq_length;
|
||||
u32 exp_stat_sn;
|
||||
};
|
||||
|
||||
#define MAX_TID_BLOCKS_ISCSI (512)
|
||||
struct qed_iscsi_tid {
|
||||
u32 size; /* In bytes per task */
|
||||
u32 num_tids_per_block;
|
||||
u8 *blocks[MAX_TID_BLOCKS_ISCSI];
|
||||
};
|
||||
|
||||
struct qed_iscsi_cb_ops {
|
||||
struct qed_common_cb_ops common;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct qed_iscsi_ops - qed iSCSI operations.
|
||||
* @common: common operations pointer
|
||||
* @ll2: light L2 operations pointer
|
||||
* @fill_dev_info: fills iSCSI specific information
|
||||
* @param cdev
|
||||
* @param info
|
||||
* @return 0 on sucesss, otherwise error value.
|
||||
* @register_ops: register iscsi operations
|
||||
* @param cdev
|
||||
* @param ops - specified using qed_iscsi_cb_ops
|
||||
* @param cookie - driver private
|
||||
* @start: iscsi in FW
|
||||
* @param cdev
|
||||
* @param tasks - qed will fill information about tasks
|
||||
* return 0 on success, otherwise error value.
|
||||
* @stop: iscsi in FW
|
||||
* @param cdev
|
||||
* return 0 on success, otherwise error value.
|
||||
* @acquire_conn: acquire a new iscsi 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 iscsi 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.
|
||||
* @update_conn: updates 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.
|
||||
* @return 0 on success, otherwise error value.
|
||||
* @clear_sq: clear all task in sq
|
||||
* @param cdev
|
||||
* @param handle - the connection handle.
|
||||
* @return 0 on success, otherwise error value.
|
||||
* @get_stats: iSCSI related statistics
|
||||
* @param cdev
|
||||
* @param stats - pointer to struck that would be filled
|
||||
* we stats
|
||||
* @return 0 on success, error otherwise.
|
||||
*/
|
||||
struct qed_iscsi_ops {
|
||||
const struct qed_common_ops *common;
|
||||
|
||||
const struct qed_ll2_ops *ll2;
|
||||
|
||||
int (*fill_dev_info)(struct qed_dev *cdev,
|
||||
struct qed_dev_iscsi_info *info);
|
||||
|
||||
void (*register_ops)(struct qed_dev *cdev,
|
||||
struct qed_iscsi_cb_ops *ops, void *cookie);
|
||||
|
||||
int (*start)(struct qed_dev *cdev,
|
||||
struct qed_iscsi_tid *tasks,
|
||||
void *event_context, iscsi_event_cb_t async_event_cb);
|
||||
|
||||
int (*stop)(struct qed_dev *cdev);
|
||||
|
||||
int (*acquire_conn)(struct qed_dev *cdev,
|
||||
u32 *handle,
|
||||
u32 *fw_cid, void __iomem **p_doorbell);
|
||||
|
||||
int (*release_conn)(struct qed_dev *cdev, u32 handle);
|
||||
|
||||
int (*offload_conn)(struct qed_dev *cdev,
|
||||
u32 handle,
|
||||
struct qed_iscsi_params_offload *conn_info);
|
||||
|
||||
int (*update_conn)(struct qed_dev *cdev,
|
||||
u32 handle,
|
||||
struct qed_iscsi_params_update *conn_info);
|
||||
|
||||
int (*destroy_conn)(struct qed_dev *cdev, u32 handle, u8 abrt_conn);
|
||||
|
||||
int (*clear_sq)(struct qed_dev *cdev, u32 handle);
|
||||
|
||||
int (*get_stats)(struct qed_dev *cdev,
|
||||
struct qed_iscsi_stats *stats);
|
||||
};
|
||||
|
||||
const struct qed_iscsi_ops *qed_get_iscsi_ops(void);
|
||||
void qed_put_iscsi_ops(void);
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user