aboutsummaryrefslogtreecommitdiffstats
path: root/net/mpls
diff options
context:
space:
mode:
authorRoopa Prabhu <roopa@cumulusnetworks.com>2015-07-21 04:43:52 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-21 13:39:04 -0400
commitface0188e31b3cfc598d8dc3470e28e00fb3b07c (patch)
treebba5775efa3a2e514a9752041af2c7613a59f443 /net/mpls
parent74a0f2fe8ed51e3adbb1c882be04672fe7bb6996 (diff)
mpls: export mpls functions for use by mpls iptunnels
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mpls')
-rw-r--r--net/mpls/af_mpls.c11
-rw-r--r--net/mpls/internal.h9
2 files changed, 15 insertions, 5 deletions
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 1f93a5978f2a..6e669114f829 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -58,10 +58,11 @@ static inline struct mpls_dev *mpls_dev_get(const struct net_device *dev)
58 return rcu_dereference_rtnl(dev->mpls_ptr); 58 return rcu_dereference_rtnl(dev->mpls_ptr);
59} 59}
60 60
61static bool mpls_output_possible(const struct net_device *dev) 61bool mpls_output_possible(const struct net_device *dev)
62{ 62{
63 return dev && (dev->flags & IFF_UP) && netif_carrier_ok(dev); 63 return dev && (dev->flags & IFF_UP) && netif_carrier_ok(dev);
64} 64}
65EXPORT_SYMBOL_GPL(mpls_output_possible);
65 66
66static unsigned int mpls_rt_header_size(const struct mpls_route *rt) 67static unsigned int mpls_rt_header_size(const struct mpls_route *rt)
67{ 68{
@@ -69,13 +70,14 @@ static unsigned int mpls_rt_header_size(const struct mpls_route *rt)
69 return rt->rt_labels * sizeof(struct mpls_shim_hdr); 70 return rt->rt_labels * sizeof(struct mpls_shim_hdr);
70} 71}
71 72
72static unsigned int mpls_dev_mtu(const struct net_device *dev) 73unsigned int mpls_dev_mtu(const struct net_device *dev)
73{ 74{
74 /* The amount of data the layer 2 frame can hold */ 75 /* The amount of data the layer 2 frame can hold */
75 return dev->mtu; 76 return dev->mtu;
76} 77}
78EXPORT_SYMBOL_GPL(mpls_dev_mtu);
77 79
78static bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu) 80bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
79{ 81{
80 if (skb->len <= mtu) 82 if (skb->len <= mtu)
81 return false; 83 return false;
@@ -85,6 +87,7 @@ static bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu)
85 87
86 return true; 88 return true;
87} 89}
90EXPORT_SYMBOL_GPL(mpls_pkt_too_big);
88 91
89static bool mpls_egress(struct mpls_route *rt, struct sk_buff *skb, 92static bool mpls_egress(struct mpls_route *rt, struct sk_buff *skb,
90 struct mpls_entry_decoded dec) 93 struct mpls_entry_decoded dec)
@@ -626,6 +629,7 @@ int nla_put_labels(struct sk_buff *skb, int attrtype,
626 629
627 return 0; 630 return 0;
628} 631}
632EXPORT_SYMBOL_GPL(nla_put_labels);
629 633
630int nla_get_labels(const struct nlattr *nla, 634int nla_get_labels(const struct nlattr *nla,
631 u32 max_labels, u32 *labels, u32 label[]) 635 u32 max_labels, u32 *labels, u32 label[])
@@ -671,6 +675,7 @@ int nla_get_labels(const struct nlattr *nla,
671 *labels = nla_labels; 675 *labels = nla_labels;
672 return 0; 676 return 0;
673} 677}
678EXPORT_SYMBOL_GPL(nla_get_labels);
674 679
675static int rtm_to_route_config(struct sk_buff *skb, struct nlmsghdr *nlh, 680static int rtm_to_route_config(struct sk_buff *skb, struct nlmsghdr *nlh,
676 struct mpls_route_config *cfg) 681 struct mpls_route_config *cfg)
diff --git a/net/mpls/internal.h b/net/mpls/internal.h
index 8cabeb5a1cb9..2681a4ba6c37 100644
--- a/net/mpls/internal.h
+++ b/net/mpls/internal.h
@@ -50,7 +50,12 @@ static inline struct mpls_entry_decoded mpls_entry_decode(struct mpls_shim_hdr *
50 return result; 50 return result;
51} 51}
52 52
53int nla_put_labels(struct sk_buff *skb, int attrtype, u8 labels, const u32 label[]); 53int nla_put_labels(struct sk_buff *skb, int attrtype, u8 labels,
54int nla_get_labels(const struct nlattr *nla, u32 max_labels, u32 *labels, u32 label[]); 54 const u32 label[]);
55int nla_get_labels(const struct nlattr *nla, u32 max_labels, u32 *labels,
56 u32 label[]);
57bool mpls_output_possible(const struct net_device *dev);
58unsigned int mpls_dev_mtu(const struct net_device *dev);
59bool mpls_pkt_too_big(const struct sk_buff *skb, unsigned int mtu);
55 60
56#endif /* MPLS_INTERNAL_H */ 61#endif /* MPLS_INTERNAL_H */