net-next: replace open code with helper functions
Subsystems (4)
cover net-next: replace open code with helper functions
Currently, there are many helper functions on netdevice.h. However, some code doesn't use the helper functions and remains open code. So this patchset replaces open code with an appropriate helper function.
First patch modifies to use netif_is_rxfh_configured instead of dev->priv_flags & IFF_RXFH_CONFIGURED.
Second patch replaces open code with netif_is_bond_master. Last patch substitutes netif_is_macsec() for dev->priv_flags & IFF_MACSEC.
Juhee Kang (3):
bnxt: use netif_is_rxfh_configured instead of open code
hv_netvsc: use netif_is_bond_master() instead of open code
mlxsw: spectrum: use netif_is_macsec() instead of open code
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- drivers/net/hyperv/netvsc_drv.c | 3 +-- include/linux/netdevice.h | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/3 bnxt: use netif_is_rxfh_configured instead of open code
The open code which is dev->priv_flags & IFF_RXFH_CONFIGURED is defined as a helper function on netdevice.h. So use netif_is_rxfh_configured() function instead of open code. This patch doesn't change logic.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -6366,7 +6366,7 @@ static int __bnxt_reserve_rings(struct bnxt *bp)if (rx_rings != bp->rx_nr_rings) {netdev_warn (bp->dev,"Able to reserve only %d out of %d requested RX rings\n" , rx_rings, bp->rx_nr_rings); -if ((bp->dev->priv_flags &IFF_RXFH_CONFIGURED ) && +if (netif_is_rxfh_configured (bp->dev) && (bnxt_get_nr_rss_ctxs (bp, bp->rx_nr_rings) !=bnxt_get_nr_rss_ctxs (bp, rx_rings) ||bnxt_get_max_rss_ring (bp) >= rx_rings)) {
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 -1
@@ -909,7 +909,7 @@ static int bnxt_set_channels(struct net_device *dev,if (bnxt_get_nr_rss_ctxs (bp, req_rx_rings) !=bnxt_get_nr_rss_ctxs (bp, bp->rx_nr_rings) && - (dev->priv_flags &IFF_RXFH_CONFIGURED )) { +netif_is_rxfh_configured (dev)) {netdev_warn (dev,"RSS table size change required, RSS table entries must be default to proceed\n" );return -EINVAL ; }
Signature · 1 line
2.25.1
PATCH 2/3 hv_netvsc: use netif_is_bond_master() instead of open code
In reply to Juhee KangUse netif_is_bond_master() function instead of open code, which is ((event_dev->priv_flags & IFF_BONDING) && (event_dev->flags & IFF_MASTER)). This patch doesn't change logic.
--- drivers/net/hyperv/netvsc_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/hyperv/netvsc_drv.c +1 -2
@@ -2742,8 +2742,7 @@ static int netvsc_netdev_event(struct notifier_block *this,return NOTIFY_DONE ;/* Avoid Bonding master dev with same MAC registering as VF */ -if ((event_dev->priv_flags &IFF_BONDING ) && - (event_dev->flags &IFF_MASTER )) +if (netif_is_bond_master (event_dev))return NOTIFY_DONE ;switch (event) {
Signature · 1 line
2.25.1
PATCH 3/3 mlxsw: spectrum: use netif_is_macsec() instead of open code
In reply to Juhee KangOpen code which is dev->priv_flags & IFF_MACSEC has already defined as netif_is_macsec(). So use netif_is_macsec() instead of open code. This patch doesn't change logic.
--- include/linux/netdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/netdevice.h +1 -1
@@ -5236,7 +5236,7 @@ static inline void netif_keep_dst(struct net_device *dev)static inline bool netif_reduces_vlan_mtu (struct net_device *dev) {/* TODO: reserve and use an additional IFF bit, if we get more users */ -return dev->priv_flags &IFF_MACSEC ; +return netif_is_macsec (dev); }extern struct pernet_operations __net_initdata loopback_net_ops;
Signature · 1 line
2.25.1
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 10 lines · On Sun, 10 Oct 2021 13:03:26 +0900 you wrote:
Currently, there are many helper functions on
netdevice.h. However, some code doesn't use the helper functions and remains open code. So this patchset replaces open code with an appropriate helper function.First patch modifies to use
netif_is_rxfh_configuredinstead ofdev->priv_flags&IFF_RXFH_CONFIGURED.
Second patch replaces open code withnetif_is_bond_master. Last patch substitutesnetif_is_macsec()fordev->priv_flags&IFF_MACSEC.[...]
Here is the summary with links:
- [net-next,1/3] bnxt: use netif_is_rxfh_configured instead of open code
https://git.kernel.org/netdev/net-next/c/4b70dce2c1b9 - [net-next,2/3] hv_netvsc: use netif_is_bond_master() instead of open code https://git.kernel.org/netdev/net-next/c/c60882a4566a - [net-next,3/3] mlxsw: spectrum: use netif_is_macsec() instead of open code https://git.kernel.org/netdev/net-next/c/019921521697
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html