Skip to contentSkip to conversation

Add linkmode_fill, use linkmode_*() in phylink/sfp code

PATCH Applied Russell King (Oracle) 4 participants 8 messages Nov 15, 2023 – Nov 16, 2023

Subsystems (4)
lore
Share & tools
lore

Russell King (Oracle)

author maintainer
#0 lore raw

cover Add linkmode_fill, use linkmode_*() in phylink/sfp code

Hi,

This small series adds a linkmode_fill() op, and uses it in phylink. The SFP code is also converted to use linkmode_*() ops.

 drivers/net/phy/phylink.c | 4 ++--
 drivers/net/phy/sfp-bus.c | 2 +-
 include/linux/linkmode.h  | 5 +++++
 3 files changed, 8 insertions(+), 3 deletions(-)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#1 lore raw

PATCH 1/3 net: linkmode: add linkmode_fill() helper

Add a linkmode_fill() helper, which will allow us to convert phylink's open coded bitmap_fill() operations.

---
 include/linux/linkmode.h | 5 +++++
 1 file changed, 5 insertions(+)
include/linux/linkmode.h +5 -0
index 7303b4bc2ce0..287f590ed56b 100644
@@ -10,6 +10,11 @@ static inline void linkmode_zero(unsigned long *dst)
 	bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS);
 }
 
+static inline void linkmode_fill(unsigned long *dst)
+{
+	bitmap_fill(dst, __ETHTOOL_LINK_MODE_MASK_NBITS);
+}
+
 static inline void linkmode_copy(unsigned long *dst, const unsigned long *src)
 {
 	bitmap_copy(dst, src, __ETHTOOL_LINK_MODE_MASK_NBITS);
Signature · 1 line
2.30.2
#3 lore raw

PATCH 2/3 net: phylink: use linkmode_fill()

In reply to Russell King (Oracle)

Use linkmode_fill() rather than open coding the bitmap operation.

---
 drivers/net/phy/phylink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/phylink.c +2 -2
index 25c19496a336..d2fa949ff1ea 100644
@@ -805,7 +805,7 @@ static int phylink_parse_fixedlink(struct phylink *pl,
 		phylink_warn(pl, "fixed link specifies half duplex for %dMbps link?\n",
 			     pl->link_config.speed);
 
-	bitmap_fill(pl->supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+	linkmode_fill(pl->supported);
 	linkmode_copy(pl->link_config.advertising, pl->supported);
 	phylink_validate(pl, pl->supported, &pl->link_config);
 
@@ -1640,7 +1640,7 @@ struct phylink *phylink_create(struct phylink_config *config,
 	__set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
 	timer_setup(&pl->link_poll, phylink_fixed_poll, 0);
 
-	bitmap_fill(pl->supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
+	linkmode_fill(pl->supported);
 	linkmode_copy(pl->link_config.advertising, pl->supported);
 	phylink_validate(pl, pl->supported, &pl->link_config);
 
Signature · 1 line
2.30.2
#5 lore raw

PATCH 3/3 net: sfp: use linkmode_*() rather than open coding

In reply to Russell King (Oracle)

Use the linkmode_*() helpers rather than open coding the calls to the bitmap operators.

---
 drivers/net/phy/sfp-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/sfp-bus.c +1 -1
index 208a9393c2df..6fa679b36290 100644
@@ -328,7 +328,7 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
 	 * modules use 2500Mbaud rather than 3100 or 3200Mbaud for
 	 * 2500BASE-X, so we allow some slack here.
 	 */
-	if (bitmap_empty(modes, __ETHTOOL_LINK_MODE_MASK_NBITS) && br_nom) {
+	if (linkmode_empty(modes) && br_nom) {
 		if (br_min <= 1300 && br_max >= 1200) {
 			phylink_set(modes, 1000baseX_Full);
 			__set_bit(PHY_INTERFACE_MODE_1000BASEX, interfaces);
Signature · 1 line
2.30.2
#7 lore raw
In reply to Russell King (Oracle)
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 9 lines · On Wed, 15 Nov 2023 11:39:05 +0000 you wrote:

Hi,

This small series adds a linkmode_fill() op, and uses it in phylink. The SFP code is also converted to use linkmode_*() ops.

 drivers/net/phy/phylink.c | 4 ++--
 drivers/net/phy/sfp-bus.c | 2 +-
 include/linux/linkmode.h  | 5 +++++
 3 files changed, 8 insertions(+), 3 deletions(-)

Here is the summary with links:
- [net-next,1/3] net: linkmode: add linkmode_fill() helper

    https://git.kernel.org/netdev/net-next/c/96fa96e198f9
  - [net-next,2/3] net: phylink: use linkmode_fill()
    https://git.kernel.org/netdev/net-next/c/ba50a8d40258
  - [net-next,3/3] net: sfp: use linkmode_*() rather than open coding
    https://git.kernel.org/netdev/net-next/c/466b97b1871a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html