162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright (C) B.A.T.M.A.N. contributors:
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Marek Lindner
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef _NET_BATMAN_ADV_SOFT_INTERFACE_H_
862306a36Sopenharmony_ci#define _NET_BATMAN_ADV_SOFT_INTERFACE_H_
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include "main.h"
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/kref.h>
1362306a36Sopenharmony_ci#include <linux/netdevice.h>
1462306a36Sopenharmony_ci#include <linux/skbuff.h>
1562306a36Sopenharmony_ci#include <linux/types.h>
1662306a36Sopenharmony_ci#include <net/rtnetlink.h>
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciint batadv_skb_head_push(struct sk_buff *skb, unsigned int len);
1962306a36Sopenharmony_civoid batadv_interface_rx(struct net_device *soft_iface,
2062306a36Sopenharmony_ci			 struct sk_buff *skb, int hdr_size,
2162306a36Sopenharmony_ci			 struct batadv_orig_node *orig_node);
2262306a36Sopenharmony_cibool batadv_softif_is_valid(const struct net_device *net_dev);
2362306a36Sopenharmony_ciextern struct rtnl_link_ops batadv_link_ops;
2462306a36Sopenharmony_ciint batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid);
2562306a36Sopenharmony_civoid batadv_softif_vlan_release(struct kref *ref);
2662306a36Sopenharmony_cistruct batadv_softif_vlan *batadv_softif_vlan_get(struct batadv_priv *bat_priv,
2762306a36Sopenharmony_ci						  unsigned short vid);
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/**
3062306a36Sopenharmony_ci * batadv_softif_vlan_put() - decrease the vlan object refcounter and
3162306a36Sopenharmony_ci *  possibly release it
3262306a36Sopenharmony_ci * @vlan: the vlan object to release
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_cistatic inline void batadv_softif_vlan_put(struct batadv_softif_vlan *vlan)
3562306a36Sopenharmony_ci{
3662306a36Sopenharmony_ci	if (!vlan)
3762306a36Sopenharmony_ci		return;
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci	kref_put(&vlan->refcount, batadv_softif_vlan_release);
4062306a36Sopenharmony_ci}
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */
43