dev = ice_pf_to_dev(pf); if (vsi->type == ICE_VSI_CHNL) return0;
/* allocate memory for both Tx and Rx ring pointers */
vsi->tx_rings = devm_kcalloc(dev, vsi->alloc_txq, sizeof(*vsi->tx_rings), GFP_KERNEL); if (!vsi->tx_rings) return -ENOMEM;
vsi->rx_rings = devm_kcalloc(dev, vsi->alloc_rxq, sizeof(*vsi->rx_rings), GFP_KERNEL); if (!vsi->rx_rings) goto err_rings;
/* txq_map needs to have enough space to track both Tx (stack) rings *andXDPrings;atthispointvsi->num_xdp_txqmightnotbeset, *sousenum_possible_cpus()aswewanttoalwaysprovideXDPring *perCPU,regardlessofqueuecountsettingsfromuserthatmight *havecomefromethtool'sset_channels()callback;
*/
vsi->txq_map = devm_kcalloc(dev, (vsi->alloc_txq + num_possible_cpus()), sizeof(*vsi->txq_map), GFP_KERNEL);
if (!vsi->txq_map) goto err_txq_map;
vsi->rxq_map = devm_kcalloc(dev, vsi->alloc_rxq, sizeof(*vsi->rxq_map), GFP_KERNEL); if (!vsi->rxq_map) goto err_rxq_map;
/* There is no need to allocate q_vectors for a loopback VSI. */ if (vsi->type == ICE_VSI_LB) return0;
/* allocate memory for q_vector pointers */
vsi->q_vectors = devm_kcalloc(dev, vsi->num_q_vectors, sizeof(*vsi->q_vectors), GFP_KERNEL); if (!vsi->q_vectors) goto err_vectors;
/** *ice_vsi_set_num_desc-SetnumberofdescriptorsforqueuesonthisVSI *@vsi:theVSIbeingconfigured
*/ staticvoid ice_vsi_set_num_desc(struct ice_vsi *vsi)
{ switch (vsi->type) { case ICE_VSI_PF: case ICE_VSI_SF: case ICE_VSI_CTRL: case ICE_VSI_LB: /* a user could change the values of num_[tr]x_desc using *ethtool-Gsoweshouldkeepthosevaluesinsteadof *overwritingthemwiththedefaults.
*/ if (!vsi->num_rx_desc)
vsi->num_rx_desc = ICE_DFLT_NUM_RX_DESC; if (!vsi->num_tx_desc)
vsi->num_tx_desc = ICE_DFLT_NUM_TX_DESC; break; default:
dev_dbg(ice_pf_to_dev(vsi->back), "Not setting number of Tx/Rx descriptors for VSI type %d\n",
vsi->type); break;
}
}
status = ice_free_vsi(&pf->hw, vsi->idx, ctxt, false, NULL); if (status)
dev_err(ice_pf_to_dev(pf), "Failed to delete VSI %i in FW - error: %d\n",
vsi->vsi_num, status);
switch (vsi->type) { case ICE_VSI_PF: case ICE_VSI_SF: /* Setup default MSIX irq handler for VSI */
vsi->irq_handler = ice_msix_clean_rings; break; case ICE_VSI_CTRL: /* Setup ctrl VSI MSIX irq handler */
vsi->irq_handler = ice_msix_clean_ctrl_vsi; break; case ICE_VSI_CHNL: if (!ch) return -EINVAL;
vsi->num_rxq = ch->num_rxq;
vsi->num_txq = ch->num_txq;
vsi->next_base_q = ch->base_q; break; case ICE_VSI_VF: case ICE_VSI_LB: break; default:
ice_vsi_free_arrays(vsi); return -EINVAL;
}
/* Need to protect the allocation of the VSIs at the PF level */
mutex_lock(&pf->sw_mutex);
/* If we have already allocated our maximum number of VSIs, *pf->next_vsiwillbeICE_NO_VSI.Ifnot,pf->next_vsiindex *isavailabletobepopulated
*/ if (pf->next_vsi == ICE_NO_VSI) {
dev_dbg(dev, "out of VSI slots!\n"); goto unlock_pf;
}
vsi = devm_kzalloc(dev, sizeof(*vsi), GFP_KERNEL); if (!vsi) goto unlock_pf;
/* Flow Director filters are only allocated/assigned to the PF VSI or *CHNLVSIwhichpassesthetraffic.TheCTRLVSIisonlyusedto *add/deletefilterssoresourcesarenotallocatedtoit
*/ if (!test_bit(ICE_FLAG_FD_ENA, pf->flags)) return -EPERM;
/* FD filters from guaranteed pool per VSI */
g_val = pf->hw.func_caps.fd_fltr_guar; if (!g_val) return -EPERM;
/* FD filters from best effort pool */
b_val = pf->hw.func_caps.fd_fltr_best_effort; if (!b_val) return -EPERM;
/* PF main VSI gets only 64 FD resources from guaranteed pool *whenADQisconfigured.
*/ #define ICE_PF_VSI_GFLTR 64
/* determine FD filter resources per VSI from shared(best effort) and *dedicatedpool
*/ if (vsi->type == ICE_VSI_PF) {
vsi->num_gfltr = g_val; /* if MQPRIO is configured, main VSI doesn't get all FD *resourcesfromguaranteedpool.PFVSIgets64FDresources
*/ if (test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) { if (g_val < ICE_PF_VSI_GFLTR) return -EPERM; /* allow bare minimum entries for PF VSI */
vsi->num_gfltr = ICE_PF_VSI_GFLTR;
}
/* each VSI gets same "best_effort" quota */
vsi->num_bfltr = b_val;
} elseif (vsi->type == ICE_VSI_VF) {
vsi->num_gfltr = 0;
/* each VSI gets same "best_effort" quota */
vsi->num_bfltr = b_val;
} else { struct ice_vsi *main_vsi; int numtc;
main_vsi = ice_get_main_vsi(pf); if (!main_vsi) return -EPERM;
status = ice_rem_vsi_rss_cfg(&pf->hw, vsi->idx); if (status)
dev_dbg(ice_pf_to_dev(pf), "ice_rem_vsi_rss_cfg failed for vsi = %d, error = %d\n",
vsi->vsi_num, status);
}
memset(&ctxt->info, 0, sizeof(ctxt->info)); /* VSI's should be allocated from shared pool */
ctxt->alloc_from_pool = true; /* Src pruning enabled by default */
ctxt->info.sw_flags = ICE_AQ_VSI_SW_FLAG_SRC_PRUNE; /* Traffic from VSI can be sent to LAN */
ctxt->info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA; /* allow all untagged/tagged packets by default on Tx */
ctxt->info.inner_vlan_flags = FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M,
ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL); /* SVM - by default bits 3 and 4 in inner_vlan_flags are 0's which *resultsinlegacybehavior(showVLAN,DEI,andUP)indescriptor. * *DVM-leaveinnerVLANinpacketbydefault
*/ if (ice_is_dvm_ena(hw)) {
ctxt->info.inner_vlan_flags |=
FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M,
ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING);
ctxt->info.outer_vlan_flags =
FIELD_PREP(ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M,
ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL);
ctxt->info.outer_vlan_flags |=
FIELD_PREP(ICE_AQ_VSI_OUTER_TAG_TYPE_M,
ICE_AQ_VSI_OUTER_TAG_VLAN_8100);
ctxt->info.outer_vlan_flags |=
FIELD_PREP(ICE_AQ_VSI_OUTER_VLAN_EMODE_M,
ICE_AQ_VSI_OUTER_VLAN_EMODE_NOTHING);
} /* Have 1:1 UP mapping for both ingress/egress tables */
table |= ICE_UP_TABLE_TRANSLATE(0, 0);
table |= ICE_UP_TABLE_TRANSLATE(1, 1);
table |= ICE_UP_TABLE_TRANSLATE(2, 2);
table |= ICE_UP_TABLE_TRANSLATE(3, 3);
table |= ICE_UP_TABLE_TRANSLATE(4, 4);
table |= ICE_UP_TABLE_TRANSLATE(5, 5);
table |= ICE_UP_TABLE_TRANSLATE(6, 6);
table |= ICE_UP_TABLE_TRANSLATE(7, 7);
ctxt->info.ingress_table = cpu_to_le32(table);
ctxt->info.egress_table = cpu_to_le32(table); /* Have 1:1 UP mapping for outer to inner UP table */
ctxt->info.outer_up_table = cpu_to_le32(table); /* No Outer tag support outer_tag_flags remains to zero */
}
/* find the (rounded up) power-of-2 of qcount */
pow = (u16)order_base_2(num_rxq_per_tc);
/* TC mapping is a function of the number of Rx queues assigned to the *VSIforeachtrafficclassandtheoffsetofthesequeues. *Thefirst10bitsareforqueueoffsetforTC0,next4bitsforno:of *queuesallocatedtoTC0.No:ofqueuesisapower-of-2. * *IfTCisnotenabled,thequeueoffsetissetto0,andallocateone *queue,thisway,trafficforthegivenTCwillbesenttothedefault *queue. * *SetupnumberandoffsetofRxqueuesforallTCsfortheVSI
*/
ice_for_each_traffic_class(i) { if (!(vsi->tc_cfg.ena_tc & BIT(i))) { /* TC is not enabled */
vsi->tc_cfg.tc_info[i].qoffset = 0;
vsi->tc_cfg.tc_info[i].qcount_rx = 1;
vsi->tc_cfg.tc_info[i].qcount_tx = 1;
vsi->tc_cfg.tc_info[i].netdev_tc = 0;
ctxt->info.tc_mapping[i] = 0; continue;
}
/* if offset is non-zero, means it is calculated correctly based on *enabledTCsforagivenVSIotherwiseqcount_rxwillalways *becorrectandnon-zerobecauseitisbasedoff-VSI's *allocatedRxqueueswhichisatleast1(henceqcount_txwillbe *atleast1)
*/ if (offset)
rx_count = offset; else
rx_count = num_rxq_per_tc;
if (rx_count > vsi->alloc_rxq) {
dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n",
rx_count, vsi->alloc_rxq); return -EINVAL;
}
if (tx_count > vsi->alloc_txq) {
dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n",
tx_count, vsi->alloc_txq); return -EINVAL;
}
vsi->num_txq = tx_count;
vsi->num_rxq = rx_count;
if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) {
dev_dbg(ice_pf_to_dev(vsi->back), "VF VSI should have same number of Tx and Rx queues. Hence making them equal\n"); /* since there is a chance that num_rxq could have been changed *intheaboveforloop,makenum_txqequaltonum_rxq.
*/
vsi->num_txq = vsi->num_rxq;
}
/* Rx queue mapping */
ctxt->info.mapping_flags |= cpu_to_le16(ICE_AQ_VSI_Q_MAP_CONTIG); /* q_mapping buffer holds the info for the first queue allocated for *thisVSIinthePFspaceandalsothenumberofqueuesassociated *withthisVSI.
*/
ctxt->info.q_mapping[0] = cpu_to_le16(vsi->rxq_map[0]);
ctxt->info.q_mapping[1] = cpu_to_le16(vsi->num_rxq);
/* enable flow director filtering/programming */
val = ICE_AQ_VSI_FD_ENABLE | ICE_AQ_VSI_FD_PROG_ENABLE;
ctxt->info.fd_options = cpu_to_le16(val); /* max of allocated flow director filters */
ctxt->info.max_fd_fltr_dedicated =
cpu_to_le16(vsi->num_gfltr); /* max of shared flow director filters any VSI may program */
ctxt->info.max_fd_fltr_shared =
cpu_to_le16(vsi->num_bfltr); /* default queue index within the VSI of the default FD */
val = FIELD_PREP(ICE_AQ_VSI_FD_DEF_Q_M, dflt_q); /* target queue or queue group to the FD filter */
val |= FIELD_PREP(ICE_AQ_VSI_FD_DEF_GRP_M, dflt_q_group);
ctxt->info.fd_def_q = cpu_to_le16(val); /* queue index on which FD filter completion is reported */
val = FIELD_PREP(ICE_AQ_VSI_FD_REPORT_Q_M, report_q); /* priority of the default qindex action */
val |= FIELD_PREP(ICE_AQ_VSI_FD_DEF_PRIORITY_M, dflt_q_prio);
ctxt->info.fd_report_opt = cpu_to_le16(val);
}
switch (vsi->type) { case ICE_VSI_CHNL: case ICE_VSI_PF: /* PF VSI will inherit RSS instance of PF */
lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_PF; break; case ICE_VSI_VF: case ICE_VSI_SF: /* VF VSI will gets a small RSS table which is a VSI LUT type */
lut_type = ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI; break; default:
dev_dbg(dev, "Unsupported VSI type %s\n",
ice_vsi_type_str(vsi->type)); return;
}
dev = ice_pf_to_dev(pf);
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); if (!ctxt) return -ENOMEM;
switch (vsi->type) { case ICE_VSI_CTRL: case ICE_VSI_LB: case ICE_VSI_PF:
ctxt->flags = ICE_AQ_VSI_TYPE_PF; break; case ICE_VSI_SF: case ICE_VSI_CHNL:
ctxt->flags = ICE_AQ_VSI_TYPE_VMDQ2; break; case ICE_VSI_VF:
ctxt->flags = ICE_AQ_VSI_TYPE_VF; /* VF number here is the absolute VF number (0-255) */
ctxt->vf_num = vsi->vf->vf_id + hw->func_caps.vf_base_id; break; default:
ret = -ENODEV; goto out;
}
/* Handle VLAN pruning for channel VSI if main VSI has VLAN *pruneenabled
*/ if (vsi->type == ICE_VSI_CHNL) { struct ice_vsi *main_vsi;
ice_set_dflt_vsi_ctx(hw, ctxt); if (test_bit(ICE_FLAG_FD_ENA, pf->flags))
ice_set_fd_vsi_ctx(ctxt, vsi); /* if the switch is in VEB mode, allow VSI loopback */ if (vsi->vsw->bridge_mode == BRIDGE_MODE_VEB)
ctxt->info.sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB;
/* Set LUT type and HASH type if RSS is enabled */ if (test_bit(ICE_FLAG_RSS_ENA, pf->flags) &&
vsi->type != ICE_VSI_CTRL) {
ice_set_rss_vsi_ctx(ctxt, vsi); /* if updating VSI context, make sure to set valid_section: *toindicatewhichsectionofVSIcontextbeingupdated
*/ if (!(vsi_flags & ICE_VSI_FLAG_INIT))
ctxt->info.valid_sections |=
cpu_to_le16(ICE_AQ_VSI_PROP_Q_OPT_VALID);
}
ctxt->info.sw_id = vsi->port_info->sw_id; if (vsi->type == ICE_VSI_CHNL) {
ice_chnl_vsi_setup_q_map(vsi, ctxt);
} else {
ret = ice_vsi_setup_q_map(vsi, ctxt); if (ret) goto out;
if (!(vsi_flags & ICE_VSI_FLAG_INIT)) /* means VSI being updated */ /* must to indicate which section of VSI context are *beingmodified
*/
ctxt->info.valid_sections |=
cpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);
}
/* Allow control frames out of main VSI */ if (vsi->type == ICE_VSI_PF) {
ctxt->info.sec_flags |= ICE_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD;
ctxt->info.valid_sections |=
cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID);
}
if (vsi_flags & ICE_VSI_FLAG_INIT) {
ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL); if (ret) {
dev_err(dev, "Add VSI failed, err %d\n", ret);
ret = -EIO; goto out;
}
} else {
ret = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (ret) {
dev_err(dev, "Update VSI failed, err %d\n", ret);
ret = -EIO; goto out;
}
}
/* keep context for update VSI operations */
vsi->info = ctxt->info;
/* record VSI number returned */
vsi->vsi_num = ctxt->vsi_num;
/* Avoid stale references by clearing map from vector to ring */ if (vsi->q_vectors) {
ice_for_each_q_vector(vsi, i) { struct ice_q_vector *q_vector = vsi->q_vectors[i];
/* If orig_rss_size is valid and it is less than determined *mainVSI'srss_size,updatemainVSI'srss_sizetobe *orig_rss_sizesothatwhentc-qdiscisdeleted,mainVSI *RSStablegetsprogrammedtobecorrect(whateveritwas *tobeginwith(priortosetup-tcforADQconfig)
*/ if (vsi->orig_rss_size && vsi->rss_size < vsi->orig_rss_size &&
vsi->orig_rss_size <= vsi->num_rxq) {
vsi->rss_size = vsi->orig_rss_size; /* now orig_rss_size is used, reset it to zero */
vsi->orig_rss_size = 0;
}
}
lut = kzalloc(vsi->rss_table_size, GFP_KERNEL); if (!lut) return -ENOMEM;
if (vsi->rss_lut_user)
memcpy(lut, vsi->rss_lut_user, vsi->rss_table_size); else
ice_fill_rss_lut(lut, vsi->rss_table_size, vsi->rss_size);
dev = ice_pf_to_dev(pf); if (ice_is_safe_mode(pf)) {
dev_dbg(dev, "Advanced RSS disabled. Package download failed, vsi num = %d\n",
vsi->vsi_num); return;
}
status = ice_add_avf_rss_cfg(&pf->hw, vsi, ICE_DEFAULT_RSS_HASHCFG); if (status)
dev_dbg(dev, "ice_add_avf_rss_cfg failed for vsi = %d, error = %d\n",
vsi->vsi_num, status);
}
staticconststruct ice_rss_hash_cfg default_rss_cfgs[] = { /* configure RSS for IPv4 with input set IP src/dst */
{ICE_FLOW_SEG_HDR_IPV4, ICE_FLOW_HASH_IPV4, ICE_RSS_ANY_HEADERS, false}, /* configure RSS for IPv6 with input set IPv6 src/dst */
{ICE_FLOW_SEG_HDR_IPV6, ICE_FLOW_HASH_IPV6, ICE_RSS_ANY_HEADERS, false}, /* configure RSS for tcp4 with input set IP src/dst, TCP src/dst */
{ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4,
ICE_HASH_TCP_IPV4, ICE_RSS_ANY_HEADERS, false}, /* configure RSS for udp4 with input set IP src/dst, UDP src/dst */
{ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4,
ICE_HASH_UDP_IPV4, ICE_RSS_ANY_HEADERS, false}, /* configure RSS for sctp4 with input set IP src/dst - only support *RSSonSCTPv4onouterheaders(non-tunneled)
*/
{ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4,
ICE_HASH_SCTP_IPV4, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpc4 with input set IPv4 src/dst */
{ICE_FLOW_SEG_HDR_GTPC | ICE_FLOW_SEG_HDR_IPV4,
ICE_FLOW_HASH_IPV4, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpc4t with input set IPv4 src/dst */
{ICE_FLOW_SEG_HDR_GTPC_TEID | ICE_FLOW_SEG_HDR_IPV4,
ICE_FLOW_HASH_GTP_C_IPV4_TEID, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpu4 with input set IPv4 src/dst */
{ICE_FLOW_SEG_HDR_GTPU_IP | ICE_FLOW_SEG_HDR_IPV4,
ICE_FLOW_HASH_GTP_U_IPV4_TEID, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpu4e with input set IPv4 src/dst */
{ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV4,
ICE_FLOW_HASH_GTP_U_IPV4_EH, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpu4u with input set IPv4 src/dst */
{ ICE_FLOW_SEG_HDR_GTPU_UP | ICE_FLOW_SEG_HDR_IPV4,
ICE_FLOW_HASH_GTP_U_IPV4_UP, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpu4d with input set IPv4 src/dst */
{ICE_FLOW_SEG_HDR_GTPU_DWN | ICE_FLOW_SEG_HDR_IPV4,
ICE_FLOW_HASH_GTP_U_IPV4_DWN, ICE_RSS_OUTER_HEADERS, false},
/* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */
{ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6,
ICE_HASH_TCP_IPV6, ICE_RSS_ANY_HEADERS, false}, /* configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst */
{ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6,
ICE_HASH_UDP_IPV6, ICE_RSS_ANY_HEADERS, false}, /* configure RSS for sctp6 with input set IPv6 src/dst - only support *RSSonSCTPv6onouterheaders(non-tunneled)
*/
{ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6,
ICE_HASH_SCTP_IPV6, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for IPSEC ESP SPI with input set MAC_IPV4_SPI */
{ICE_FLOW_SEG_HDR_ESP,
ICE_FLOW_HASH_ESP_SPI, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpc6 with input set IPv6 src/dst */
{ICE_FLOW_SEG_HDR_GTPC | ICE_FLOW_SEG_HDR_IPV6,
ICE_FLOW_HASH_IPV6, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpc6t with input set IPv6 src/dst */
{ICE_FLOW_SEG_HDR_GTPC_TEID | ICE_FLOW_SEG_HDR_IPV6,
ICE_FLOW_HASH_GTP_C_IPV6_TEID, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpu6 with input set IPv6 src/dst */
{ICE_FLOW_SEG_HDR_GTPU_IP | ICE_FLOW_SEG_HDR_IPV6,
ICE_FLOW_HASH_GTP_U_IPV6_TEID, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpu6e with input set IPv6 src/dst */
{ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV6,
ICE_FLOW_HASH_GTP_U_IPV6_EH, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpu6u with input set IPv6 src/dst */
{ ICE_FLOW_SEG_HDR_GTPU_UP | ICE_FLOW_SEG_HDR_IPV6,
ICE_FLOW_HASH_GTP_U_IPV6_UP, ICE_RSS_OUTER_HEADERS, false}, /* configure RSS for gtpu6d with input set IPv6 src/dst */
{ICE_FLOW_SEG_HDR_GTPU_DWN | ICE_FLOW_SEG_HDR_IPV6,
ICE_FLOW_HASH_GTP_U_IPV6_DWN, ICE_RSS_OUTER_HEADERS, false},
};
dev = ice_pf_to_dev(pf); if (ice_is_safe_mode(pf)) {
dev_dbg(dev, "Advanced RSS disabled. Package download failed, vsi num = %d\n",
vsi_num); return;
} for (i = 0; i < ARRAY_SIZE(default_rss_cfgs); i++) { conststruct ice_rss_hash_cfg *cfg = &default_rss_cfgs[i];
q_vector = ice_pull_qvec_from_rc(rc); if (!q_vector) return;
__ice_write_itr(q_vector, rc, itr);
}
/** *ice_set_q_vector_intrl-setupinterruptratelimiting *@q_vector:thevectortobeconfigured * *Interruptratelimitingislocaltothevector,notper-queuesowemust *detectifeitherringcontainerhasdynamicmoderationenabledtodecide *whattosettheinterruptratelimittoviaINTRLsettings.Inthecasethat *dynamicmoderationisdisabledonboth,writethevaluewiththecached *settingtomakesureINTRLregistermatchestheuservisiblevalue.
*/ void ice_set_q_vector_intrl(struct ice_q_vector *q_vector)
{ if (ITR_IS_DYNAMIC(&q_vector->tx) || ITR_IS_DYNAMIC(&q_vector->rx)) { /* in the case of dynamic enabled, cap each vector to no more *than(4us)250,000ints/sec,whichallowslowlatency *butstilllessthan500,000interruptspersecond,which *reducesCPUabitinthecaseofthelowestlatency *setting.The4hereisavalueinmicroseconds.
*/
ice_write_intrl(q_vector, 4);
} else {
ice_write_intrl(q_vector, q_vector->intrl);
}
}
/* create (as needed) scheduler aggregator node and move VSI into *correspondingaggregatornode *-PFaggregatornodetocontainsVSIsoftype_PFand_CTRL *-VFaggregatornodeswillcontainVFVSI
*/
port_info = pf->hw.port_info; if (!port_info) return;
switch (vsi->type) { case ICE_VSI_CTRL: case ICE_VSI_CHNL: case ICE_VSI_LB: case ICE_VSI_PF: case ICE_VSI_SF:
max_agg_nodes = ICE_MAX_PF_AGG_NODES;
agg_node_id_start = ICE_PF_AGG_NODE_ID_START;
agg_node_iter = &pf->pf_agg_node[0]; break; case ICE_VSI_VF: /* user can create 'n' VFs on a given PF, but since max children *peraggregatornodecanbeonly64.Followingcodehandles *aggregator(s)forVFVSIs,eitherselectsaagg_nodewhich *wasalreadycreatedprovidednum_vsis<64,otherwise *selectnextavailablenode,whichwillbecreated
*/
max_agg_nodes = ICE_MAX_VF_AGG_NODES;
agg_node_id_start = ICE_VF_AGG_NODE_ID_START;
agg_node_iter = &pf->vf_agg_node[0]; break; default: /* other VSI type, handle later if needed */
dev_dbg(dev, "unexpected VSI type %s\n",
ice_vsi_type_str(vsi->type)); return;
}
/* find the appropriate aggregator node */ for (node_offset = 0; node_offset < max_agg_nodes; node_offset++) { /* see if we can find space in previously created *nodeifnum_vsis<64,otherwiseskip
*/ if (agg_node_iter->num_vsis &&
agg_node_iter->num_vsis == ICE_MAX_VSIS_IN_AGG_NODE) {
agg_node_iter++; continue;
}
/* find unclaimed agg_id */ if (agg_node_iter->agg_id == ICE_INVALID_AGG_NODE_ID) {
agg_id = node_offset + agg_node_id_start;
agg_node = agg_node_iter; break;
} /* move to next agg_node */
agg_node_iter++;
}
if (!agg_node) return;
/* if selected aggregator node was not created, create it */ if (!agg_node->valid) {
status = ice_cfg_agg(port_info, agg_id, ICE_AGG_TYPE_AGG,
(u8)vsi->tc_cfg.ena_tc); if (status) {
dev_err(dev, "unable to create aggregator node with agg_id %u\n",
agg_id); return;
} /* aggregator node is created, store the needed info */
agg_node->valid = true;
agg_node->agg_id = agg_id;
}
/* move VSI to corresponding aggregator node */
status = ice_move_vsi_to_agg(port_info, agg_id, vsi->idx,
(u8)vsi->tc_cfg.ena_tc); if (status) {
dev_err(dev, "unable to move VSI idx %u into aggregator %u node",
vsi->idx, agg_id); return;
}
/* keep active children count for aggregator node */
agg_node->num_vsis++;
/* cache the 'agg_id' in VSI, so that after reset - VSI will be moved *toaggregatornode
*/
vsi->agg_node = agg_node;
dev_dbg(dev, "successfully moved VSI idx %u tc_bitmap 0x%x) into aggregator node %d which has num_vsis %u\n",
vsi->idx, vsi->tc_cfg.ena_tc, vsi->agg_node->agg_id,
vsi->agg_node->num_vsis);
}
ret = ice_vsi_alloc_def(vsi, vsi->ch); if (ret) return ret;
/* allocate memory for Tx/Rx ring stat pointers */
ret = ice_vsi_alloc_stat_arrays(vsi); if (ret) goto unroll_vsi_alloc;
ice_alloc_fd_res(vsi);
ret = ice_vsi_get_qs(vsi); if (ret) {
dev_err(dev, "Failed to allocate queues. vsi->idx = %d\n",
vsi->idx); goto unroll_vsi_alloc_stat;
}
/* set RSS capabilities */
ice_vsi_set_rss_params(vsi);
/* set TC configuration */
ice_vsi_set_tc_cfg(vsi);
/* create the VSI */
ret = ice_vsi_init(vsi, vsi->flags); if (ret) goto unroll_get_qs;
ice_vsi_init_vlan_ops(vsi);
switch (vsi->type) { case ICE_VSI_CTRL: case ICE_VSI_SF: case ICE_VSI_PF:
ret = ice_vsi_alloc_q_vectors(vsi); if (ret) goto unroll_vsi_init;
ret = ice_vsi_alloc_rings(vsi); if (ret) goto unroll_vector_base;
ret = ice_vsi_alloc_ring_stats(vsi); if (ret) goto unroll_vector_base;
if (ice_is_xdp_ena_vsi(vsi)) {
ret = ice_vsi_determine_xdp_res(vsi); if (ret) goto unroll_vector_base;
ret = ice_prepare_xdp_rings(vsi, vsi->xdp_prog,
ICE_XDP_CFG_PART); if (ret) goto unroll_vector_base;
}
ice_vsi_map_rings_to_vectors(vsi);
vsi->stat_offsets_loaded = false;
/* ICE_VSI_CTRL does not need RSS so skip RSS processing */ if (vsi->type != ICE_VSI_CTRL) /* Do not exit if configuring RSS had an issue, at *leastreceivetrafficonfirstqueue.Henceno *needtocapturereturnvalue
*/ if (test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
ice_vsi_cfg_rss_lut_key(vsi);
ice_vsi_set_rss_flow_fld(vsi);
}
ice_init_arfs(vsi); break; case ICE_VSI_CHNL: if (test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
ice_vsi_cfg_rss_lut_key(vsi);
ice_vsi_set_rss_flow_fld(vsi);
} break; case ICE_VSI_VF: /* VF driver will take care of creating netdev for this type and *mapqueuestovectorsthroughVirtchnl,PFdriveronly *createsaVSIandcorrespondingstructuresforbookkeeping *purpose
*/
ret = ice_vsi_alloc_q_vectors(vsi); if (ret) goto unroll_vsi_init;
ret = ice_vsi_alloc_rings(vsi); if (ret) goto unroll_alloc_q_vector;
ret = ice_vsi_alloc_ring_stats(vsi); if (ret) goto unroll_vector_base;
vsi->stat_offsets_loaded = false;
/* Do not exit if configuring RSS had an issue, at least *receivetrafficonfirstqueue.Hencenoneedtocapture *returnvalue
*/ if (test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
ice_vsi_cfg_rss_lut_key(vsi);
ice_vsi_set_vf_rss_flow_fld(vsi);
} break; case ICE_VSI_LB:
ret = ice_vsi_alloc_rings(vsi); if (ret) goto unroll_vsi_init;
ret = ice_vsi_alloc_ring_stats(vsi); if (ret) goto unroll_vector_base;
break; default: /* clean up the resources and exit */
ret = -EINVAL; goto unroll_vsi_init;
}
return0;
unroll_vector_base: /* reclaim SW interrupts back to the common pool */
unroll_alloc_q_vector:
ice_vsi_free_q_vectors(vsi);
unroll_vsi_init:
ice_vsi_delete_from_hw(vsi);
unroll_get_qs:
ice_vsi_put_qs(vsi);
unroll_vsi_alloc_stat:
ice_vsi_free_stats(vsi);
unroll_vsi_alloc:
ice_vsi_free_arrays(vsi); return ret;
}
/** *ice_vsi_cfg-configureapreviouslyallocatedVSI *@vsi:pointertoVSI
*/ int ice_vsi_cfg(struct ice_vsi *vsi)
{ struct ice_pf *pf = vsi->back; int ret;
if (WARN_ON(vsi->type == ICE_VSI_VF && !vsi->vf)) return -EINVAL;
ret = ice_vsi_cfg_def(vsi); if (ret) return ret;
ret = ice_vsi_cfg_tc_lan(vsi->back, vsi); if (ret)
ice_vsi_decfg(vsi);
ice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx);
err = ice_rm_vsi_rdma_cfg(vsi->port_info, vsi->idx); if (err)
dev_err(ice_pf_to_dev(pf), "Failed to remove RDMA scheduler config for VSI %u, err %d\n",
vsi->vsi_num, err);
if (vsi->xdp_rings) /* return value check can be skipped here, it always returns *0ifresetisinprogress
*/
ice_destroy_xdp_rings(vsi, ICE_XDP_CFG_PART);
/* SR-IOV determines needed MSIX resources all at once instead of per *VSIsincewhenVFsarespawnedweknowhowmanyVFsthereareandhow *manyinterruptseachVFneeds.SR-IOVMSIXresourcesarealso *clearedinthesamemanner.
*/
if (vsi->type == ICE_VSI_VF &&
vsi->agg_node && vsi->agg_node->valid)
vsi->agg_node->num_vsis--;
}
/* ice_vsi_setup can only initialize a new VSI, and we must have *aport_infostructureforit.
*/ if (WARN_ON(!(params->flags & ICE_VSI_FLAG_INIT)) ||
WARN_ON(!params->port_info)) return NULL;
vsi = ice_vsi_alloc(pf); if (!vsi) {
dev_err(dev, "could not allocate VSI\n"); return NULL;
}
vsi->params = *params;
ret = ice_vsi_cfg(vsi); if (ret) goto err_vsi_cfg;
/* Add switch rule to drop all Tx Flow Control Frames, of look up *typeETHERTYPEfromVSIs,andrestrictmaliciousVFfromsending *outPAUSEorPFCframes.Ifenabled,FWcanstillsendFCframes. *TheruleisaddedonceforPFVSIinordertocreateappropriate *recipe,sinceVSI/VSIlistisignoredwithdropaction... *AlsoaddrulestohandleLLDPTxpackets.TxLLDPpacketsneedto *bedroppedsothatVFscannotsendLLDPpacketstoreconfigDCB *settingsintheHW.
*/ if (!ice_is_safe_mode(pf) && vsi->type == ICE_VSI_PF) {
ice_fltr_add_eth(vsi, ETH_P_PAUSE, ICE_FLTR_TX,
ICE_DROP_PACKET);
ice_vsi_cfg_sw_lldp(vsi, true, true);
}
ice_vsi_release_msix(vsi); if (vsi->type == ICE_VSI_VF) return;
vsi->irqs_ready = false;
ice_for_each_q_vector(vsi, i) { int irq_num;
irq_num = vsi->q_vectors[i]->irq.virq;
/* free only the irqs that were actually requested */ if (!vsi->q_vectors[i] ||
!(vsi->q_vectors[i]->num_ring_tx ||
vsi->q_vectors[i]->num_ring_rx)) continue;
ice_for_each_txq(vsi, q_idx)
netif_queue_set_napi(netdev, q_idx, NETDEV_QUEUE_TYPE_TX,
&vsi->tx_rings[q_idx]->q_vector->napi); /* Also set the interrupt number for the NAPI */
ice_for_each_q_vector(vsi, v_idx) { struct ice_q_vector *q_vector = vsi->q_vectors[v_idx];
if (test_bit(ICE_FLAG_RSS_ENA, pf->flags))
ice_rss_clean(vsi);
ice_vsi_close(vsi);
/* The Rx rule will only exist to remove if the LLDP FW *engineiscurrentlystopped
*/ if (!ice_is_safe_mode(pf) &&
!test_bit(ICE_FLAG_FW_LLDP_AGENT, pf->flags) &&
(vsi->type == ICE_VSI_PF || (vsi->type == ICE_VSI_VF &&
ice_vf_is_lldp_ena(vsi->vf))))
ice_vsi_cfg_sw_lldp(vsi, false, false);
ice_vsi_decfg(vsi);
/* retain SW VSI data structure since it is needed to unregister and *freeVSInetdevwhenPFisnotinresetrecoverypendingstate,\ *forex:duringrmmod.
*/ if (!ice_is_reset_in_progress(pf->state))
ice_vsi_delete(vsi);
/* There are a couple of cases that have to be handled here: *1.Thecasewherethenumberofqueuevectorsstaysthesame,but *thenumberofTxorRxringschanges(thefirstforloop) *2.Thecasewherethenumberofqueuevectorsincreased(the *secondforloop)
*/ for (i = 0; i < size && i < vsi->num_q_vectors; i++) { /* There are 2 cases to handle here and they are the same for *bothTxandRx: *iftheentrywasvalidpreviously(coalesce[i].[tr]x_valid *andtheloopvariableislessthanthenumberofrings *allocated,thenwritethepreviousvalues * *iftheentrywasnotvalidpreviously,butthenumberof *ringsislessthanareallocated(thismeansthenumberof *ringsincreasedfrompreviously),thenwriteoutthe *valuesinthefirstelement * *Also,alwayswritetheITR,evenifinITR_IS_DYNAMIC *asthereisnoharmbecausethedynamicalgorithm *willjustoverwrite.
*/ if (i < vsi->alloc_rxq && coalesce[i].rx_valid) {
rc = &vsi->q_vectors[i]->rx;
rc->itr_settings = coalesce[i].itr_rx;
ice_write_itr(rc, rc->itr_setting);
} elseif (i < vsi->alloc_rxq) {
rc = &vsi->q_vectors[i]->rx;
rc->itr_settings = coalesce[0].itr_rx;
ice_write_itr(rc, rc->itr_setting);
}
if (i < vsi->alloc_txq && coalesce[i].tx_valid) {
rc = &vsi->q_vectors[i]->tx;
rc->itr_settings = coalesce[i].itr_tx;
ice_write_itr(rc, rc->itr_setting);
} elseif (i < vsi->alloc_txq) {
rc = &vsi->q_vectors[i]->tx;
rc->itr_settings = coalesce[0].itr_tx;
ice_write_itr(rc, rc->itr_setting);
}
/* the number of queue vectors increased so write whatever is in *thefirstelement
*/ for (; i < vsi->num_q_vectors; i++) { /* transmit */
rc = &vsi->q_vectors[i]->tx;
rc->itr_settings = coalesce[0].itr_tx;
ice_write_itr(rc, rc->itr_setting);
if (req_txq < prev_txq) { for (i = req_txq; i < prev_txq; i++) { if (vsi_stat->tx_ring_stats[i]) {
kfree_rcu(vsi_stat->tx_ring_stats[i], rcu);
WRITE_ONCE(vsi_stat->tx_ring_stats[i], NULL);
}
}
}
if (req_rxq < prev_rxq) { for (i = req_rxq; i < prev_rxq; i++) { if (vsi_stat->rx_ring_stats[i]) {
kfree_rcu(vsi_stat->rx_ring_stats[i], rcu);
WRITE_ONCE(vsi_stat->rx_ring_stats[i], NULL);
}
}
}
new_txq = offset + qcount_tx; if (new_txq > vsi->alloc_txq) {
dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n",
new_txq, vsi->alloc_txq); return -EINVAL;
}
new_rxq = offset + qcount_rx; if (new_rxq > vsi->alloc_rxq) {
dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n",
new_rxq, vsi->alloc_rxq); return -EINVAL;
}
/* Set actual Tx/Rx queue pairs */
vsi->num_txq = new_txq;
vsi->num_rxq = new_rxq;
/* Setup queue TC[0].qmap for given VSI context */
ctxt->info.tc_mapping[0] = cpu_to_le16(qmap);
ctxt->info.q_mapping[0] = cpu_to_le16(vsi->rxq_map[0]);
ctxt->info.q_mapping[1] = cpu_to_le16(tc0_qcount);
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM;
ctx->vf_num = 0;
ctx->info = vsi->info;
if (vsi->type == ICE_VSI_PF &&
test_bit(ICE_FLAG_TC_MQPRIO, pf->flags))
ret = ice_vsi_setup_q_map_mqprio(vsi, ctx, ena_tc); else
ret = ice_vsi_setup_q_map(vsi, ctx);
if (ret) {
memcpy(&vsi->tc_cfg, &old_tc_cfg, sizeof(vsi->tc_cfg)); goto out;
}
/* must to indicate which section of VSI context are being modified */
ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);
ret = ice_update_vsi(&pf->hw, vsi->idx, ctx, NULL); if (ret) {
dev_info(dev, "Failed VSI Update\n"); goto out;
}
if (vsi->type == ICE_VSI_PF &&
test_bit(ICE_FLAG_TC_MQPRIO, pf->flags))
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx, 1, max_txqs); else
ret = ice_cfg_vsi_lan(vsi->port_info, vsi->idx,
vsi->tc_cfg.ena_tc, max_txqs);
/** *ice_set_dflt_vsi-setthedefaultforwardingVSI *@vsi:VSIgettingsetasthedefaultforwardingVSIontheswitch * *IftheVSIpassedinisalreadythedefaultVSIandit'senabledjustreturn *success. * *OtherwisetrytosettheVSIpassedinastheswitch'sdefaultVSIand *returntheresult.
*/ int ice_set_dflt_vsi(struct ice_vsi *vsi)
{ struct device *dev; int status;
if (!vsi) return -EINVAL;
dev = ice_pf_to_dev(vsi->back);
if (ice_lag_is_switchdev_running(vsi->back)) {
dev_dbg(dev, "VSI %d passed is a part of LAG containing interfaces in switchdev mode, nothing to do\n",
vsi->vsi_num); return0;
}
/* the VSI passed in is already the default VSI */ if (ice_is_vsi_dflt_vsi(vsi)) {
dev_dbg(dev, "VSI %d passed in is already the default forwarding VSI, nothing to do\n",
vsi->vsi_num); return0;
}
status = ice_cfg_dflt_vsi(vsi->port_info, vsi->idx, true, ICE_FLTR_RX); if (status) {
dev_err(dev, "Failed to set VSI %d as the default forwarding VSI, error %d\n",
vsi->vsi_num, status); return status;
}
return0;
}
/** *ice_clear_dflt_vsi-clearthedefaultforwardingVSI *@vsi:VSItoremovefromfilterlist * *IftheswitchhasnodefaultVSIorit'snotenabledthenreturnerror. * *OtherwisetrytoclearthedefaultVSIandreturntheresult.
*/ int ice_clear_dflt_vsi(struct ice_vsi *vsi)
{ struct device *dev; int status;
if (!vsi) return -EINVAL;
dev = ice_pf_to_dev(vsi->back);
/* there is no default VSI configured */ if (!ice_is_dflt_vsi_in_use(vsi->port_info)) return -ENODEV;
status = ice_cfg_dflt_vsi(vsi->port_info, vsi->idx, false,
ICE_FLTR_RX); if (status) {
dev_err(dev, "Failed to clear the default forwarding VSI %d, error %d\n",
vsi->vsi_num, status); return -EIO;
}
/** *ice_get_link_speed_kbps-getlinkspeedinKbps *@vsi:theVSIwhoselinkspeedisbeingqueried * *ReturncurrentVSIlinkspeedand0ifthespeedisunknown.
*/ int ice_get_link_speed_kbps(struct ice_vsi *vsi)
{ int speed_mbps;
speed_mbps = ice_get_link_speed_mbps(vsi);
return speed_mbps * 1000;
}
/** *ice_set_min_bw_limit-setupminimumBWlimitforTxbasedonmin_tx_rate *@vsi:VSItobeconfigured *@min_tx_rate:minTxrateinKbpstobeconfiguredasBWlimit * *Ifthemin_tx_rateisspecifiedas0thatmeanstocleartheminimumBWlimit *profile,otherwiseanon-zerovaluewillforceaminimumBWlimitfortheVSI *onTC0.
*/ int ice_set_min_bw_limit(struct ice_vsi *vsi, u64 min_tx_rate)
{ struct ice_pf *pf = vsi->back; struct device *dev; int status; int speed;
dev = ice_pf_to_dev(pf); if (!vsi->port_info) {
dev_dbg(dev, "VSI %d, type %u specified doesn't have valid port_info\n",
vsi->idx, vsi->type); return -EINVAL;
}
speed = ice_get_link_speed_kbps(vsi); if (min_tx_rate > (u64)speed) {
dev_err(dev, "invalid min Tx rate %llu Kbps specified for %s %d is greater than current link speed %u Kbps\n",
min_tx_rate, ice_vsi_type_str(vsi->type), vsi->idx,
speed); return -EINVAL;
}
/* Configure min BW for VSI limit */ if (min_tx_rate) {
status = ice_cfg_vsi_bw_lmt_per_tc(vsi->port_info, vsi->idx, 0,
ICE_MIN_BW, min_tx_rate); if (status) {
dev_err(dev, "failed to set min Tx rate(%llu Kbps) for %s %d\n",
min_tx_rate, ice_vsi_type_str(vsi->type),
vsi->idx); return status;
}
dev_dbg(dev, "set min Tx rate(%llu Kbps) for %s\n",
min_tx_rate, ice_vsi_type_str(vsi->type));
} else {
status = ice_cfg_vsi_bw_dflt_lmt_per_tc(vsi->port_info,
vsi->idx, 0,
ICE_MIN_BW); if (status) {
dev_err(dev, "failed to clear min Tx rate configuration for %s %d\n",
ice_vsi_type_str(vsi->type), vsi->idx); return status;
}
dev_dbg(dev, "cleared min Tx rate configuration for %s %d\n",
ice_vsi_type_str(vsi->type), vsi->idx);
}
return0;
}
/** *ice_set_max_bw_limit-setupmaximumBWlimitforTxbasedonmax_tx_rate *@vsi:VSItobeconfigured *@max_tx_rate:maxTxrateinKbpstobeconfiguredasBWlimit * *Ifthemax_tx_rateisspecifiedas0thatmeanstoclearthemaximumBWlimit *profile,otherwiseanon-zerovaluewillforceamaximumBWlimitfortheVSI *onTC0.
*/ int ice_set_max_bw_limit(struct ice_vsi *vsi, u64 max_tx_rate)
{ struct ice_pf *pf = vsi->back; struct device *dev; int status; int speed;
dev = ice_pf_to_dev(pf); if (!vsi->port_info) {
dev_dbg(dev, "VSI %d, type %u specified doesn't have valid port_info\n",
vsi->idx, vsi->type); return -EINVAL;
}
speed = ice_get_link_speed_kbps(vsi); if (max_tx_rate > (u64)speed) {
dev_err(dev, "invalid max Tx rate %llu Kbps specified for %s %d is greater than current link speed %u Kbps\n",
max_tx_rate, ice_vsi_type_str(vsi->type), vsi->idx,
speed); return -EINVAL;
}
/* Configure max BW for VSI limit */ if (max_tx_rate) {
status = ice_cfg_vsi_bw_lmt_per_tc(vsi->port_info, vsi->idx, 0,
ICE_MAX_BW, max_tx_rate); if (status) {
dev_err(dev, "failed setting max Tx rate(%llu Kbps) for %s %d\n",
max_tx_rate, ice_vsi_type_str(vsi->type),
vsi->idx); return status;
}
dev_dbg(dev, "set max Tx rate(%llu Kbps) for %s %d\n",
max_tx_rate, ice_vsi_type_str(vsi->type), vsi->idx);
} else {
status = ice_cfg_vsi_bw_dflt_lmt_per_tc(vsi->port_info,
vsi->idx, 0,
ICE_MAX_BW); if (status) {
dev_err(dev, "failed clearing max Tx rate configuration for %s %d\n",
ice_vsi_type_str(vsi->type), vsi->idx); return status;
}
dev_dbg(dev, "cleared max Tx rate configuration for %s %d\n",
ice_vsi_type_str(vsi->type), vsi->idx);
}
status = ice_aq_set_link_restart_an(pi, ena, NULL);
/* if link is owned by manageability, FW will return LIBIE_AQ_RC_EMODE. *thisisnotafatalerror,soprintawarningmessageandreturn *asuccesscode.ReturnanerrorifFWreturnsanerrorcodeother *thanLIBIE_AQ_RC_EMODE
*/ if (status == -EIO) { if (hw->adminq.sq_last_status == LIBIE_AQ_RC_EMODE)
dev_dbg(dev, "can't set link to %s, err %d aq_err %s. not fatal, continuing\n",
(ena ? "ON" : "OFF"), status,
libie_aq_str(hw->adminq.sq_last_status));
} elseif (status) {
dev_err(dev, "can't set link to %s, err %d aq_err %s\n",
(ena ? "ON" : "OFF"), status,
libie_aq_str(hw->adminq.sq_last_status)); return status;
}
/* when deleting the last VLAN filter, make sure to disable the VLAN *promiscmodesothefilterisn'tleftbyaccident
*/ return ice_clear_vsi_promisc(&vsi->back->hw, vsi->idx,
ICE_MCAST_VLAN_PROMISC_BITS, 0);
}
/** *ice_vsi_num_zero_vlans-getnumberofVLAN0filtersbasedonVLANmode *@vsi:VSIusedtogettheVLANmode * *IfDVMisenabledthen2VLAN0filtersareadded,elseifSVMisenabled *then1VLAN0filterisadded.Seeice_vsi_add_vlan_zeroformoredetails.
*/ static u16 ice_vsi_num_zero_vlans(struct ice_vsi *vsi)
{ #define ICE_DVM_NUM_ZERO_VLAN_FLTRS 2 #define ICE_SVM_NUM_ZERO_VLAN_FLTRS 1 /* no VLAN 0 filter is created when a port VLAN is active */ if (vsi->type == ICE_VSI_VF) { if (WARN_ON(!vsi->vf)) return0;
if (ice_vf_is_port_vlan_ena(vsi->vf)) return0;
}
if (ice_is_dvm_ena(&vsi->back->hw)) return ICE_DVM_NUM_ZERO_VLAN_FLTRS; else return ICE_SVM_NUM_ZERO_VLAN_FLTRS;
}
/** *ice_init_feature_support *@pf:pointertothestructice_pfinstance * *calledduringinittosetupsupportedfeature
*/ void ice_init_feature_support(struct ice_pf *pf)
{ switch (pf->hw.device_id) { case ICE_DEV_ID_E810C_BACKPLANE: case ICE_DEV_ID_E810C_QSFP: case ICE_DEV_ID_E810C_SFP: case ICE_DEV_ID_E810_XXV_BACKPLANE: case ICE_DEV_ID_E810_XXV_QSFP: case ICE_DEV_ID_E810_XXV_SFP:
ice_set_feature_support(pf, ICE_F_DSCP); if (ice_is_phy_rclk_in_netlist(&pf->hw))
ice_set_feature_support(pf, ICE_F_PHY_RCLK); /* If we don't own the timer - don't enable other caps */ if (!ice_pf_src_tmr_owned(pf)) break; if (ice_is_cgu_in_netlist(&pf->hw))
ice_set_feature_support(pf, ICE_F_CGU); if (ice_is_clock_mux_in_netlist(&pf->hw))
ice_set_feature_support(pf, ICE_F_SMA_CTRL); if (ice_gnss_is_module_present(&pf->hw))
ice_set_feature_support(pf, ICE_F_GNSS); break; default: break;
}
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.83Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-10-03)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.