From: 'Simon Horman' <[email protected]>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev
Simon says:
I would also like to add that as a fix the patch description should
describe the user-visible effects of the bug, and how the fix addresses
them.
Thanks!
---
ice: add correct handling of SMA/u.FL states
This commit renames ICE_SMA2_UFL2_RX_DIS to ICE_SMA2_UFL2_RX_EN, stating that
the hardware bit is actually active high for enabling RX. It updates the uses
of the macro in ice_dpll.c to reflect the new name.
> The ICE_SMA2_UFL2_RX_DIS bit name is wrong: the bit is active high
> (setting it *enables* RX for u.FL2 / SMA2), not active low. Rename
> it to ICE_SMA2_UFL2_RX_EN and invert the use sites in ice_dpll.c so
> that enabling the u.FL2 pin clears the bit (as it used to do) and
> disabling sets it.
The commit message claims that setting the bit enables RX (active high), but
then states that enabling the pin clears the bit (active low). Could this
description be clarified to explain exactly whether the hardware uses active
high or active low logic?
> diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.c
> b/drivers/net/ethernet/intel/ice/ice_dpll.c
> index 62f75701d6520..7e8bb63b262a0 100644
> --- a/drivers/net/ethernet/intel/ice/ice_dpll.c
> +++ b/drivers/net/ethernet/intel/ice/ice_dpll.c
> @@ -672,7 +672,7 @@ ice_dpll_sw_pins_update(struct ice_pf *pf)
> p->active = false;
>
> p = &d->ufl[ICE_DPLL_PIN_SW_2_IDX];
> - p->active = (data & ICE_SMA2_DIR_EN) && !(data & ICE_SMA2_UFL2_RX_DIS);
> + p->active = (data & ICE_SMA2_DIR_EN) && !(data & ICE_SMA2_UFL2_RX_EN);
If the bit is renamed to an _EN suffix and is active high, should the logic be
inverted here? This code still treats the bit as active low by checking for it
being cleared (!(data & ICE_SMA2_UFL2_RX_EN)).
[ ... ]
> @@ -1264,10 +1264,10 @@ ice_dpll_ufl_pin_state_set(const struct dpll_pin
> *pin, void *pin_priv,
> case ICE_DPLL_PIN_SW_2_IDX:
> if (state == DPLL_PIN_STATE_SELECTABLE) {
> data |= ICE_SMA2_DIR_EN;
> - data &= ~ICE_SMA2_UFL2_RX_DIS;
> + data &= ~ICE_SMA2_UFL2_RX_EN;
> enable = true;
> } else if (state == DPLL_PIN_STATE_DISCONNECTED) {
> - data |= ICE_SMA2_UFL2_RX_DIS;
> + data |= ICE_SMA2_UFL2_RX_EN;
> enable = false;
> } else {
Similarly, does this code still apply active low logic by clearing the _EN bit
when enable is true, and setting it when enable is false?
If the bit is truly active high as the commit message suggests ("setting it
enables RX"), shouldn't the bitwise operations be inverted to match?