On Wednesday, 3 June 2026 06:28:59 CEST Sven Eckelmann wrote:
> This RFC is on purpose not Signed-off-by

Looks like I forgot to mark it as an RFC. Anyway, just consider it an RFC to 
get the discussion started again and make sure that both sides are ok with the 
adjustments.

Please make sure that this is not yet an endorsement of this specific version 
of the patchset. I still have to sit down again and make sure that it makes 
sense (tm). But I am at least convinced at the moment that the idea behind the 
patchset is good.

> I will later post an range-diff which contains all the changes.

git range-diff v2025.3..ecsv/schiffer-netdev-orig 
3f5b367f76482a714b4263bf2b1bddb0d49831ca..6b1570a75d32eceb827d5dd826681126205f87de

See v1-v2.rdiff. Please double check that I actually addressed my old 
comments.

Regards,
        Sven
1:  cfcf1328 < -:  -------- batman-adv: store hard_iface as iflink private data
-:  -------- > 1:  0c1926bf batman-adv: tt: directly retrieve wifi flags of 
net_device
2:  d97e5558 ! 2:  add14bf4 batman-adv: only create hardif while a netdev is 
part of a mesh
    @@
      ## Metadata ##
    -Author: Matthias Schiffer <[email protected]>
    +Author: Nora Schiffer <[email protected]>
     
      ## Commit message ##
         batman-adv: only create hardif while a netdev is part of a mesh
    @@ Commit message
         batadv_hardif_enable_interface(), and batadv_hardif_remove_interface()
         can be dropped altogether.
     
    -    Signed-off-by: Matthias Schiffer <[email protected]>
    -
      ## net/batman-adv/hard-interface.c ##
     @@ net/batman-adv/hard-interface.c: 
batadv_hardif_deactivate_interface(struct batadv_hard_iface *hard_iface)
      }
    @@ net/batman-adv/hard-interface.c: 
