Skip to content

Commit 9536c2f

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-08-21 (ice) This series contains updates to ice driver only. Jesse fixes an issue on calculating buffer size. Petr Oros reverts a commit that does not fully resolve VF reset issues and implements one that provides a fuller fix. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: Fix NULL pointer deref during VF reset Revert "ice: Fix ice VF reset during iavf initialization" ice: fix receive buffer size miscalculation ==================== Link: https://lore.kernel.org/r/20230821171633.2203505-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents c8777fa + 67f6317 commit 9536c2f

5 files changed

Lines changed: 14 additions & 33 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ static int ice_setup_rx_ctx(struct ice_rx_ring *ring)
435435
/* Receive Packet Data Buffer Size.
436436
* The Packet Data Buffer Size is defined in 128 byte units.
437437
*/
438-
rlan_ctx.dbuf = ring->rx_buf_len >> ICE_RLAN_CTX_DBUF_S;
438+
rlan_ctx.dbuf = DIV_ROUND_UP(ring->rx_buf_len,
439+
BIT_ULL(ICE_RLAN_CTX_DBUF_S));
439440

440441
/* use 32 byte descriptors */
441442
rlan_ctx.dsize = 1;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)
11311131
if (!vf)
11321132
return -EINVAL;
11331133

1134-
ret = ice_check_vf_ready_for_reset(vf);
1134+
ret = ice_check_vf_ready_for_cfg(vf);
11351135
if (ret)
11361136
goto out_put_vf;
11371137

@@ -1246,7 +1246,7 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
12461246
goto out_put_vf;
12471247
}
12481248

1249-
ret = ice_check_vf_ready_for_reset(vf);
1249+
ret = ice_check_vf_ready_for_cfg(vf);
12501250
if (ret)
12511251
goto out_put_vf;
12521252

@@ -1300,7 +1300,7 @@ int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted)
13001300
return -EOPNOTSUPP;
13011301
}
13021302

1303-
ret = ice_check_vf_ready_for_reset(vf);
1303+
ret = ice_check_vf_ready_for_cfg(vf);
13041304
if (ret)
13051305
goto out_put_vf;
13061306

@@ -1613,7 +1613,7 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,
16131613
if (!vf)
16141614
return -EINVAL;
16151615

1616-
ret = ice_check_vf_ready_for_reset(vf);
1616+
ret = ice_check_vf_ready_for_cfg(vf);
16171617
if (ret)
16181618
goto out_put_vf;
16191619

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

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,6 @@ int ice_check_vf_ready_for_cfg(struct ice_vf *vf)
185185
return 0;
186186
}
187187

188-
/**
189-
* ice_check_vf_ready_for_reset - check if VF is ready to be reset
190-
* @vf: VF to check if it's ready to be reset
191-
*
192-
* The purpose of this function is to ensure that the VF is not in reset,
193-
* disabled, and is both initialized and active, thus enabling us to safely
194-
* initialize another reset.
195-
*/
196-
int ice_check_vf_ready_for_reset(struct ice_vf *vf)
197-
{
198-
int ret;
199-
200-
ret = ice_check_vf_ready_for_cfg(vf);
201-
if (!ret && !test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states))
202-
ret = -EAGAIN;
203-
204-
return ret;
205-
}
206-
207188
/**
208189
* ice_trigger_vf_reset - Reset a VF on HW
209190
* @vf: pointer to the VF structure
@@ -631,11 +612,17 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)
631612
return 0;
632613
}
633614

615+
if (flags & ICE_VF_RESET_LOCK)
616+
mutex_lock(&vf->cfg_lock);
617+
else
618+
lockdep_assert_held(&vf->cfg_lock);
619+
634620
if (ice_is_vf_disabled(vf)) {
635621
vsi = ice_get_vf_vsi(vf);
636622
if (!vsi) {
637623
dev_dbg(dev, "VF is already removed\n");
638-
return -EINVAL;
624+
err = -EINVAL;
625+
goto out_unlock;
639626
}
640627
ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id);
641628

@@ -644,14 +631,9 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)
644631

645632
dev_dbg(dev, "VF is already disabled, there is no need for resetting it, telling VM, all is fine %d\n",
646633
vf->vf_id);
647-
return 0;
634+
goto out_unlock;
648635
}
649636

650-
if (flags & ICE_VF_RESET_LOCK)
651-
mutex_lock(&vf->cfg_lock);
652-
else
653-
lockdep_assert_held(&vf->cfg_lock);
654-
655637
/* Set VF disable bit state here, before triggering reset */
656638
set_bit(ICE_VF_STATE_DIS, vf->vf_states);
657639
ice_trigger_vf_reset(vf, flags & ICE_VF_RESET_VFLR, false);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ u16 ice_get_num_vfs(struct ice_pf *pf);
215215
struct ice_vsi *ice_get_vf_vsi(struct ice_vf *vf);
216216
bool ice_is_vf_disabled(struct ice_vf *vf);
217217
int ice_check_vf_ready_for_cfg(struct ice_vf *vf);
218-
int ice_check_vf_ready_for_reset(struct ice_vf *vf);
219218
void ice_set_vf_state_dis(struct ice_vf *vf);
220219
bool ice_is_any_vf_in_unicast_promisc(struct ice_pf *pf);
221220
void

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3947,7 +3947,6 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event,
39473947
ice_vc_notify_vf_link_state(vf);
39483948
break;
39493949
case VIRTCHNL_OP_RESET_VF:
3950-
clear_bit(ICE_VF_STATE_ACTIVE, vf->vf_states);
39513950
ops->reset_vf(vf);
39523951
break;
39533952
case VIRTCHNL_OP_ADD_ETH_ADDR:

0 commit comments

Comments
 (0)