diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c index a10c1c8d8697..bb5cc0a2ba69 100644 --- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c +++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c @@ -872,7 +872,7 @@ static int ice_dcbnl_delapp(struct net_device *netdev, struct dcb_app *app) int ret = 0; if (pf->dcbx_cap & DCB_CAP_DCBX_LLD_MANAGED) { - netdev_err(netdev, "can't delete DSCP netlink app when FW DCB agent is active\n"); + netdev_dbg(netdev, "can't delete DSCP netlink app when FW DCB agent is active\n"); return -EINVAL; } diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c index 516b57ff3b1c..ad519a8513db 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool_ntuple.c @@ -8,23 +8,10 @@ #include "ice_fdir.h" #include "ice_flow.h" -static struct in6_addr full_ipv6_addr_mask = { - .in6_u = { - .u6_addr8 = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - } - } -}; - -static struct in6_addr zero_ipv6_addr_mask = { - .in6_u = { - .u6_addr8 = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - } - } -}; +static bool ice_ipv6_mask_full(const __be32 *a) +{ + return (a[0] & a[1] & a[2] & a[3]) == cpu_to_be32(0xffffffff); +} /* calls to ice_flow_add_prof require the number of segments in the array * for segs_cnt. In this code that is one more than the index. @@ -1070,10 +1057,8 @@ ice_set_fdir_ip6_seg(struct ice_flow_seg_info *seg, enum ice_flow_field src_port, dst_port; /* make sure we don't have any empty rule */ - if (!memcmp(tcp_ip6_spec->ip6src, &zero_ipv6_addr_mask, - sizeof(struct in6_addr)) && - !memcmp(tcp_ip6_spec->ip6dst, &zero_ipv6_addr_mask, - sizeof(struct in6_addr)) && + if (ipv6_addr_any((struct in6_addr *)tcp_ip6_spec->ip6src) && + ipv6_addr_any((struct in6_addr *)tcp_ip6_spec->ip6dst) && !tcp_ip6_spec->psrc && !tcp_ip6_spec->pdst) return -EINVAL; @@ -1097,24 +1082,20 @@ ice_set_fdir_ip6_seg(struct ice_flow_seg_info *seg, *perfect_fltr = true; ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_IPV6 | l4_proto); - if (!memcmp(tcp_ip6_spec->ip6src, &full_ipv6_addr_mask, - sizeof(struct in6_addr))) + if (ice_ipv6_mask_full(tcp_ip6_spec->ip6src)) ice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV6_SA, ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL, false); - else if (!memcmp(tcp_ip6_spec->ip6src, &zero_ipv6_addr_mask, - sizeof(struct in6_addr))) + else if (ipv6_addr_any((struct in6_addr *)tcp_ip6_spec->ip6src)) *perfect_fltr = false; else return -EOPNOTSUPP; - if (!memcmp(tcp_ip6_spec->ip6dst, &full_ipv6_addr_mask, - sizeof(struct in6_addr))) + if (ice_ipv6_mask_full(tcp_ip6_spec->ip6dst)) ice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV6_DA, ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL, false); - else if (!memcmp(tcp_ip6_spec->ip6dst, &zero_ipv6_addr_mask, - sizeof(struct in6_addr))) + else if (ipv6_addr_any((struct in6_addr *)tcp_ip6_spec->ip6dst)) *perfect_fltr = false; else return -EOPNOTSUPP; @@ -1167,33 +1148,27 @@ ice_set_fdir_ip6_usr_seg(struct ice_flow_seg_info *seg, if (usr_ip6_spec->l4_proto) return -EOPNOTSUPP; /* empty rules are not valid */ - if (!memcmp(usr_ip6_spec->ip6src, &zero_ipv6_addr_mask, - sizeof(struct in6_addr)) && - !memcmp(usr_ip6_spec->ip6dst, &zero_ipv6_addr_mask, - sizeof(struct in6_addr))) + if (ipv6_addr_any((struct in6_addr *)usr_ip6_spec->ip6src) && + ipv6_addr_any((struct in6_addr *)usr_ip6_spec->ip6dst)) return -EINVAL; *perfect_fltr = true; ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_IPV6); - if (!memcmp(usr_ip6_spec->ip6src, &full_ipv6_addr_mask, - sizeof(struct in6_addr))) + if (ice_ipv6_mask_full(usr_ip6_spec->ip6src)) ice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV6_SA, ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL, false); - else if (!memcmp(usr_ip6_spec->ip6src, &zero_ipv6_addr_mask, - sizeof(struct in6_addr))) + else if (ipv6_addr_any((struct in6_addr *)usr_ip6_spec->ip6src)) *perfect_fltr = false; else return -EOPNOTSUPP; - if (!memcmp(usr_ip6_spec->ip6dst, &full_ipv6_addr_mask, - sizeof(struct in6_addr))) + if (ice_ipv6_mask_full(usr_ip6_spec->ip6dst)) ice_flow_set_fld(seg, ICE_FLOW_FIELD_IDX_IPV6_DA, ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL, ICE_FLOW_FLD_OFF_INVAL, false); - else if (!memcmp(usr_ip6_spec->ip6dst, &zero_ipv6_addr_mask, - sizeof(struct in6_addr))) + else if (ipv6_addr_any((struct in6_addr *)usr_ip6_spec->ip6dst)) *perfect_fltr = false; else return -EOPNOTSUPP; diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index c393d913d037..7cd2dd066ef5 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -1806,16 +1806,7 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi) */ bool ice_pf_state_is_nominal(struct ice_pf *pf) { - DECLARE_BITMAP(check_bits, ICE_STATE_NBITS) = { 0 }; - - if (!pf) - return false; - - bitmap_set(check_bits, 0, ICE_STATE_NOMINAL_CHECK_BITS); - if (bitmap_intersects(pf->state, check_bits, ICE_STATE_NBITS)) - return false; - - return true; + return bitmap_empty(pf->state, ICE_STATE_NOMINAL_CHECK_BITS); } #define ICE_FW_MODE_REC_M BIT(1) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 707c7431b91a..454fba07d4ec 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3428,7 +3428,7 @@ static int ice_req_irq_msix_misc(struct ice_pf *pf) ((pf->ll_ts_irq.index + pf_intr_start_offset) & PFINT_SB_CTL_MSIX_INDX_M) | PFINT_SB_CTL_CAUSE_ENA_M); wr32(hw, GLINT_ITR(ICE_RX_ITR, pf->oicr_irq.index), - ITR_REG_ALIGN(ICE_ITR_8K) >> ICE_ITR_GRAN_S); + ITR_REG_ALIGN(ICE_ITR_20K) >> ICE_ITR_GRAN_S); ice_flush(hw); ice_irq_dynamic_ena(hw, NULL, NULL); @@ -5530,7 +5530,7 @@ static int ice_suspend(struct device *dev) pf = pci_get_drvdata(pdev); - if (!ice_pf_state_is_nominal(pf)) { + if (!pf || !ice_pf_state_is_nominal(pf)) { dev_err(dev, "Device is not ready, no need to suspend it\n"); return -EBUSY; } diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c index 3ede4c1a5a8a..d239102c52ff 100644 --- a/drivers/net/ethernet/intel/ice/ice_parser.c +++ b/drivers/net/ethernet/intel/ice/ice_parser.c @@ -102,7 +102,7 @@ ice_parser_create_table(struct ice_hw *hw, u32 sect_type, if (!seg) return ERR_PTR(-EINVAL); - table = kzalloc(item_size * length, GFP_KERNEL); + table = kcalloc(length, item_size, GFP_KERNEL); if (!table) return ERR_PTR(-ENOMEM); diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index e54a98a0bdd0..b781004f856d 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -2330,6 +2330,8 @@ u64 ice_ptp_get_rx_hwts(const union ice_32b_rx_flex_desc *rx_desc, ts_high = le32_to_cpu(rx_desc->wb.flex_ts.ts_high); ts_ns = ice_ptp_extend_32b_ts(cached_time, ts_high); + ice_trace(rx_hwtstamp, cached_time, ts_high, ts_ns); + return ts_ns; } diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 6a5875bd9c6b..4daee252e2a6 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -2612,7 +2612,6 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, u16 vlan_id = ICE_MAX_VLAN_ID + 1; u16 vlan_tpid = ETH_P_8021Q; void *daddr = NULL; - u16 eth_hdr_sz; u8 *eth_hdr; u32 act = 0; __be16 *off; @@ -2625,11 +2624,10 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, return; } - eth_hdr_sz = sizeof(dummy_eth_header); eth_hdr = s_rule->hdr_data; /* initialize the ether header with a dummy header */ - memcpy(eth_hdr, dummy_eth_header, eth_hdr_sz); + ice_fill_eth_hdr(eth_hdr); ice_fill_sw_info(hw, f_info); switch (f_info->fltr_act) { @@ -2730,7 +2728,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, /* Create the switch rule with the final dummy Ethernet header */ if (opc != ice_aqc_opc_update_sw_rules) - s_rule->hdr_len = cpu_to_le16(eth_hdr_sz); + s_rule->hdr_len = cpu_to_le16(DUMMY_ETH_HDR_LEN); } /** diff --git a/drivers/net/ethernet/intel/ice/ice_trace.h b/drivers/net/ethernet/intel/ice/ice_trace.h index 7568c917cdbe..7c43683a77d4 100644 --- a/drivers/net/ethernet/intel/ice/ice_trace.h +++ b/drivers/net/ethernet/intel/ice/ice_trace.h @@ -261,6 +261,24 @@ DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_fw_req); DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_fw_done); DEFINE_TX_TSTAMP_OP_EVENT(ice_tx_tstamp_complete); +/* Trace event for Rx timestamp */ +TRACE_EVENT(ice_rx_hwtstamp, + TP_PROTO(u64 cached_time, u32 ts_high, u64 ts_ns), + + TP_ARGS(cached_time, ts_high, ts_ns), + + TP_STRUCT__entry(__field(u64, cached_time) + __field(u32, ts_high) + __field(u64, ts_ns)), + + TP_fast_assign(__entry->cached_time = cached_time; + __entry->ts_high = ts_high; + __entry->ts_ns = ts_ns;), + + TP_printk("cached_time=%llu ts_high=%u ts_ns=%llu", + __entry->cached_time, __entry->ts_high, __entry->ts_ns) +); + DECLARE_EVENT_CLASS(ice_esw_br_fdb_template, TP_PROTO(struct ice_esw_br_fdb_entry *fdb), TP_ARGS(fdb), diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h index f1a80da6239e..b8bdd7e8c768 100644 --- a/drivers/net/ethernet/intel/ice/ice_type.h +++ b/drivers/net/ethernet/intel/ice/ice_type.h @@ -529,8 +529,8 @@ struct ice_flash_info { struct ice_nvm_info nvm; /* NVM version information */ struct ice_netlist_info netlist;/* Netlist version info */ struct ice_bank_info banks; /* Flash Bank information */ - u16 sr_words; /* Shadow RAM size in words */ u32 flash_size; /* Size of available flash in bytes */ + u16 sr_words; /* Shadow RAM size in words */ u8 blank_nvm_mode; /* is NVM empty (no FW present) */ }; diff --git a/drivers/net/ethernet/intel/ice/virt/queues.c b/drivers/net/ethernet/intel/ice/virt/queues.c index 431c9c546b04..ac7f98479b13 100644 --- a/drivers/net/ethernet/intel/ice/virt/queues.c +++ b/drivers/net/ethernet/intel/ice/virt/queues.c @@ -375,6 +375,8 @@ int ice_vf_vsi_dis_single_txq(struct ice_vf *vf, struct ice_vsi *vsi, u16 q_id) * @msg: pointer to the msg buffer * * called from the VF to disable all or specific queue(s) + * + * Return: exit code of sending the virtchnl response. */ int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) { @@ -424,20 +426,7 @@ int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) } q_map = vqs->rx_queues; - /* speed up Rx queue disable by batching them if possible */ - if (q_map && - bitmap_equal(&q_map, vf->rxq_ena, ICE_MAX_RSS_QS_PER_VF)) { - if (ice_vsi_stop_all_rx_rings(vsi)) { - dev_err(ice_pf_to_dev(vsi->back), "Failed to stop all Rx rings on VSI %d\n", - vsi->vsi_num); - v_ret = VIRTCHNL_STATUS_ERR_PARAM; - goto error_param; - } - - for_each_set_bit(vf_q_id, &q_map, ICE_MAX_RSS_QS_PER_VF) - ice_vf_dis_rxq_interrupt(vsi, vf_q_id); - bitmap_zero(vf->rxq_ena, ICE_MAX_RSS_QS_PER_VF); - } else if (q_map) { + if (q_map) { for_each_set_bit(vf_q_id, &q_map, ICE_MAX_RSS_QS_PER_VF) { if (!ice_vc_isvalid_q_id(vsi, vf_q_id)) { v_ret = VIRTCHNL_STATUS_ERR_PARAM;