Skip to content

Commit 348048e

Browse files
dmertmananguy11
authored andcommitted
ice: Implement iidc operations
Add implementations for supporting iidc operations for device operation such as allocation of resources and event notifications. Signed-off-by: Dave Ertman <[email protected]> Signed-off-by: Shiraz Saleem <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent d25a0fc commit 348048e

File tree

13 files changed

+639
-24
lines changed

13 files changed

+639
-24
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include "ice_switch.h"
5656
#include "ice_common.h"
5757
#include "ice_sched.h"
58+
#include "ice_idc_int.h"
5859
#include "ice_virtchnl_pf.h"
5960
#include "ice_sriov.h"
6061
#include "ice_fdir.h"
@@ -206,9 +207,9 @@ enum ice_pf_state {
206207
ICE_NEEDS_RESTART,
207208
ICE_PREPARED_FOR_RESET, /* set by driver when prepared */
208209
ICE_RESET_OICR_RECV, /* set by driver after rcv reset OICR */
209-
ICE_PFR_REQ, /* set by driver and peers */
210-
ICE_CORER_REQ, /* set by driver and peers */
211-
ICE_GLOBR_REQ, /* set by driver and peers */
210+
ICE_PFR_REQ, /* set by driver */
211+
ICE_CORER_REQ, /* set by driver */
212+
ICE_GLOBR_REQ, /* set by driver */
212213
ICE_CORER_RECV, /* set by OICR handler */
213214
ICE_GLOBR_RECV, /* set by OICR handler */
214215
ICE_EMPR_RECV, /* set by OICR handler */
@@ -335,6 +336,7 @@ struct ice_vsi {
335336
u16 req_rxq; /* User requested Rx queues */
336337
u16 num_rx_desc;
337338
u16 num_tx_desc;
339+
u16 qset_handle[ICE_MAX_TRAFFIC_CLASS];
338340
struct ice_tc_cfg tc_cfg;
339341
struct bpf_prog *xdp_prog;
340342
struct ice_ring **xdp_rings; /* XDP ring array */

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,36 @@ struct ice_aqc_dis_txq_item {
16851685
__le16 q_id[];
16861686
} __packed;
16871687

1688+
/* Add Tx RDMA Queue Set (indirect 0x0C33) */
1689+
struct ice_aqc_add_rdma_qset {
1690+
u8 num_qset_grps;
1691+
u8 reserved[7];
1692+
__le32 addr_high;
1693+
__le32 addr_low;
1694+
};
1695+
1696+
/* This is the descriptor of each Qset entry for the Add Tx RDMA Queue Set
1697+
* command (0x0C33). Only used within struct ice_aqc_add_rdma_qset.
1698+
*/
1699+
struct ice_aqc_add_tx_rdma_qset_entry {
1700+
__le16 tx_qset_id;
1701+
u8 rsvd[2];
1702+
__le32 qset_teid;
1703+
struct ice_aqc_txsched_elem info;
1704+
};
1705+
1706+
/* The format of the command buffer for Add Tx RDMA Queue Set(0x0C33)
1707+
* is an array of the following structs. Please note that the length of
1708+
* each struct ice_aqc_add_rdma_qset is variable due to the variable
1709+
* number of queues in each group!
1710+
*/
1711+
struct ice_aqc_add_rdma_qset_data {
1712+
__le32 parent_teid;
1713+
__le16 num_qsets;
1714+
u8 rsvd[2];
1715+
struct ice_aqc_add_tx_rdma_qset_entry rdma_qsets[];
1716+
};
1717+
16881718
/* Configure Firmware Logging Command (indirect 0xFF09)
16891719
* Logging Information Read Response (indirect 0xFF10)
16901720
* Note: The 0xFF10 command has no input parameters.
@@ -1881,6 +1911,7 @@ struct ice_aq_desc {
18811911
struct ice_aqc_get_set_rss_key get_set_rss_key;
18821912
struct ice_aqc_add_txqs add_txqs;
18831913
struct ice_aqc_dis_txqs dis_txqs;
1914+
struct ice_aqc_add_rdma_qset add_rdma_qset;
18841915
struct ice_aqc_add_get_update_free_vsi vsi_cmd;
18851916
struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res;
18861917
struct ice_aqc_fw_logging fw_logging;
@@ -2029,6 +2060,7 @@ enum ice_adminq_opc {
20292060
/* Tx queue handling commands/events */
20302061
ice_aqc_opc_add_txqs = 0x0C30,
20312062
ice_aqc_opc_dis_txqs = 0x0C31,
2063+
ice_aqc_opc_add_rdma_qset = 0x0C33,
20322064

20332065
/* package commands */
20342066
ice_aqc_opc_download_pkg = 0x0C40,

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* Copyright (c) 2018, Intel Corporation. */
33

44
#include "ice_common.h"
5+
#include "ice_lib.h"
56
#include "ice_sched.h"
67
#include "ice_adminq_cmd.h"
78
#include "ice_flow.h"
@@ -3650,6 +3651,52 @@ ice_aq_dis_lan_txq(struct ice_hw *hw, u8 num_qgrps,
36503651
return status;
36513652
}
36523653

3654+
/**
3655+
* ice_aq_add_rdma_qsets
3656+
* @hw: pointer to the hardware structure
3657+
* @num_qset_grps: Number of RDMA Qset groups
3658+
* @qset_list: list of Qset groups to be added
3659+
* @buf_size: size of buffer for indirect command
3660+
* @cd: pointer to command details structure or NULL
3661+
*
3662+
* Add Tx RDMA Qsets (0x0C33)
3663+
*/
3664+
static int
3665+
ice_aq_add_rdma_qsets(struct ice_hw *hw, u8 num_qset_grps,
3666+
struct ice_aqc_add_rdma_qset_data *qset_list,
3667+
u16 buf_size, struct ice_sq_cd *cd)
3668+
{
3669+
struct ice_aqc_add_rdma_qset_data *list;
3670+
struct ice_aqc_add_rdma_qset *cmd;
3671+
struct ice_aq_desc desc;
3672+
u16 i, sum_size = 0;
3673+
3674+
cmd = &desc.params.add_rdma_qset;
3675+
3676+
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_add_rdma_qset);
3677+
3678+
if (num_qset_grps > ICE_LAN_TXQ_MAX_QGRPS)
3679+
return -EINVAL;
3680+
3681+
for (i = 0, list = qset_list; i < num_qset_grps; i++) {
3682+
u16 num_qsets = le16_to_cpu(list->num_qsets);
3683+
3684+
sum_size += struct_size(list, rdma_qsets, num_qsets);
3685+
list = (struct ice_aqc_add_rdma_qset_data *)(list->rdma_qsets +
3686+
num_qsets);
3687+
}
3688+
3689+
if (buf_size != sum_size)
3690+
return -EINVAL;
3691+
3692+
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
3693+
3694+
cmd->num_qset_grps = num_qset_grps;
3695+
3696+
return ice_status_to_errno(ice_aq_send_cmd(hw, &desc, qset_list,
3697+
buf_size, cd));
3698+
}
3699+
36533700
/* End of FW Admin Queue command wrappers */
36543701

36553702
/**
@@ -4147,6 +4194,162 @@ ice_cfg_vsi_lan(struct ice_port_info *pi, u16 vsi_handle, u8 tc_bitmap,
41474194
ICE_SCHED_NODE_OWNER_LAN);
41484195
}
41494196

4197+
/**
4198+
* ice_cfg_vsi_rdma - configure the VSI RDMA queues
4199+
* @pi: port information structure
4200+
* @vsi_handle: software VSI handle
4201+
* @tc_bitmap: TC bitmap
4202+
* @max_rdmaqs: max RDMA queues array per TC
4203+
*
4204+
* This function adds/updates the VSI RDMA queues per TC.
4205+
*/
4206+
int
4207+
ice_cfg_vsi_rdma(struct ice_port_info *pi, u16 vsi_handle, u16 tc_bitmap,
4208+
u16 *max_rdmaqs)
4209+
{
4210+
return ice_status_to_errno(ice_cfg_vsi_qs(pi, vsi_handle, tc_bitmap,
4211+
max_rdmaqs,
4212+
ICE_SCHED_NODE_OWNER_RDMA));
4213+
}
4214+
4215+
/**
4216+
* ice_ena_vsi_rdma_qset
4217+
* @pi: port information structure
4218+
* @vsi_handle: software VSI handle
4219+
* @tc: TC number
4220+
* @rdma_qset: pointer to RDMA Qset
4221+
* @num_qsets: number of RDMA Qsets
4222+
* @qset_teid: pointer to Qset node TEIDs
4223+
*
4224+
* This function adds RDMA Qset
4225+
*/
4226+
int
4227+
ice_ena_vsi_rdma_qset(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
4228+
u16 *rdma_qset, u16 num_qsets, u32 *qset_teid)
4229+
{
4230+
struct ice_aqc_txsched_elem_data node = { 0 };
4231+
struct ice_aqc_add_rdma_qset_data *buf;
4232+
struct ice_sched_node *parent;
4233+
enum ice_status status;
4234+
struct ice_hw *hw;
4235+
u16 i, buf_size;
4236+
int ret;
4237+
4238+
if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
4239+
return -EIO;
4240+
hw = pi->hw;
4241+
4242+
if (!ice_is_vsi_valid(hw, vsi_handle))
4243+
return -EINVAL;
4244+
4245+
buf_size = struct_size(buf, rdma_qsets, num_qsets);
4246+
buf = kzalloc(buf_size, GFP_KERNEL);
4247+
if (!buf)
4248+
return -ENOMEM;
4249+
mutex_lock(&pi->sched_lock);
4250+
4251+
parent = ice_sched_get_free_qparent(pi, vsi_handle, tc,
4252+
ICE_SCHED_NODE_OWNER_RDMA);
4253+
if (!parent) {
4254+
ret = -EINVAL;
4255+
goto rdma_error_exit;
4256+
}
4257+
buf->parent_teid = parent->info.node_teid;
4258+
node.parent_teid = parent->info.node_teid;
4259+
4260+
buf->num_qsets = cpu_to_le16(num_qsets);
4261+
for (i = 0; i < num_qsets; i++) {
4262+
buf->rdma_qsets[i].tx_qset_id = cpu_to_le16(rdma_qset[i]);
4263+
buf->rdma_qsets[i].info.valid_sections =
4264+
ICE_AQC_ELEM_VALID_GENERIC | ICE_AQC_ELEM_VALID_CIR |
4265+
ICE_AQC_ELEM_VALID_EIR;
4266+
buf->rdma_qsets[i].info.generic = 0;
4267+
buf->rdma_qsets[i].info.cir_bw.bw_profile_idx =
4268+
cpu_to_le16(ICE_SCHED_DFLT_RL_PROF_ID);
4269+
buf->rdma_qsets[i].info.cir_bw.bw_alloc =
4270+
cpu_to_le16(ICE_SCHED_DFLT_BW_WT);
4271+
buf->rdma_qsets[i].info.eir_bw.bw_profile_idx =
4272+
cpu_to_le16(ICE_SCHED_DFLT_RL_PROF_ID);
4273+
buf->rdma_qsets[i].info.eir_bw.bw_alloc =
4274+
cpu_to_le16(ICE_SCHED_DFLT_BW_WT);
4275+
}
4276+
ret = ice_aq_add_rdma_qsets(hw, 1, buf, buf_size, NULL);
4277+
if (ret) {
4278+
ice_debug(hw, ICE_DBG_RDMA, "add RDMA qset failed\n");
4279+
goto rdma_error_exit;
4280+
}
4281+
node.data.elem_type = ICE_AQC_ELEM_TYPE_LEAF;
4282+
for (i = 0; i < num_qsets; i++) {
4283+
node.node_teid = buf->rdma_qsets[i].qset_teid;
4284+
status = ice_sched_add_node(pi, hw->num_tx_sched_layers - 1,
4285+
&node);
4286+
if (status) {
4287+
ret = ice_status_to_errno(status);
4288+
break;
4289+
}
4290+
qset_teid[i] = le32_to_cpu(node.node_teid);
4291+
}
4292+
rdma_error_exit:
4293+
mutex_unlock(&pi->sched_lock);
4294+
kfree(buf);
4295+
return ret;
4296+
}
4297+
4298+
/**
4299+
* ice_dis_vsi_rdma_qset - free RDMA resources
4300+
* @pi: port_info struct
4301+
* @count: number of RDMA Qsets to free
4302+
* @qset_teid: TEID of Qset node
4303+
* @q_id: list of queue IDs being disabled
4304+
*/
4305+
int
4306+
ice_dis_vsi_rdma_qset(struct ice_port_info *pi, u16 count, u32 *qset_teid,
4307+
u16 *q_id)
4308+
{
4309+
struct ice_aqc_dis_txq_item *qg_list;
4310+
enum ice_status status = 0;
4311+
struct ice_hw *hw;
4312+
u16 qg_size;
4313+
int i;
4314+
4315+
if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
4316+
return -EIO;
4317+
4318+
hw = pi->hw;
4319+
4320+
qg_size = struct_size(qg_list, q_id, 1);
4321+
qg_list = kzalloc(qg_size, GFP_KERNEL);
4322+
if (!qg_list)
4323+
return -ENOMEM;
4324+
4325+
mutex_lock(&pi->sched_lock);
4326+
4327+
for (i = 0; i < count; i++) {
4328+
struct ice_sched_node *node;
4329+
4330+
node = ice_sched_find_node_by_teid(pi->root, qset_teid[i]);
4331+
if (!node)
4332+
continue;
4333+
4334+
qg_list->parent_teid = node->info.parent_teid;
4335+
qg_list->num_qs = 1;
4336+
qg_list->q_id[0] =
4337+
cpu_to_le16(q_id[i] |
4338+
ICE_AQC_Q_DIS_BUF_ELEM_TYPE_RDMA_QSET);
4339+
4340+
status = ice_aq_dis_lan_txq(hw, 1, qg_list, qg_size,
4341+
ICE_NO_RESET, 0, NULL);
4342+
if (status)
4343+
break;
4344+
4345+
ice_free_sched_node(pi, node);
4346+
}
4347+
4348+
mutex_unlock(&pi->sched_lock);
4349+
kfree(qg_list);
4350+
return ice_status_to_errno(status);
4351+
}
4352+
41504353
/**
41514354
* ice_replay_pre_init - replay pre initialization
41524355
* @hw: pointer to the HW struct

drivers/net/ethernet/intel/ice/ice_common.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr,
147147
u16 mem_addr, u8 page, u8 set_page, u8 *data, u8 length,
148148
bool write, struct ice_sq_cd *cd);
149149

150+
int
151+
ice_cfg_vsi_rdma(struct ice_port_info *pi, u16 vsi_handle, u16 tc_bitmap,
152+
u16 *max_rdmaqs);
153+
int
154+
ice_ena_vsi_rdma_qset(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
155+
u16 *rdma_qset, u16 num_qsets, u32 *qset_teid);
156+
int
157+
ice_dis_vsi_rdma_qset(struct ice_port_info *pi, u16 count, u32 *qset_teid,
158+
u16 *q_id);
150159
enum ice_status
151160
ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
152161
u16 *q_handle, u16 *q_ids, u32 *q_teids,

drivers/net/ethernet/intel/ice/ice_dcb_lib.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)
275275
struct ice_dcbx_cfg *old_cfg, *curr_cfg;
276276
struct device *dev = ice_pf_to_dev(pf);
277277
int ret = ICE_DCB_NO_HW_CHG;
278+
struct iidc_event *event;
278279
struct ice_vsi *pf_vsi;
279280

280281
curr_cfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg;
@@ -313,6 +314,15 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)
313314
goto free_cfg;
314315
}
315316

317+
/* Notify AUX drivers about impending change to TCs */
318+
event = kzalloc(sizeof(*event), GFP_KERNEL);
319+
if (!event)
320+
return -ENOMEM;
321+
322+
set_bit(IIDC_EVENT_BEFORE_TC_CHANGE, event->type);
323+
ice_send_event_to_aux(pf, event);
324+
kfree(event);
325+
316326
/* avoid race conditions by holding the lock while disabling and
317327
* re-enabling the VSI
318328
*/
@@ -640,6 +650,7 @@ static int ice_dcb_noncontig_cfg(struct ice_pf *pf)
640650
void ice_pf_dcb_recfg(struct ice_pf *pf)
641651
{
642652
struct ice_dcbx_cfg *dcbcfg = &pf->hw.port_info->qos_cfg.local_dcbx_cfg;
653+
struct iidc_event *event;
643654
u8 tc_map = 0;
644655
int v, ret;
645656

@@ -675,6 +686,14 @@ void ice_pf_dcb_recfg(struct ice_pf *pf)
675686
if (vsi->type == ICE_VSI_PF)
676687
ice_dcbnl_set_all(vsi);
677688
}
689+
/* Notify the AUX drivers that TC change is finished */
690+
event = kzalloc(sizeof(*event), GFP_KERNEL);
691+
if (!event)
692+
return;
693+
694+
set_bit(IIDC_EVENT_AFTER_TC_CHANGE, event->type);
695+
ice_send_event_to_aux(pf, event);
696+
kfree(event);
678697
}
679698

