]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: use netif_is_bridge_port() to check for IFF_BRIDGE_PORT
authorJulian Wiedmann <jwi@linux.ibm.com>
Thu, 20 Feb 2020 08:00:07 +0000 (09:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Nov 2021 18:46:15 +0000 (19:46 +0100)
[ Upstream commit 2e92a2d0e450740ebe7e7a816162327ad1fde94b ]

Trivial cleanup, so that all bridge port-specific code can be found in
one go.

CC: Johannes Berg <johannes@sipsolutions.net>
CC: Roopa Prabhu <roopa@cumulusnetworks.com>
CC: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/bonding/bond_main.c
drivers/net/ethernet/micrel/ksz884x.c
net/core/rtnetlink.c
net/wireless/nl80211.c
net/wireless/util.c

index 1949f631e1bc50ae8fd55a49bdfba0391aac34e8..a7eaf80f500c0b41af0cf17cc1e830d314be2144 100644 (file)
@@ -1219,7 +1219,7 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
        skb->dev = bond->dev;
 
        if (BOND_MODE(bond) == BOND_MODE_ALB &&
-           bond->dev->priv_flags & IFF_BRIDGE_PORT &&
+           netif_is_bridge_port(bond->dev) &&
            skb->pkt_type == PACKET_HOST) {
 
                if (unlikely(skb_cow_head(skb,
index 7dc451fdaf35eba05b23f64a5360e18ea2cddcc2..2431723bc2fb41be4944a9b0cbe3be306af2b1b3 100644 (file)
@@ -5693,7 +5693,7 @@ static void dev_set_promiscuous(struct net_device *dev, struct dev_priv *priv,
                 * from the bridge.
                 */
                if ((hw->features & STP_SUPPORT) && !promiscuous &&
-                   (dev->priv_flags & IFF_BRIDGE_PORT)) {
+                   netif_is_bridge_port(dev)) {
                        struct ksz_switch *sw = hw->ksz_switch;
                        int port = priv->port.first_port;
 
index a53b101ce41ae6470b793c0fce6e7b079f8fc69b..55c0f32b9375be77c5826992754fe9d44ae6d13a 100644 (file)
@@ -3729,7 +3729,7 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
 
        /* Support fdb on master device the net/bridge default case */
        if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) &&
-           (dev->priv_flags & IFF_BRIDGE_PORT)) {
+           netif_is_bridge_port(dev)) {
                struct net_device *br_dev = netdev_master_upper_dev_get(dev);
                const struct net_device_ops *ops = br_dev->netdev_ops;
 
@@ -3840,7 +3840,7 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
 
        /* Support fdb on master device the net/bridge default case */
        if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) &&
-           (dev->priv_flags & IFF_BRIDGE_PORT)) {
+           netif_is_bridge_port(dev)) {
                struct net_device *br_dev = netdev_master_upper_dev_get(dev);
                const struct net_device_ops *ops = br_dev->netdev_ops;
 
@@ -4066,13 +4066,13 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
                                continue;
 
                        if (!br_idx) { /* user did not specify a specific bridge */
-                               if (dev->priv_flags & IFF_BRIDGE_PORT) {
+                               if (netif_is_bridge_port(dev)) {
                                        br_dev = netdev_master_upper_dev_get(dev);
                                        cops = br_dev->netdev_ops;
                                }
                        } else {
                                if (dev != br_dev &&
-                                   !(dev->priv_flags & IFF_BRIDGE_PORT))
+                                   !netif_is_bridge_port(dev))
                                        continue;
 
                                if (br_dev != netdev_master_upper_dev_get(dev) &&
@@ -4084,7 +4084,7 @@ static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
                        if (idx < s_idx)
                                goto cont;
 
-                       if (dev->priv_flags & IFF_BRIDGE_PORT) {
+                       if (netif_is_bridge_port(dev)) {
                                if (cops && cops->ndo_fdb_dump) {
                                        err = cops->ndo_fdb_dump(skb, cb,
                                                                br_dev, dev,
@@ -4234,7 +4234,7 @@ static int rtnl_fdb_get(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 
        if (dev) {
                if (!ndm_flags || (ndm_flags & NTF_MASTER)) {
-                       if (!(dev->priv_flags & IFF_BRIDGE_PORT)) {
+                       if (!netif_is_bridge_port(dev)) {
                                NL_SET_ERR_MSG(extack, "Device is not a bridge port");
                                return -EINVAL;
                        }
index 7b170ed6923e7e51678799d7ec057dda162724a3..7633d6a74bc2bc1bf99b3a7e997709dc3ee2ff5c 100644 (file)
@@ -3480,7 +3480,7 @@ static int nl80211_valid_4addr(struct cfg80211_registered_device *rdev,
                               enum nl80211_iftype iftype)
 {
        if (!use_4addr) {
-               if (netdev && (netdev->priv_flags & IFF_BRIDGE_PORT))
+               if (netdev && netif_is_bridge_port(netdev))
                        return -EBUSY;
                return 0;
        }
index f0247eab5bc943e0570cdca815724463c155fbe7..82b3baed2c7dd8231034f43f8e3449d52068a6b5 100644 (file)
@@ -976,7 +976,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
                return -EOPNOTSUPP;
 
        /* if it's part of a bridge, reject changing type to station/ibss */
-       if ((dev->priv_flags & IFF_BRIDGE_PORT) &&
+       if (netif_is_bridge_port(dev) &&
            (ntype == NL80211_IFTYPE_ADHOC ||
             ntype == NL80211_IFTYPE_STATION ||
             ntype == NL80211_IFTYPE_P2P_CLIENT))