mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
net: stmmac: xgmac: fix l4 filter port overwrite on register update
The XGMAC_L4_ADDR register holds both source and destination port
match values. The current implementation overwrites the entire register
when configuring either port, so setting one silently erases the other.
Fix this by reading the register first, then masking and updating only
the relevant field before writing back.
Fixes: 425eabddaf ("net: stmmac: Implement L3/L4 Filters using TC Flower")
Signed-off-by: Rohan G Thomas <rohan.g.thomas@altera.com>
Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20260714023716.29865-3-muhammad.nazim.amirul.nazle.asmade@altera.com
Reviewed-by: Jakub Raczynski <j.raczynski@samsung.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
980a813452
commit
9fcf274d93
|
|
@ -1370,36 +1370,40 @@ static int dwxgmac2_config_l4_filter(struct mac_device_info *hw, u32 filter_no,
|
|||
value &= ~XGMAC_L4PEN0;
|
||||
}
|
||||
|
||||
value &= ~(XGMAC_L4SPM0 | XGMAC_L4SPIM0);
|
||||
value &= ~(XGMAC_L4DPM0 | XGMAC_L4DPIM0);
|
||||
if (sa) {
|
||||
value |= XGMAC_L4SPM0;
|
||||
if (inv)
|
||||
value |= XGMAC_L4SPIM0;
|
||||
else
|
||||
value &= ~XGMAC_L4SPIM0;
|
||||
} else {
|
||||
value |= XGMAC_L4DPM0;
|
||||
if (inv)
|
||||
value |= XGMAC_L4DPIM0;
|
||||
else
|
||||
value &= ~XGMAC_L4DPIM0;
|
||||
}
|
||||
|
||||
ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L3L4_CTRL, value);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = dwxgmac2_filter_read(hw, filter_no, XGMAC_L4_ADDR, &value);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (sa) {
|
||||
value = FIELD_PREP(XGMAC_L4SP0, match);
|
||||
|
||||
ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L4_ADDR, value);
|
||||
if (ret)
|
||||
return ret;
|
||||
value &= ~XGMAC_L4SP0;
|
||||
value |= FIELD_PREP(XGMAC_L4SP0, match);
|
||||
} else {
|
||||
value = FIELD_PREP(XGMAC_L4DP0, match);
|
||||
|
||||
ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L4_ADDR, value);
|
||||
if (ret)
|
||||
return ret;
|
||||
value &= ~XGMAC_L4DP0;
|
||||
value |= FIELD_PREP(XGMAC_L4DP0, match);
|
||||
}
|
||||
|
||||
ret = dwxgmac2_filter_write(hw, filter_no, XGMAC_L4_ADDR, value);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!en)
|
||||
return dwxgmac2_filter_write(hw, filter_no, XGMAC_L3L4_CTRL, 0);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user