batadv_hardif_deactivate_interface(struct batad
     +  struct batadv_hard_iface *hard_iface;
        unsigned int required_mtu;
        unsigned int hardif_mtu;
    +   bool fragmentation;
        int ret;
      
    +-  hardif_mtu = READ_ONCE(hard_iface->net_dev->mtu);
     +  ASSERT_RTNL();
     +
     +  if (!batadv_is_valid_iface(net_dev))
     +          return -EINVAL;
     +
    -+  hard_iface = kzalloc(sizeof(*hard_iface), GFP_ATOMIC);
    ++  hardif_mtu = READ_ONCE(net_dev->mtu);
    +   required_mtu = READ_ONCE(mesh_iface->mtu) + max_header_len;
    + 
    +   if (hardif_mtu < ETH_MIN_MTU + max_header_len)
    +           return -EINVAL;
    + 
    +-  if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
    +-          goto out;
    ++  hard_iface = kzalloc_obj(*hard_iface, GFP_ATOMIC);
     +  if (!hard_iface)
     +          return -ENOMEM;
     +
    @@ net/batman-adv/hard-interface.c: 
batadv_hardif_deactivate_interface(struct batad
     +  kref_init(&hard_iface->refcount);
     +
     +  hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT;
    -+  hard_iface->wifi_flags = batadv_wifi_flags_evaluate(net_dev);
     +  if (batadv_is_wifi_hardif(hard_iface))
     +          hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
     +
    -+  atomic_set(&hard_iface->hop_penalty, 0);
    ++  WRITE_ONCE(hard_iface->hop_penalty, 0);
     +
     +  batadv_v_hardif_init(hard_iface);
    -+
    -+  kref_get(&hard_iface->refcount);
    + 
    +   kref_get(&hard_iface->refcount);
     +  list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
     +  batadv_hardif_generation++;
    -+
    -   hardif_mtu = READ_ONCE(hard_iface->net_dev->mtu);
    -   required_mtu = READ_ONCE(mesh_iface->mtu) + max_header_len;
    - 
    --  if (hardif_mtu < ETH_MIN_MTU + max_header_len)
    --          return -EINVAL;
    --
    --  if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
    --          goto out;
    --
    --  kref_get(&hard_iface->refcount);
    -+  if (hardif_mtu < ETH_MIN_MTU + max_header_len) {
    -+          ret = -EINVAL;
    -+          goto err_put;
    -+  }
      
        netdev_hold(mesh_iface, &hard_iface->meshif_dev_tracker, GFP_ATOMIC);
        hard_iface->mesh_iface = mesh_iface;
    @@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct batad
      
     -  hard_iface->if_status = BATADV_IF_INACTIVE;
     -
    --  kref_get(&hard_iface->refcount);
    +   kref_get(&hard_iface->refcount);
        hard_iface->batman_adv_ptype.type = ethertype;
        hard_iface->batman_adv_ptype.func = batadv_batman_skb_recv;
    -   hard_iface->batman_adv_ptype.dev = hard_iface->net_dev;
     @@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
        if (bat_priv->algo_ops->iface.enabled)
                bat_priv->algo_ops->iface.enabled(hard_iface);
    @@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct batad
        return 0;
      
      err_upper:
    -@@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
    - err_dev:
    -   hard_iface->mesh_iface = NULL;
    -   netdev_put(mesh_iface, &hard_iface->meshif_dev_tracker);
    -+err_put:
    -   batadv_hardif_put(hard_iface);
    -   return ret;
    - }
     @@ net/batman-adv/hard-interface.c: void 
batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
        struct batadv_priv *bat_priv = netdev_priv(hard_iface->mesh_iface);
        struct batadv_hard_iface *primary_if = NULL;
    @@ net/batman-adv/hard-interface.c: void 
batadv_hardif_disable_interface(struct bat
                goto out;
      
     +  list_del_rcu(&hard_iface->list);
    ++  batadv_hardif_put(hard_iface);
     +  batadv_hardif_generation++;
     +
        batadv_info(hard_iface->mesh_iface, "Removing interface: %s\n",
    @@ net/batman-adv/hard-interface.c: void 
batadv_hardif_disable_interface(struct bat
     -  if (!batadv_is_valid_iface(net_dev))
     -          return NULL;
     -
    --  hard_iface = kzalloc(sizeof(*hard_iface), GFP_ATOMIC);
    +-  hard_iface = kzalloc_obj(*hard_iface, GFP_ATOMIC);
     -  if (!hard_iface)
     -          return NULL;
     -
    @@ net/batman-adv/hard-interface.c: void 
batadv_hardif_disable_interface(struct bat
     -  kref_init(&hard_iface->refcount);
     -
     -  hard_iface->num_bcasts = BATADV_NUM_BCASTS_DEFAULT;
    --  hard_iface->wifi_flags = batadv_wifi_flags_evaluate(net_dev);
     -  if (batadv_is_wifi_hardif(hard_iface))
     -          hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
     -
    --  atomic_set(&hard_iface->hop_penalty, 0);
    +-  WRITE_ONCE(hard_iface->hop_penalty, 0);
     -
     -  batadv_v_hardif_init(hard_iface);
     -
    @@ net/batman-adv/hard-interface.c: void 
batadv_hardif_disable_interface(struct bat
       * batadv_hard_if_event_meshif() - Handle events for mesh interfaces
       * @event: NETDEV_* event to handle
     @@ net/batman-adv/hard-interface.c: static int batadv_hard_if_event(struct 
notifier_block *this,
    -           return batadv_hard_if_event_meshif(event, net_dev);
    +   batadv_wifi_net_device_event(event, net_dev);
      
        hard_iface = batadv_hardif_get_by_netdev(net_dev);
     -  if (!hard_iface && (event == NETDEV_REGISTER ||
    @@ net/batman-adv/hard-interface.c: static int batadv_hard_if_event(struct 
notifier
                if (hard_iface->mesh_iface)
     
      ## net/batman-adv/hard-interface.h ##
    -@@ net/batman-adv/hard-interface.h: bool batadv_is_cfg80211_hardif(struct 
batadv_hard_iface *hard_iface);
    +@@ net/batman-adv/hard-interface.h: u32 
batadv_hardif_get_wifi_flags(struct batadv_hard_iface *hard_iface);
      bool batadv_is_wifi_hardif(struct batadv_hard_iface *hard_iface);
      struct batadv_hard_iface*
      batadv_hardif_get_by_netdev(const struct net_device *net_dev);
3:  61023efc ! 3:  9f62d7ce batman-adv: remove BATADV_IF_NOT_IN_USE hardif state
    @@
      ## Metadata ##
    -Author: Matthias Schiffer <[email protected]>
    +Author: Nora Schiffer <[email protected]>
     
      ## Commit message ##
         batman-adv: remove BATADV_IF_NOT_IN_USE hardif state
    @@ Commit message
         With hardifs only existing while an interface is part of a mesh, the
         BATADV_IF_NOT_IN_USE state has become redundant.
     
    -    Signed-off-by: Matthias Schiffer <[email protected]>
    -    Acked-by: Sven Eckelmann <[email protected]>
    -
      ## net/batman-adv/bat_iv_ogm.c ##
     @@ net/batman-adv/bat_iv_ogm.c: static void 
batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface)
      
4:  aaa80559 ! 4:  f35d12ce batman-adv: remove global hardif list
    @@
      ## Metadata ##
    -Author: Matthias Schiffer <[email protected]>
    +Author: Nora Schiffer <[email protected]>
     
      ## Commit message ##
         batman-adv: remove global hardif list
    @@ Commit message
         use netdev_master_upper_dev_get()+netdev_lower_dev_get_private() to 
find
         the hardif corresponding to a netdev.
     
    -    Signed-off-by: Matthias Schiffer <[email protected]>
    -
      ## net/batman-adv/hard-interface.c ##
    +@@ net/batman-adv/hard-interface.c: void batadv_hardif_release(struct kref 
*ref)
    +   struct batadv_hard_iface *hard_iface;
    + 
    +   hard_iface = container_of(ref, struct batadv_hard_iface, refcount);
    ++  netdev_put(hard_iface->mesh_iface, &hard_iface->meshif_dev_tracker);
    +   netdev_put(hard_iface->net_dev, &hard_iface->dev_tracker);
    + 
    +   kfree_rcu(hard_iface, rcu);
     @@ net/batman-adv/hard-interface.c: void batadv_hardif_release(struct kref 
*ref)
       * Return: batadv_hard_iface of net_dev (with increased refcnt), NULL on 
errors
       */
    @@ net/batman-adv/hard-interface.c: void batadv_hardif_release(struct kref 
*ref)
     -              kref_get_unless_zero(&hard_iface->refcount))
     -                  goto out;
     -  }
    ++  ASSERT_RTNL();
    + 
    +-  hard_iface = NULL;
     +  mesh_iface = netdev_master_upper_dev_get(net_dev);
     +  if (!mesh_iface || !batadv_meshif_is_valid(mesh_iface))
     +          return NULL;
    - 
    --  hard_iface = NULL;
    ++
     +  hard_iface = netdev_lower_dev_get_private(mesh_iface, net_dev);
     +  if (!kref_get_unless_zero(&hard_iface->refcount))
     +          return NULL;
    @@ net/batman-adv/hard-interface.c: void batadv_hardif_release(struct kref 
*ref)
      }
      
     @@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct net_device *net_dev,
    -   hard_iface->mesh_iface = NULL;
    +   netdev_hold(net_dev, &hard_iface->dev_tracker, GFP_ATOMIC);
    +   hard_iface->net_dev = net_dev;
    + 
    +-  hard_iface->mesh_iface = NULL;
        hard_iface->if_status = BATADV_IF_INACTIVE;
      
     -  INIT_LIST_HEAD(&hard_iface->list);
    @@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct net_d
      
        mutex_init(&hard_iface->bat_iv.ogm_buff_mutex);
     @@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct net_device *net_dev,
    + 
        batadv_v_hardif_init(hard_iface);
      
    -   kref_get(&hard_iface->refcount);
    +-  kref_get(&hard_iface->refcount);
     -  list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
     -  batadv_hardif_generation++;
    - 
    -   hardif_mtu = READ_ONCE(hard_iface->net_dev->mtu);
    -   required_mtu = READ_ONCE(mesh_iface->mtu) + max_header_len;
    -@@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct net_device *net_dev,
    +-
    +   netdev_hold(mesh_iface, &hard_iface->meshif_dev_tracker, GFP_ATOMIC);
        hard_iface->mesh_iface = mesh_iface;
        bat_priv = netdev_priv(hard_iface->mesh_iface);
      
    @@ net/batman-adv/hard-interface.c: void 
batadv_hardif_disable_interface(struct bat
                goto out;
      
     -  list_del_rcu(&hard_iface->list);
    +-  batadv_hardif_put(hard_iface);
     -  batadv_hardif_generation++;
     -
        batadv_info(hard_iface->mesh_iface, "Removing interface: %s\n",
                    hard_iface->net_dev->name);
        dev_remove_pack(&hard_iface->batman_adv_ptype);
     @@ net/batman-adv/hard-interface.c: void 
batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
    +   /* delete all references to this hard_iface */
    +   batadv_purge_orig_ref(bat_priv);
        batadv_purge_outstanding_packets(bat_priv, hard_iface);
    -   netdev_put(hard_iface->mesh_iface, &hard_iface->meshif_dev_tracker);
    +-  netdev_put(hard_iface->mesh_iface, &hard_iface->meshif_dev_tracker);
      
     +  batadv_hardif_generation++;
        netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->mesh_iface);
        batadv_hardif_recalc_extra_skbroom(hard_iface->mesh_iface);
      
    +@@ net/batman-adv/hard-interface.c: void 
batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
    +   if (batadv_hardif_cnt(hard_iface->mesh_iface) <= 1)
    +           batadv_gw_check_client_stop(bat_priv);
    + 
    +-  hard_iface->mesh_iface = NULL;
    +   batadv_hardif_put(hard_iface);
    + 
    + out:
     
      ## net/batman-adv/hard-interface.h ##
    -@@ net/batman-adv/hard-interface.h: struct net_device 
*batadv_get_real_netdev(struct net_device *net_device);
    - bool batadv_is_cfg80211_hardif(struct batadv_hard_iface *hard_iface);
    +@@ net/batman-adv/hard-interface.h: u32 
batadv_netdev_get_wifi_flags(struct net_device *net_dev);
    + u32 batadv_hardif_get_wifi_flags(struct batadv_hard_iface *hard_iface);
      bool batadv_is_wifi_hardif(struct batadv_hard_iface *hard_iface);
      struct batadv_hard_iface*
     -batadv_hardif_get_by_netdev(const struct net_device *net_dev);
    @@ net/batman-adv/main.h: static inline int batadv_print_vid(unsigned short 
vid)
      
      extern struct workqueue_struct *batadv_event_workqueue;
     
    + ## net/batman-adv/netlink.c ##
    +@@ net/batman-adv/netlink.c: batadv_netlink_get_hardif_from_ifindex(struct 
batadv_priv *bat_priv,
    +   if (!hard_dev)
    +           return ERR_PTR(-ENODEV);
    + 
    ++  rtnl_lock();
    +   hard_iface = batadv_hardif_get_by_netdev(hard_dev);
    ++  rtnl_unlock();
    +   if (!hard_iface)
    +           goto err_put_harddev;
    + 
    +
      ## net/batman-adv/types.h ##
    -@@ net/batman-adv/types.h: enum batadv_hard_iface_wifi_flags {
    +@@ net/batman-adv/types.h: struct batadv_wifi_net_device_state {
       * struct batadv_hard_iface - network device known to batman-adv
       */
      struct batadv_hard_iface {
5:  0d0b32d8 ! 5:  6b1570a7 batman-adv: move hardif generation counter into 
batadv_priv
    @@
      ## Metadata ##
    -Author: Matthias Schiffer <[email protected]>
    +Author: Nora Schiffer <[email protected]>
     
      ## Commit message ##
         batman-adv: move hardif generation counter into batadv_priv
     
         The counter doesn't need to be global.
     
    -    Signed-off-by: Matthias Schiffer <[email protected]>
    -    Acked-by: Sven Eckelmann <[email protected]>
    -
      ## net/batman-adv/hard-interface.c ##
     @@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct net_device *net_dev,
        hard_iface->mesh_iface = mesh_iface;
    @@ net/batman-adv/hard-interface.c: int 
batadv_hardif_enable_interface(struct net_d
                                           mesh_iface, hard_iface, NULL, NULL);
        if (ret)
     @@ net/batman-adv/hard-interface.c: void 
batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface)
    +   batadv_purge_orig_ref(bat_priv);
        batadv_purge_outstanding_packets(bat_priv, hard_iface);
    -   netdev_put(hard_iface->mesh_iface, &hard_iface->meshif_dev_tracker);
      
     -  batadv_hardif_generation++;
     +  bat_priv->hardif_generation++;

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to