680699
/**

drivers/net/ethernet/intel/ice/ice_hw_autogen.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@
110110
#define VPGEN_VFRSTAT_VFRD_M BIT(0)
111111
#define VPGEN_VFRTRIG(_VF) (0x00090000 + ((_VF) * 4))
112112
#define VPGEN_VFRTRIG_VFSWR_M BIT(0)
113-
#define PFHMC_ERRORDATA 0x00520500
114-
#define PFHMC_ERRORINFO 0x00520400
115113
#define GLINT_CTL 0x0016CC54
116114
#define GLINT_CTL_DIS_AUTOMASK_M BIT(0)
117115
#define GLINT_CTL_ITR_GRAN_200_S 16
@@ -160,6 +158,7 @@
160158
#define PFINT_OICR_GRST_M BIT(20)
161159
#define PFINT_OICR_PCI_EXCEPTION_M BIT(21)
162160
#define PFINT_OICR_HMC_ERR_M BIT(26)
161+
#define PFINT_OICR_PE_PUSH_M BIT(27)
163162
#define PFINT_OICR_PE_CRITERR_M BIT(28)
164163
#define PFINT_OICR_VFLR_M BIT(29)
165164
#define PFINT_OICR_SWINT_M BIT(31)

0 commit comments

Comments
 (0)