* [PATCH net-next 1/3] bnxt: use netif_is_rxfh_configured instead of open code
2021-10-10 4:03 [PATCH net-next 0/3] net-next: replace open code with helper functions Juhee Kang
@ 2021-10-10 4:03 ` Juhee Kang
2021-10-10 4:03 ` [PATCH net-next 2/3] hv_netvsc: use netif_is_bond_master() " Juhee Kang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Juhee Kang @ 2021-10-10 4:03 UTC (permalink / raw)
To: michael.chan, davem, kuba, kys, haiyangz, sthemmin, wei.liu,
decui, netdev
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.
Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 62f84cc91e4d..b5d92e2d3887 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -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)) {
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 7260910e75fb..fbb56b1f70fd 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/3] hv_netvsc: use netif_is_bond_master() instead of open code
2021-10-10 4:03 [PATCH net-next 0/3] net-next: replace open code with helper functions Juhee Kang
2021-10-10 4:03 ` [PATCH net-next 1/3] bnxt: use netif_is_rxfh_configured instead of open code Juhee Kang
@ 2021-10-10 4:03 ` Juhee Kang
2021-10-10 4:03 ` [PATCH net-next 3/3] mlxsw: spectrum: use netif_is_macsec() " Juhee Kang
2021-10-10 10:30 ` [PATCH net-next 0/3] net-next: replace open code with helper functions patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Juhee Kang @ 2021-10-10 4:03 UTC (permalink / raw)
To: michael.chan, davem, kuba, kys, haiyangz, sthemmin, wei.liu,
decui, netdev
Use 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.
Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
---
drivers/net/hyperv/netvsc_drv.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 382bebc2420d..64e1e99548ba 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -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) {
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 3/3] mlxsw: spectrum: use netif_is_macsec() instead of open code
2021-10-10 4:03 [PATCH net-next 0/3] net-next: replace open code with helper functions Juhee Kang
2021-10-10 4:03 ` [PATCH net-next 1/3] bnxt: use netif_is_rxfh_configured instead of open code Juhee Kang
2021-10-10 4:03 ` [PATCH net-next 2/3] hv_netvsc: use netif_is_bond_master() " Juhee Kang
@ 2021-10-10 4:03 ` Juhee Kang
2021-10-10 10:30 ` [PATCH net-next 0/3] net-next: replace open code with helper functions patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Juhee Kang @ 2021-10-10 4:03 UTC (permalink / raw)
To: michael.chan, davem, kuba, kys, haiyangz, sthemmin, wei.liu,
decui, netdev
Open 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.
Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
---
include/linux/netdevice.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d79163208dfd..9192544fe356 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -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;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/3] net-next: replace open code with helper functions
2021-10-10 4:03 [PATCH net-next 0/3] net-next: replace open code with helper functions Juhee Kang
` (2 preceding siblings ...)
2021-10-10 4:03 ` [PATCH net-next 3/3] mlxsw: spectrum: use netif_is_macsec() " Juhee Kang
@ 2021-10-10 10:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-10 10:30 UTC (permalink / raw)
To: Juhee Kang
Cc: michael.chan, davem, kuba, kys, haiyangz, sthemmin, wei.liu,
decui, netdev
Hello:
This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
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_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.
>
> [...]
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
^ permalink raw reply [flat|nested] 5+ messages in thread