Skip to content

Commit

Permalink
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/tnguy/next-queue

Tony Nguyen says:

====================
100GbE Intel Wired LAN Driver Updates 2022-06-08

Michal prevents setting of VF VLAN capabilities in switchdev mode and
removes, not needed, specific switchdev VLAN operations.

Karol converts u16 variables to unsigned int for GNSS calculations.

Christophe Jaillet corrects the parameter order for a couple of
devm_kcalloc() calls.

* '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  ice: Use correct order for the parameters of devm_kcalloc()
  ice: remove u16 arithmetic in ice_gnss
  ice: remove VLAN representor specific ops
  ice: don't set VF VLAN caps in switchdev
====================

Link: https://lore.kernel.org/r/20220608160757.2395729-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Jun 10, 2022
2 parents 3000024 + a4da491 commit ce1d8e7
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 74 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ ice_create_init_fdir_rule(struct ice_pf *pf, enum ice_fltr_ptype flow)
if (!seg)
return -ENOMEM;

tun_seg = devm_kcalloc(dev, sizeof(*seg), ICE_FD_HW_SEG_MAX,
tun_seg = devm_kcalloc(dev, ICE_FD_HW_SEG_MAX, sizeof(*tun_seg),
GFP_KERNEL);
if (!tun_seg) {
devm_kfree(dev, seg);
Expand Down Expand Up @@ -1214,7 +1214,7 @@ ice_cfg_fdir_xtrct_seq(struct ice_pf *pf, struct ethtool_rx_flow_spec *fsp,
if (!seg)
return -ENOMEM;

tun_seg = devm_kcalloc(dev, sizeof(*seg), ICE_FD_HW_SEG_MAX,
tun_seg = devm_kcalloc(dev, ICE_FD_HW_SEG_MAX, sizeof(*tun_seg),
GFP_KERNEL);
if (!tun_seg) {
devm_kfree(dev, seg);
Expand Down
11 changes: 6 additions & 5 deletions drivers/net/ethernet/intel/ice/ice_gnss.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ static void ice_gnss_read(struct kthread_work *work)
struct gnss_serial *gnss = container_of(work, struct gnss_serial,
read_work.work);
struct ice_aqc_link_topo_addr link_topo;
u8 i2c_params, bytes_read;
unsigned int i, bytes_read, data_len;
struct tty_port *port;
struct ice_pf *pf;
struct ice_hw *hw;
__be16 data_len_b;
char *buf = NULL;
u16 i, data_len;
u8 i2c_params;
int err = 0;

pf = gnss->back;
Expand Down Expand Up @@ -65,7 +65,7 @@ static void ice_gnss_read(struct kthread_work *work)
mdelay(10);
}

data_len = min(data_len, (u16)PAGE_SIZE);
data_len = min_t(typeof(data_len), data_len, PAGE_SIZE);
data_len = tty_buffer_request_room(port, data_len);
if (!data_len) {
err = -ENOMEM;
Expand All @@ -74,9 +74,10 @@ static void ice_gnss_read(struct kthread_work *work)

/* Read received data */
for (i = 0; i < data_len; i += bytes_read) {
u16 bytes_left = data_len - i;
unsigned int bytes_left = data_len - i;

bytes_read = min_t(typeof(bytes_left), bytes_left, ICE_MAX_I2C_DATA_SIZE);
bytes_read = min_t(typeof(bytes_left), bytes_left,
ICE_MAX_I2C_DATA_SIZE);

err = ice_aq_read_i2c(hw, link_topo, ICE_GNSS_UBX_I2C_BUS_ADDR,
cpu_to_le16(ICE_GNSS_UBX_EMPTY_DATA),
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/intel/ice/ice_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,9 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt)
(ICE_AQ_VSI_OUTER_TAG_VLAN_8100 <<
ICE_AQ_VSI_OUTER_TAG_TYPE_S) &
ICE_AQ_VSI_OUTER_TAG_TYPE_M;
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);
Expand Down
121 changes: 54 additions & 67 deletions drivers/net/ethernet/intel/ice/ice_virtchnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,54 @@ static u16 ice_vc_get_max_frame_size(struct ice_vf *vf)
return max_frame_size;
}

/**
* ice_vc_get_vlan_caps
* @hw: pointer to the hw
* @vf: pointer to the VF info
* @vsi: pointer to the VSI
* @driver_caps: current driver caps
*
* Return 0 if there is no VLAN caps supported, or VLAN caps value
*/
static u32
ice_vc_get_vlan_caps(struct ice_hw *hw, struct ice_vf *vf, struct ice_vsi *vsi,
u32 driver_caps)
{
if (ice_is_eswitch_mode_switchdev(vf->pf))
/* In switchdev setting VLAN from VF isn't supported */
return 0;

if (driver_caps & VIRTCHNL_VF_OFFLOAD_VLAN_V2) {
/* VLAN offloads based on current device configuration */
return VIRTCHNL_VF_OFFLOAD_VLAN_V2;
} else if (driver_caps & VIRTCHNL_VF_OFFLOAD_VLAN) {
/* allow VF to negotiate VIRTCHNL_VF_OFFLOAD explicitly for
* these two conditions, which amounts to guest VLAN filtering
* and offloads being based on the inner VLAN or the
* inner/single VLAN respectively and don't allow VF to
* negotiate VIRTCHNL_VF_OFFLOAD in any other cases
*/
if (ice_is_dvm_ena(hw) && ice_vf_is_port_vlan_ena(vf)) {
return VIRTCHNL_VF_OFFLOAD_VLAN;
} else if (!ice_is_dvm_ena(hw) &&
!ice_vf_is_port_vlan_ena(vf)) {
/* configure backward compatible support for VFs that
* only support VIRTCHNL_VF_OFFLOAD_VLAN, the PF is
* configured in SVM, and no port VLAN is configured
*/
ice_vf_vsi_cfg_svm_legacy_vlan_mode(vsi);
return VIRTCHNL_VF_OFFLOAD_VLAN;
} else if (ice_is_dvm_ena(hw)) {
/* configure software offloaded VLAN support when DVM
* is enabled, but no port VLAN is enabled
*/
ice_vf_vsi_cfg_dvm_legacy_vlan_mode(vsi);
}
}

return 0;
}

/**
* ice_vc_get_vf_res_msg
* @vf: pointer to the VF info
Expand Down Expand Up @@ -402,33 +450,8 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)
goto err;
}

if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_VLAN_V2) {
/* VLAN offloads based on current device configuration */
vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_VLAN_V2;
} else if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_VLAN) {
/* allow VF to negotiate VIRTCHNL_VF_OFFLOAD explicitly for
* these two conditions, which amounts to guest VLAN filtering
* and offloads being based on the inner VLAN or the
* inner/single VLAN respectively and don't allow VF to
* negotiate VIRTCHNL_VF_OFFLOAD in any other cases
*/
if (ice_is_dvm_ena(hw) && ice_vf_is_port_vlan_ena(vf)) {
vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_VLAN;
} else if (!ice_is_dvm_ena(hw) &&
!ice_vf_is_port_vlan_ena(vf)) {
vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_VLAN;
/* configure backward compatible support for VFs that
* only support VIRTCHNL_VF_OFFLOAD_VLAN, the PF is
* configured in SVM, and no port VLAN is configured
*/
ice_vf_vsi_cfg_svm_legacy_vlan_mode(vsi);
} else if (ice_is_dvm_ena(hw)) {
/* configure software offloaded VLAN support when DVM
* is enabled, but no port VLAN is enabled
*/
ice_vf_vsi_cfg_dvm_legacy_vlan_mode(vsi);
}
}
vfres->vf_cap_flags |= ice_vc_get_vlan_caps(hw, vf, vsi,
vf->driver_caps);

if (vf->driver_caps & VIRTCHNL_VF_OFFLOAD_RSS_PF) {
vfres->vf_cap_flags |= VIRTCHNL_VF_OFFLOAD_RSS_PF;
Expand Down Expand Up @@ -3529,42 +3552,6 @@ ice_vc_repr_del_mac(struct ice_vf __always_unused *vf, u8 __always_unused *msg)
VIRTCHNL_STATUS_SUCCESS, NULL, 0);
}

static int ice_vc_repr_add_vlan(struct ice_vf *vf, u8 __always_unused *msg)
{
dev_dbg(ice_pf_to_dev(vf->pf),
"Can't add VLAN in switchdev mode for VF %d\n", vf->vf_id);
return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_ADD_VLAN,
VIRTCHNL_STATUS_SUCCESS, NULL, 0);
}

