i40iw: Add Quality of Service support
PATCH v3 1/1 i40iw: Add Quality of Service support
Add support for QoS on QPs. Upon device initialization, a map is created from user priority to queue set handles. On QP creation, use ToS to look up the queue set handle for use with the QP.
Signed-off-by Faisal Latif <[email protected]>
Signed-off-by Shiraz Saleem <[email protected]>
Signed-off-by Henry Orosco <[email protected]>
---
V3:
- Replace deprecated create_singlethread_workqueue with alloc_ordered_workqueue.
V2:
- Fix i40iw_cm.c and i40iw_ctrl.c mode to 100644.
drivers/infiniband/hw/i40iw/i40iw.h | 9 ++ drivers/infiniband/hw/i40iw/i40iw_cm.c | 30 +++++- drivers/infiniband/hw/i40iw/i40iw_cm.h | 2 +- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 151 +++++++++++++++++++++++++++++- drivers/infiniband/hw/i40iw/i40iw_d.h | 2 + drivers/infiniband/hw/i40iw/i40iw_hw.c | 25 ++--- drivers/infiniband/hw/i40iw/i40iw_main.c | 66 +++++++++++-- drivers/infiniband/hw/i40iw/i40iw_osdep.h | 2 + drivers/infiniband/hw/i40iw/i40iw_p.h | 2 + drivers/infiniband/hw/i40iw/i40iw_puda.c | 3 +- drivers/infiniband/hw/i40iw/i40iw_type.h | 18 +++- drivers/infiniband/hw/i40iw/i40iw_utils.c | 45 +++++++++ drivers/infiniband/hw/i40iw/i40iw_verbs.c | 6 +- 13 files changed, 325 insertions(+), 36 deletions(-)
drivers/infiniband/hw/i40iw/i40iw.h +9 -0
@@ -210,6 +210,12 @@ struct i40iw_msix_vector {u32 ceq_id; }; +struct l2params_work { +struct work_struct work; +struct i40iw_device *iwdev; +struct i40iw_l2params l2params; +}; +#define I40IW_MSIX_TABLE_SIZE 65struct virtchnl_work {
@@ -514,6 +520,9 @@ void i40iw_add_pdusecount(struct i40iw_pd *iwpd);void i40iw_hw_modify_qp (struct i40iw_device *iwdev,struct i40iw_qp *iwqp,struct i40iw_modify_qp_info *info,bool wait); +void i40iw_qp_suspend_resume (struct i40iw_sc_dev *dev, +struct i40iw_sc_qp *qp, +bool suspend); enum i40iw_status_code i40iw_manage_qhash(struct i40iw_device *iwdev, struct i40iw_cm_info *cminfo, enum i40iw_quad_entry_type etype,
drivers/infiniband/hw/i40iw/i40iw_cm.c +27 -3
@@ -221,6 +221,7 @@ static void i40iw_get_addr_info(struct i40iw_cm_node *cm_node,memcpy (cm_info->rem_addr, cm_node->rem_addr,sizeof (cm_info->rem_addr)); cm_info->loc_port = cm_node->loc_port; cm_info->rem_port = cm_node->rem_port; + cm_info->user_pri = cm_node->user_pri; }/**
@@ -396,6 +397,7 @@ static struct i40iw_puda_buf *i40iw_form_cm_frame(struct i40iw_cm_node *cm_node,u32 opts_len =0 ;u32 pd_len =0 ;u32 hdr_len =0 ; +u16 vtag; sqbuf =i40iw_puda_get_bufpool (dev->ilq);if (!sqbuf)
@@ -445,7 +447,8 @@ static struct i40iw_puda_buf *i40iw_form_cm_frame(struct i40iw_cm_node *cm_node,ether_addr_copy (ethh->h_source, cm_node->loc_mac);if (cm_node->vlan_id <VLAN_TAG_PRESENT ) { ((struct vlan_ethhdr *)ethh)->h_vlan_proto =htons (ETH_P_8021Q ); - ((struct vlan_ethhdr *)ethh)->h_vlan_TCI =htons (cm_node->vlan_id); + vtag = (cm_node->user_pri <<VLAN_PRIO_SHIFT ) | cm_node->vlan_id; + ((struct vlan_ethhdr *)ethh)->h_vlan_TCI =htons (vtag); ((struct vlan_ethhdr *)ethh)->h_vlan_encapsulated_proto =htons (ETH_P_IP ); }else {
@@ -474,7 +477,8 @@ static struct i40iw_puda_buf *i40iw_form_cm_frame(struct i40iw_cm_node *cm_node,ether_addr_copy (ethh->h_source, cm_node->loc_mac);if (cm_node->vlan_id <VLAN_TAG_PRESENT ) { ((struct vlan_ethhdr *)ethh)->h_vlan_proto =htons (ETH_P_8021Q ); - ((struct vlan_ethhdr *)ethh)->h_vlan_TCI =htons (cm_node->vlan_id); + vtag = (cm_node->user_pri <<VLAN_PRIO_SHIFT ) | cm_node->vlan_id; + ((struct vlan_ethhdr *)ethh)->h_vlan_TCI =htons (vtag); ((struct vlan_ethhdr *)ethh)->h_vlan_encapsulated_proto =htons (ETH_P_IPV6 ); }else { ethh->h_proto =htons (ETH_P_IPV6 );
@@ -1880,6 +1884,7 @@ static int i40iw_dec_refcnt_listen(struct i40iw_cm_core *cm_core, nfo.loc_port = listener->loc_port; nfo.ipv4 = listener->ipv4; nfo.vlan_id = listener->vlan_id; + nfo.user_pri = listener->user_pri;if (!list_empty (&listener->child_listen_list)) {i40iw_del_multiple_qhash (listener->iwdev, &nfo, listener);
@@ -2138,6 +2143,11 @@ static struct i40iw_cm_node *i40iw_make_cm_node(/* set our node specific transport info */ cm_node->ipv4 = cm_info->ipv4; cm_node->vlan_id = cm_info->vlan_id; +if ((cm_node->vlan_id ==I40IW_NO_VLAN ) && iwdev->dcb) + cm_node->vlan_id =0 ; + cm_node->user_pri = cm_info->user_pri; +if (listener) + cm_node->user_pri = listener->user_pri;memcpy (cm_node->loc_addr, cm_info->loc_addr,sizeof (cm_node->loc_addr));memcpy (cm_node->rem_addr, cm_info->rem_addr,sizeof (cm_node->rem_addr)); cm_node->loc_port = cm_info->loc_port;
@@ -3055,6 +3065,7 @@ void i40iw_receive_ilq(struct i40iw_sc_dev *dev, struct i40iw_puda_buf *rbuf)struct i40iw_device *iwdev = (struct i40iw_device *)dev->back_dev;struct i40iw_cm_core *cm_core = &iwdev->cm_core;struct vlan_ethhdr *ethh; +u16 vtag;/* if vlan, then maclen = 18 else 14 */ iph = (struct iphdr *)rbuf->iph;
@@ -3068,7 +3079,9 @@ void i40iw_receive_ilq(struct i40iw_sc_dev *dev, struct i40iw_puda_buf *rbuf) ethh = (struct vlan_ethhdr *)rbuf->mem.va;if (ethh->h_vlan_proto ==htons (ETH_P_8021Q )) { - cm_info.vlan_id =ntohs (ethh->h_vlan_TCI) &VLAN_VID_MASK ; + vtag =ntohs (ethh->h_vlan_TCI); + cm_info.user_pri = (vtag &VLAN_PRIO_MASK ) >>VLAN_PRIO_SHIFT ; + cm_info.vlan_id = vtag &VLAN_VID_MASK ; i40iw_debug(cm_core->dev, I40IW_DEBUG_CM, "%s vlan_id=%d\n",
@@ -3309,6 +3322,8 @@ static void i40iw_cm_init_tsa_conn(struct i40iw_qp *iwqp, ctx_info->tcp_info_valid = true; ctx_info->iwarp_info_valid = true; + ctx_info->add_to_qoslist = true; + ctx_info->user_pri = cm_node->user_pri;i40iw_init_tcp_ctx (cm_node, &tcp_info, iwqp);if (cm_node->snd_mark_en) {
@@ -3326,6 +3341,7 @@ static void i40iw_cm_init_tsa_conn(struct i40iw_qp *iwqp,/* once tcp_info is set, no need to do it again */ ctx_info->tcp_info_valid = false; ctx_info->iwarp_info_valid = false; + ctx_info->add_to_qoslist = false; }/**
@@ -3779,6 +3795,9 @@ int i40iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)i40iw_netdev_vlan_ipv6 (cm_info.loc_addr, &cm_info.vlan_id,NULL ); } cm_info.cm_id = cm_id; + cm_info.user_pri =rt_tos2priority (cm_id->tos); +i40iw_debug (&iwdev->sc_dev,I40IW_DEBUG_DCB ,"%s TOS:[%d] UP:[%d]\n" , + __func__, cm_id->tos, cm_info.user_pri); if ((cm_info.ipv4 && (laddr->sin_addr.s_addr != raddr->sin_addr.s_addr)) || (!cm_info.ipv4 && memcmp(laddr6->sin6_addr.in6_u.u6_addr32, raddr6->sin6_addr.in6_u.u6_addr32,
@@ -3924,6 +3943,11 @@ int i40iw_create_listen(struct iw_cm_id *cm_id, int backlog) cm_id->provider_data = cm_listen_node; + cm_listen_node->user_pri =rt_tos2priority (cm_id->tos); + cm_info.user_pri = cm_listen_node->user_pri; +i40iw_debug (&iwdev->sc_dev,I40IW_DEBUG_DCB ,"%s TOS:[%d] UP:[%d]\n" , + __func__, cm_id->tos, cm_listen_node->user_pri); +if (!cm_listen_node->reused_node) {if (wildcard) {if (cm_info.ipv4)
drivers/infiniband/hw/i40iw/i40iw_cm.h +1 -1
@@ -368,7 +368,7 @@ struct i40iw_cm_info {u32 rem_addr[4 ];u16 vlan_id;int backlog; -u16 user_pri; +u8 user_pri;bool ipv4; };
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +146 -5
205 lines not on this page · raw message
drivers/infiniband/hw/i40iw/i40iw_d.h +2 -0
@@ -74,6 +74,8 @@#define RS_32_1 (val, bits) (u32)(val >> bits)#define I40E_HI_DWORD (x) ((u32)((((x) >> 16) >> 16) & 0xFFFFFFFF)) +#define QS_HANDLE_UNKNOWN 0xffff +#define LS_64 (val, field) (((u64)val << field ## _SHIFT) & (field ## _MASK))#define RS_64 (val, field) ((u64)(val & field ## _MASK) >> field ## _SHIFT)
drivers/infiniband/hw/i40iw/i40iw_hw.c +14 -11
@@ -358,6 +358,9 @@ void i40iw_process_aeq(struct i40iw_device *iwdev)continue ;i40iw_cm_disconn (iwqp);break ; +case I40IW_AE_QP_SUSPEND_COMPLETE : +i40iw_qp_suspend_resume (dev, &iwqp->sc_qp, false); +break ;case I40IW_AE_TERMINATE_SENT :i40iw_terminate_send_fin (qp);break ;
@@ -403,19 +406,18 @@ void i40iw_process_aeq(struct i40iw_device *iwdev)case I40IW_AE_LCE_CQ_CATASTROPHIC :case I40IW_AE_UDA_XMIT_DGRAM_TOO_LONG :case I40IW_AE_UDA_XMIT_IPADDR_MISMATCH : -case I40IW_AE_QP_SUSPEND_COMPLETE : ctx_info->err_rq_idx_valid = false;default : -if (!info->sq && ctx_info->err_rq_idx_valid) { - ctx_info->err_rq_idx = info->wqe_idx; - ctx_info->tcp_info_valid = false; - ctx_info->iwarp_info_valid = false; - ret = dev->iw_priv_qp_ops->qp_setctx (&iwqp->sc_qp, - iwqp->host_ctx.va, - ctx_info); - } -i40iw_terminate_connection (qp, info); -break ; +if (!info->sq && ctx_info->err_rq_idx_valid) { + ctx_info->err_rq_idx = info->wqe_idx; + ctx_info->tcp_info_valid = false; + ctx_info->iwarp_info_valid = false; + ret = dev->iw_priv_qp_ops->qp_setctx (&iwqp->sc_qp, + iwqp->host_ctx.va, + ctx_info); + } +i40iw_terminate_connection (qp, info); +break ; }if (info->qp)i40iw_rem_ref (&iwqp->ibqp);
@@ -559,6 +561,7 @@ enum i40iw_status_code i40iw_manage_qhash(struct i40iw_device *iwdev, } info->ipv4_valid = cminfo->ipv4; + info->user_pri = cminfo->user_pri;ether_addr_copy (info->mac_addr, iwdev->netdev->dev_addr); info->qp_num =cpu_to_le32 (dev->ilq->qp_id); info->dest_port =cpu_to_le16 (cminfo->loc_port);
drivers/infiniband/hw/i40iw/i40iw_main.c +58 -8
122 lines not on this page · raw message
drivers/infiniband/hw/i40iw/i40iw_osdep.h +2 -0
@@ -198,6 +198,8 @@ enum i40iw_status_code i40iw_cqp_manage_vf_pble_bp(struct i40iw_sc_dev *dev,void i40iw_cqp_spawn_worker (struct i40iw_sc_dev *dev,struct i40iw_virtchnl_work_info *work_info,u32 iw_vf_idx);void *i40iw_remove_head (struct list_head *list); +void i40iw_qp_suspend_resume (struct i40iw_sc_dev *dev,struct i40iw_sc_qp *qp,bool suspend); +void i40iw_qp_mss_modify (struct i40iw_sc_dev *dev,struct i40iw_sc_qp *qp);void i40iw_term_modify_qp (struct i40iw_sc_qp *qp,u8 next_state,u8 term,u8 term_len);void i40iw_terminate_done (struct i40iw_sc_qp *qp,int timeout_occurred);
drivers/infiniband/hw/i40iw/i40iw_p.h +2 -0
@@ -65,6 +65,8 @@ enum i40iw_status_code i40iw_pf_init_vfhmc(struct i40iw_sc_dev *dev, u8 vf_hmc_f u32 *vf_cnt_array);/* cqp misc functions */ +void i40iw_change_l2params (struct i40iw_sc_dev *dev,struct i40iw_l2params *l2params); +void i40iw_qp_add_qos (struct i40iw_sc_dev *dev,struct i40iw_sc_qp *qp);void i40iw_terminate_send_fin (struct i40iw_sc_qp *qp);
drivers/infiniband/hw/i40iw/i40iw_puda.c +2 -1
@@ -608,7 +608,8 @@ static enum i40iw_status_code i40iw_puda_qp_create(struct i40iw_puda_rsrc *rsrc) ukqp->wqe_alloc_reg = (u32 __iomem *)(i40iw_get_hw_addr (qp->pd->dev) +I40E_VFPE_WQEALLOC1 ); - qp->qs_handle = qp->dev->qs_handle; + qp->user_pri =0 ; +i40iw_qp_add_qos (rsrc->dev, qp);i40iw_puda_qp_setctx (rsrc); ret =i40iw_puda_qp_wqe (rsrc);if (ret)
drivers/infiniband/hw/i40iw/i40iw_type.h +15 -3
@@ -397,6 +397,9 @@ struct i40iw_sc_qp {bool virtual_map;bool flush_sq;bool flush_rq; +u8 user_pri; +struct list_head list; +bool on_qoslist;bool sq_flush;enum i40iw_flush_opcode flush_code;enum i40iw_term_eventtypes eventtype;
@@ -424,6 +427,12 @@ struct i40iw_vchnl_vf_msg_buffer {char parm_buffer[I40IW_VCHNL_MAX_VF_MSG_SIZE -1 ]; }; +struct i40iw_qos { +struct list_head qplist; +spinlock_t lock;/* qos list */ +u16 qs_handle; +}; +struct i40iw_vfdev {struct i40iw_sc_dev *pf_dev;u8 *hmc_info_mem;
@@ -482,7 +491,8 @@ struct i40iw_sc_dev {const struct i40iw_vf_cqp_ops *iw_vf_cqp_ops;struct i40iw_hmc_fpm_misc hmc_fpm_misc; -u16 qs_handle; +struct i40iw_qos qos[I40IW_MAX_USER_PRIORITY ]; +u16 mss;u32 debug_mask;u16 exception_lan_queue;u8 hmc_fn_id;
@@ -564,7 +574,7 @@ struct i40iw_device_init_info {struct i40iw_hw *hw;void __iomem *bar0;enum i40iw_status_code (*vchnl_send)(struct i40iw_sc_dev *,u32 ,u8 *,u16 ); -u16 qs_handle; +struct i40iw_l2params l2params;u16 exception_lan_queue;u8 hmc_fn_id;bool is_pf;
@@ -722,6 +732,8 @@ struct i40iw_qp_host_ctx_info {bool iwarp_info_valid;bool err_rq_idx_valid;u16 err_rq_idx; +bool add_to_qoslist; +u8 user_pri; };struct i40iw_aeqe_info {
@@ -886,7 +898,7 @@ struct i40iw_qhash_table_info {bool ipv4_valid;u8 mac_addr[6 ];u16 vlan_id; -u16 qs_handle; +u8 user_pri;u32 qp_num;u32 dest_ip[4 ];u32 src_ip[4 ];
drivers/infiniband/hw/i40iw/i40iw_utils.c +45 -0
51 lines not on this page · raw message
drivers/infiniband/hw/i40iw/i40iw_verbs.c +2 -4
@@ -254,7 +254,6 @@ static void i40iw_alloc_push_page(struct i40iw_device *iwdev, struct i40iw_sc_qp {struct i40iw_cqp_request *cqp_request;struct cqp_commands_info *cqp_info; -struct i40iw_sc_dev *dev = &iwdev->sc_dev;enum i40iw_status_code status;if (qp->push_idx !=I40IW_INVALID_PUSH_PAGE_INDEX )
@@ -270,7 +269,7 @@ static void i40iw_alloc_push_page(struct i40iw_device *iwdev, struct i40iw_sc_qp cqp_info->cqp_cmd =OP_MANAGE_PUSH_PAGE ; cqp_info->post_sq =1 ; - cqp_info->in.u.manage_push_page.info.qs_handle = dev->qs_handle; + cqp_info->in.u.manage_push_page.info.qs_handle = qp->qs_handle; cqp_info->in.u.manage_push_page.info.free_page =0 ; cqp_info->in.u.manage_push_page.cqp = &iwdev->cqp.sc_cqp; cqp_info->in.u.manage_push_page.scratch = (uintptr_t )cqp_request;
@@ -292,7 +291,6 @@ static void i40iw_dealloc_push_page(struct i40iw_device *iwdev, struct i40iw_sc_ {struct i40iw_cqp_request *cqp_request;struct cqp_commands_info *cqp_info; -struct i40iw_sc_dev *dev = &iwdev->sc_dev;enum i40iw_status_code status;if (qp->push_idx ==I40IW_INVALID_PUSH_PAGE_INDEX )
@@ -307,7 +305,7 @@ static void i40iw_dealloc_push_page(struct i40iw_device *iwdev, struct i40iw_sc_ cqp_info->post_sq =1 ; cqp_info->in.u.manage_push_page.info.push_idx = qp->push_idx; - cqp_info->in.u.manage_push_page.info.qs_handle = dev->qs_handle; + cqp_info->in.u.manage_push_page.info.qs_handle = qp->qs_handle; cqp_info->in.u.manage_push_page.info.free_page =1 ; cqp_info->in.u.manage_push_page.cqp = &iwdev->cqp.sc_cqp; cqp_info->in.u.manage_push_page.scratch = (uintptr_t )cqp_request;
Signature · 6 lines
2.8.3 -- 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
Doug Ledford
AppliedQuoted 8 lines · Henry Orosco
Add support for QoS on QPs. Upon device initialization, a map is created from user priority to queue set handles. On QP creation, use ToS to look up the queue set handle for use with the QP.
Signed-off-by Faisal Latif <[email protected]>Signed-off-by Shiraz Saleem <[email protected]>Signed-off-by Henry Orosco <[email protected]>
Thanks, applied.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD