Commit 456a5849 authored by Kalderon, Michal's avatar Kalderon, Michal Committed by David S. Miller

qed: iWARP CM add passive side connect

This patch implements the passive side connect.
It addresses pre-allocating resources, creating a connection
element upon valid SYN packet received. Calling upper layer and
implementation of the accept/reject calls.

Error handling is not part of this patch.
Signed-off-by: default avatarMichal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: default avatarAriel Elior <Ariel.Elior@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 65a91a6c
...@@ -789,6 +789,8 @@ void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, ...@@ -789,6 +789,8 @@ void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev,
void qed_clean_wfq_db(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); void qed_clean_wfq_db(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
int qed_device_num_engines(struct qed_dev *cdev); int qed_device_num_engines(struct qed_dev *cdev);
int qed_device_get_port_id(struct qed_dev *cdev); int qed_device_get_port_id(struct qed_dev *cdev);
void qed_set_fw_mac_addr(__le16 *fw_msb,
__le16 *fw_mid, __le16 *fw_lsb, u8 *mac);
#define QED_LEADING_HWFN(dev) (&dev->hwfns[0]) #define QED_LEADING_HWFN(dev) (&dev->hwfns[0])
......
...@@ -4127,3 +4127,14 @@ int qed_device_get_port_id(struct qed_dev *cdev) ...@@ -4127,3 +4127,14 @@ int qed_device_get_port_id(struct qed_dev *cdev)
{ {
return (QED_LEADING_HWFN(cdev)->abs_pf_id) % qed_device_num_ports(cdev); return (QED_LEADING_HWFN(cdev)->abs_pf_id) % qed_device_num_ports(cdev);
} }
void qed_set_fw_mac_addr(__le16 *fw_msb,
__le16 *fw_mid, __le16 *fw_lsb, u8 *mac)
{
((u8 *)fw_msb)[0] = mac[1];
((u8 *)fw_msb)[1] = mac[0];
((u8 *)fw_mid)[0] = mac[3];
((u8 *)fw_mid)[1] = mac[2];
((u8 *)fw_lsb)[0] = mac[5];
((u8 *)fw_lsb)[1] = mac[4];
}
This diff is collapsed.
...@@ -42,6 +42,8 @@ enum qed_iwarp_qp_state { ...@@ -42,6 +42,8 @@ enum qed_iwarp_qp_state {
enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state); enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state);
#define QED_IWARP_PREALLOC_CNT (256)
#define QED_IWARP_LL2_SYN_TX_SIZE (128) #define QED_IWARP_LL2_SYN_TX_SIZE (128)
#define QED_IWARP_LL2_SYN_RX_SIZE (256) #define QED_IWARP_LL2_SYN_RX_SIZE (256)
#define QED_IWARP_MAX_SYN_PKT_SIZE (128) #define QED_IWARP_MAX_SYN_PKT_SIZE (128)
...@@ -55,6 +57,8 @@ struct qed_iwarp_ll2_buff { ...@@ -55,6 +57,8 @@ struct qed_iwarp_ll2_buff {
struct qed_iwarp_info { struct qed_iwarp_info {
struct list_head listen_list; /* qed_iwarp_listener */ struct list_head listen_list; /* qed_iwarp_listener */
struct list_head ep_list; /* qed_iwarp_ep */
struct list_head ep_free_list; /* pre-allocated ep's */
spinlock_t iw_lock; /* for iwarp resources */ spinlock_t iw_lock; /* for iwarp resources */
spinlock_t qp_lock; /* for teardown races */ spinlock_t qp_lock; /* for teardown races */
u32 rcv_wnd_scale; u32 rcv_wnd_scale;
...@@ -68,6 +72,61 @@ struct qed_iwarp_info { ...@@ -68,6 +72,61 @@ struct qed_iwarp_info {
enum mpa_rtr_type rtr_type; enum mpa_rtr_type rtr_type;
}; };
enum qed_iwarp_ep_state {
QED_IWARP_EP_INIT,
QED_IWARP_EP_MPA_REQ_RCVD,
QED_IWARP_EP_MPA_OFFLOADED,
QED_IWARP_EP_ESTABLISHED,
QED_IWARP_EP_CLOSED
};
union async_output {
struct iwarp_eqe_data_mpa_async_completion mpa_response;
struct iwarp_eqe_data_tcp_async_completion mpa_request;
};
#define QED_MAX_PRIV_DATA_LEN (512)
struct qed_iwarp_ep_memory {
u8 in_pdata[QED_MAX_PRIV_DATA_LEN];
u8 out_pdata[QED_MAX_PRIV_DATA_LEN];
union async_output async_output;
};
/* Endpoint structure represents a TCP connection. This connection can be
* associated with a QP or not (in which case QP==NULL)
*/
struct qed_iwarp_ep {
struct list_head list_entry;
struct qed_rdma_qp *qp;
struct qed_iwarp_ep_memory *ep_buffer_virt;
dma_addr_t ep_buffer_phys;
enum qed_iwarp_ep_state state;
int sig;
struct qed_iwarp_cm_info cm_info;
enum tcp_connect_mode connect_mode;
enum mpa_rtr_type rtr_type;
enum mpa_negotiation_mode mpa_rev;
u32 tcp_cid;
u32 cid;
u16 mss;
u8 remote_mac_addr[6];
u8 local_mac_addr[6];
bool mpa_reply_processed;
/* For Passive side - syn packet related data */
u16 syn_ip_payload_length;
struct qed_iwarp_ll2_buff *syn;
dma_addr_t syn_phy_addr;
/* The event_cb function is called for asynchrounous events associated
* with the ep. It is initialized at different entry points depending
* on whether the ep is the tcp connection active side or passive side
* The cb_context is passed to the event_cb function.
*/
iwarp_event_handler event_cb;
void *cb_context;
};
struct qed_iwarp_listener { struct qed_iwarp_listener {
struct list_head list_entry; struct list_head list_entry;
...@@ -115,6 +174,9 @@ qed_iwarp_create_listen(void *rdma_cxt, ...@@ -115,6 +174,9 @@ qed_iwarp_create_listen(void *rdma_cxt,
struct qed_iwarp_listen_in *iparams, struct qed_iwarp_listen_in *iparams,
struct qed_iwarp_listen_out *oparams); struct qed_iwarp_listen_out *oparams);
int qed_iwarp_accept(void *rdma_cxt, struct qed_iwarp_accept_in *iparams);
int qed_iwarp_reject(void *rdma_cxt, struct qed_iwarp_reject_in *iparams);
int qed_iwarp_destroy_listen(void *rdma_cxt, void *handle); int qed_iwarp_destroy_listen(void *rdma_cxt, void *handle);
#endif #endif
...@@ -1227,19 +1227,6 @@ static enum eth_filter_action qed_filter_action(enum qed_filter_opcode opcode) ...@@ -1227,19 +1227,6 @@ static enum eth_filter_action qed_filter_action(enum qed_filter_opcode opcode)
return action; return action;
} }
static void qed_set_fw_mac_addr(__le16 *fw_msb,
__le16 *fw_mid,
__le16 *fw_lsb,
u8 *mac)
{
((u8 *)fw_msb)[0] = mac[1];
((u8 *)fw_msb)[1] = mac[0];
((u8 *)fw_mid)[0] = mac[3];
((u8 *)fw_mid)[1] = mac[2];
((u8 *)fw_lsb)[0] = mac[5];
((u8 *)fw_lsb)[1] = mac[4];
}
static int static int
qed_filter_ucast_common(struct qed_hwfn *p_hwfn, qed_filter_ucast_common(struct qed_hwfn *p_hwfn,
u16 opaque_fid, u16 opaque_fid,
......
...@@ -85,6 +85,7 @@ struct qed_rdma_info { ...@@ -85,6 +85,7 @@ struct qed_rdma_info {
struct qed_bmap qp_map; struct qed_bmap qp_map;
struct qed_bmap srq_map; struct qed_bmap srq_map;
struct qed_bmap cid_map; struct qed_bmap cid_map;
struct qed_bmap tcp_cid_map;
struct qed_bmap real_cid_map; struct qed_bmap real_cid_map;
struct qed_bmap dpi_map; struct qed_bmap dpi_map;
struct qed_bmap toggle_bits; struct qed_bmap toggle_bits;
...@@ -167,6 +168,7 @@ struct qed_rdma_qp { ...@@ -167,6 +168,7 @@ struct qed_rdma_qp {
void *shared_queue; void *shared_queue;
dma_addr_t shared_queue_phys_addr; dma_addr_t shared_queue_phys_addr;
struct qed_iwarp_ep *ep;
}; };
#if IS_ENABLED(CONFIG_QED_RDMA) #if IS_ENABLED(CONFIG_QED_RDMA)
......
...@@ -111,6 +111,8 @@ union ramrod_data { ...@@ -111,6 +111,8 @@ union ramrod_data {
struct rdma_srq_destroy_ramrod_data rdma_destroy_srq; struct rdma_srq_destroy_ramrod_data rdma_destroy_srq;
struct rdma_srq_modify_ramrod_data rdma_modify_srq; struct rdma_srq_modify_ramrod_data rdma_modify_srq;
struct iwarp_create_qp_ramrod_data iwarp_create_qp; struct iwarp_create_qp_ramrod_data iwarp_create_qp;
struct iwarp_tcp_offload_ramrod_data iwarp_tcp_offload;
struct iwarp_mpa_offload_ramrod_data iwarp_mpa_offload;
struct iwarp_modify_qp_ramrod_data iwarp_modify_qp; struct iwarp_modify_qp_ramrod_data iwarp_modify_qp;
struct iwarp_init_func_ramrod_data iwarp_init_func; struct iwarp_init_func_ramrod_data iwarp_init_func;
struct fcoe_init_ramrod_params fcoe_init; struct fcoe_init_ramrod_params fcoe_init;
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <linux/slab.h> #include <linux/slab.h>
/* dma_addr_t manip */ /* dma_addr_t manip */
#define PTR_LO(x) ((u32)(((uintptr_t)(x)) & 0xffffffff))
#define PTR_HI(x) ((u32)((((uintptr_t)(x)) >> 16) >> 16))
#define DMA_LO_LE(x) cpu_to_le32(lower_32_bits(x)) #define DMA_LO_LE(x) cpu_to_le32(lower_32_bits(x))
#define DMA_HI_LE(x) cpu_to_le32(upper_32_bits(x)) #define DMA_HI_LE(x) cpu_to_le32(upper_32_bits(x))
#define DMA_REGPAIR_LE(x, val) do { \ #define DMA_REGPAIR_LE(x, val) do { \
......
...@@ -472,6 +472,7 @@ struct qed_rdma_counters_out_params { ...@@ -472,6 +472,7 @@ struct qed_rdma_counters_out_params {
enum qed_iwarp_event_type { enum qed_iwarp_event_type {
QED_IWARP_EVENT_MPA_REQUEST, /* Passive side request received */ QED_IWARP_EVENT_MPA_REQUEST, /* Passive side request received */
QED_IWARP_EVENT_PASSIVE_COMPLETE, /* ack on mpa response */
}; };
enum qed_tcp_ip_version { enum qed_tcp_ip_version {
...@@ -516,6 +517,23 @@ struct qed_iwarp_listen_out { ...@@ -516,6 +517,23 @@ struct qed_iwarp_listen_out {
void *handle; void *handle;
}; };
struct qed_iwarp_accept_in {
void *ep_context;
void *cb_context;
struct qed_rdma_qp *qp;
const void *private_data;
u16 private_data_len;
u8 ord;
u8 ird;
};
struct qed_iwarp_reject_in {
void *ep_context;
void *cb_context;
const void *private_data;
u16 private_data_len;
};
struct qed_roce_ll2_header { struct qed_roce_ll2_header {
void *vaddr; void *vaddr;
dma_addr_t baddr; dma_addr_t baddr;
...@@ -626,6 +644,12 @@ struct qed_rdma_ops { ...@@ -626,6 +644,12 @@ struct qed_rdma_ops {
struct qed_iwarp_listen_in *iparams, struct qed_iwarp_listen_in *iparams,
struct qed_iwarp_listen_out *oparams); struct qed_iwarp_listen_out *oparams);
int (*iwarp_accept)(void *rdma_cxt,
struct qed_iwarp_accept_in *iparams);
int (*iwarp_reject)(void *rdma_cxt,
struct qed_iwarp_reject_in *iparams);
int (*iwarp_destroy_listen)(void *rdma_cxt, void *handle); int (*iwarp_destroy_listen)(void *rdma_cxt, void *handle);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment