linux/net/mpls/internal.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef MPLS_INTERNAL_H
#define MPLS_INTERNAL_H
#include <net/mpls.h>

/* put a reasonable limit on the number of labels
 * we will accept from userspace
 */
#define MAX_NEW_LABELS

struct mpls_entry_decoded {};

struct mpls_pcpu_stats {};

struct mpls_dev {};

#if BITS_PER_LONG == 32

#define MPLS_INC_STATS_LEN

#define MPLS_INC_STATS

#else

#define MPLS_INC_STATS_LEN(mdev, len, pkts_field, bytes_field)

#define MPLS_INC_STATS(mdev, field)

#endif

struct sk_buff;

#define LABEL_NOT_SPECIFIED

/* This maximum ha length copied from the definition of struct neighbour */
#define VIA_ALEN_ALIGN
#define MAX_VIA_ALEN

enum mpls_payload_type {};

struct mpls_nh {};

/* offset of via from beginning of mpls_nh */
#define MPLS_NH_VIA_OFF(num_labels)

/* all nexthops within a route have the same size based on the
 * max number of labels and max via length across all nexthops
 */
#define MPLS_NH_SIZE(num_labels, max_via_alen)

enum mpls_ttl_propagation {};

/* The route, nexthops and vias are stored together in the same memory
 * block:
 *
 * +----------------------+
 * | mpls_route           |
 * +----------------------+
 * | mpls_nh 0            |
 * +----------------------+
 * | alignment padding    |   4 bytes for odd number of labels
 * +----------------------+
 * | via[rt_max_alen] 0   |
 * +----------------------+
 * | alignment padding    |   via's aligned on sizeof(unsigned long)
 * +----------------------+
 * | ...                  |
 * +----------------------+
 * | mpls_nh n-1          |
 * +----------------------+
 * | via[rt_max_alen] n-1 |
 * +----------------------+
 */
struct mpls_route {};

#define for_nexthops(rt)

#define change_nexthops(rt)

#define endfor_nexthops(rt)

static inline struct mpls_entry_decoded mpls_entry_decode(struct mpls_shim_hdr *hdr)
{}

static inline struct mpls_dev *mpls_dev_get(const struct net_device *dev)
{}

int nla_put_labels(struct sk_buff *skb, int attrtype,  u8 labels,
		   const u32 label[]);
int nla_get_labels(const struct nlattr *nla, u8 max_labels, u8 *labels,
		   u32 label[], struct netlink_ext_ack *extack);
bool mpls_output_possible(const struct net_device *dev);
unsigned int mpls_dev_mtu(const struct net_device *dev);
bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu);
void mpls_stats_inc_outucastpkts(struct net_device *dev,
				 const struct sk_buff *skb);

#endif /* MPLS_INTERNAL_H */