static int ice_vc_repr_del_vlan(struct ice_vf *vf, u8 __always_unused *msg)
{
dev_dbg(ice_pf_to_dev(vf->pf),
"Can't delete VLAN in switchdev mode for VF %d\n", vf->vf_id);
return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_DEL_VLAN,
VIRTCHNL_STATUS_SUCCESS, NULL, 0);
}

static int ice_vc_repr_ena_vlan_stripping(struct ice_vf *vf)
{
dev_dbg(ice_pf_to_dev(vf->pf),
"Can't enable VLAN stripping in switchdev mode for VF %d\n",
vf->vf_id);
return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_ENABLE_VLAN_STRIPPING,
VIRTCHNL_STATUS_ERR_NOT_SUPPORTED,
NULL, 0);
}

static int ice_vc_repr_dis_vlan_stripping(struct ice_vf *vf)
{
dev_dbg(ice_pf_to_dev(vf->pf),
"Can't disable VLAN stripping in switchdev mode for VF %d\n",
vf->vf_id);
return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_DISABLE_VLAN_STRIPPING,
VIRTCHNL_STATUS_ERR_NOT_SUPPORTED,
NULL, 0);
}

static int
ice_vc_repr_cfg_promiscuous_mode(struct ice_vf *vf, u8 __always_unused *msg)
{
Expand All @@ -3591,10 +3578,10 @@ static const struct ice_virtchnl_ops ice_virtchnl_repr_ops = {
.config_rss_lut = ice_vc_config_rss_lut,
.get_stats_msg = ice_vc_get_stats_msg,
.cfg_promiscuous_mode_msg = ice_vc_repr_cfg_promiscuous_mode,
.add_vlan_msg = ice_vc_repr_add_vlan,
.remove_vlan_msg = ice_vc_repr_del_vlan,
.ena_vlan_stripping = ice_vc_repr_ena_vlan_stripping,
.dis_vlan_stripping = ice_vc_repr_dis_vlan_stripping,
.add_vlan_msg = ice_vc_add_vlan_msg,
.remove_vlan_msg = ice_vc_remove_vlan_msg,
.ena_vlan_stripping = ice_vc_ena_vlan_stripping,
.dis_vlan_stripping = ice_vc_dis_vlan_stripping,
.handle_rss_cfg_msg = ice_vc_handle_rss_cfg,
.add_fdir_fltr_msg = ice_vc_add_fdir_fltr,
.del_fdir_fltr_msg = ice_vc_del_fdir_fltr,
Expand Down

0 comments on commit ce1d8e7

Please sign in to comment.