⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linux-kernel.diff

📁 基于linux内核2.6.9的mpls补丁
💻 DIFF
📖 第 1 页 / 共 5 页
字号:
 	unsigned char	tb_id;diff -uNr linux-kernel/include/net/mpls.h mpls-kernel-1/include/net/mpls.h--- linux-kernel/include/net/mpls.h	1969-12-31 18:00:00.000000000 -0600+++ mpls-kernel-1/include/net/mpls.h	2005-01-08 17:19:48.000000000 -0600@@ -0,0 +1,739 @@+/*****************************************************************************+ * MPLS+ *      An implementation of the MPLS (MultiProtocol Label+ *      Switching Architecture) for Linux.+ *+ * File:  linux/include/net/mpls.h+ *+ * Authors:+ *          James Leu        <jleu@mindspring.com>+ *          Ramon Casellas   <casellas@infres.enst.fr>+ *+ *   (c) 1999-2004   James Leu        <jleu@mindspring.com>+ *   (c) 2003-2004   Ramon Casellas   <casellas@infres.enst.fr>+ *+ *      This program is free software; you can redistribute it and/or+ *      modify it under the terms of the GNU General Public License+ *      as published by the Free Software Foundation; either version+ *      2 of the License, or (at your option) any later version.+ *+ *   Changes:+ *   20031126 RCAS:+ *         - Rewrite the debugging macros.+ *   20040319 JLEU:+ *	   - switch to gen_stats+ *   20041018 JLEU+ *	   - added cache_flush to the prot driver+ *****************************************************************************+ */+#ifndef __LINUX_NET_MPLS__H_+#define __LINUX_NET_MPLS__H_++#include <net/spec_nh.h>+#include <net/dst.h>+#include <asm/atomic.h>+#include <linux/init.h>+#include <linux/mpls.h>+#include <linux/netdevice.h>+#include <linux/skbuff.h>+#include <linux/rtnetlink.h>+#include <linux/gen_stats.h>++#define MPLS_ERR KERN_ERR+#define MPLS_INF KERN_ALERT+#define MPLS_DBG KERN_ALERT++/* + * Forward declarations+ */++struct fib_result;+struct rtable;++extern int mpls_debug;+extern struct dst_ops mpls_dst_ops;++/* It is not defined in net/dst.h, it is declared as follows:*/+extern struct dst_entry *dst_destroy(struct dst_entry * dst);+++/* Comment this to suppress MPLS_DEBUG calls */+#define MPLS_ENABLE_DEBUG 1++/* Comment this to suppress TRACING enter/exit functions */+#define MPLS_ENABLE_DEBUG_FUNC 1++#ifdef  MPLS_ENABLE_DEBUG+#define MPLS_DEBUG(f, a...) \+{ \+	if (mpls_debug) {\+		printk (KERN_DEBUG "MPLS DEBUG %s:%d:%s: ", \+			__FILE__, __LINE__, __FUNCTION__); \+		printk (f, ##a); \+	}\+}+#else+#define MPLS_DEBUG(f, a...) /**/+#endif /* MPLS_ENABLE_DEBUG */++#ifdef MPLS_ENABLE_DEBUG_FUNC+#define MPLS_ENTER MPLS_DEBUG("enter\n")+#define MPLS_EXIT  MPLS_DEBUG("exit\n")+#else+#define MPLS_ENTER /**/+#define MPLS_EXIT  /**/+#endif++#define MPLS_INFO(f, a...) printk (KERN_INFO "MPLS INFO " f, ##a);++#ifdef MPLS_ENABLE_DEBUG +#define MPLS_ASSERT(expr) \+if(unlikely(!(expr))) { \+	printk(KERN_ERR "MPLS Assertion failed! %s,%s,%s,line=%d\n",#expr,\+	__FILE__,__FUNCTION__,__LINE__);          \+}+#else+#define MPLS_ASSERT(expr) /**/+#endif /* MPLS_ENABLE_DEBUG */++/****************************************************************************+ * Layer 3 protocol driver+ *+ * most of this code is taken from DaveM&JHadi implementation+ ****************************************************************************/+struct mpls_prot_driver {+	unsigned short	prot_num;++	void		(*cache_flush)(void);+	void		(*set_ttl)(struct sk_buff *skb, int ttl);+	int		(*get_ttl)(struct sk_buff *skb);+	void		(*change_dsfield)(struct sk_buff *skb, int ds);+	int		(*get_dsfield)(struct sk_buff *skb);++	int		(*ttl_expired)(struct sk_buff **skb);+	int		(*mtu_exceeded)(struct sk_buff **skb, int mtu);+	int		(*local_deliver)(struct sk_buff *skb);++	int		(*nexthop_resolve)(+				struct neighbour **,+				struct sockaddr *, struct net_device *);++	struct module	*owner;+};++extern int    mpls_prot_init (void);+extern void   mpls_prot_fini (void);+extern void   mpls_prot_cache_flush_all (void);+extern int    mpls_register_prot   (struct mpls_prot_driver *);+extern int    mpls_unregister_prot (struct mpls_prot_driver *);+extern struct mpls_prot_driver *mpls_get_prot(unsigned short);+extern struct mpls_prot_driver *mpls_get_prot2(unsigned short);+extern struct mpls_prot_driver *mpls_hold_prot(struct mpls_prot_driver *);+extern void   mpls_put_prot (struct mpls_prot_driver *);++/****************************************************************************+ * MPLS Interface "Extension" + * In the current implementation the "all loved" net_device struct is + * extended with one field struct mpls_interface (cast'd to void) called+ * mpls_ptr; This holds basically the "per interface" labelspace.+ *+ ****************************************************************************/++struct mpls_interface {+	/*  +	 * (any mif object)->list_out is a circular d-linked list. Each node+	 * of this list is a NHLFE. NHLFE's are added to this list when adding a +	 * OP_SET opcode to a nhlfe instruction array.+	 * +	 * list_add(&nhlfe->dev_entry, &mpls_if->list_out) : adds nhlfe to this +	 * list.+	 *+	 * "List of all NHLFEs that use this device (e.g. eth0) as output"+	 * cf. mpls_init.c+	 */+	struct list_head list_out;+	                         ++	/*  +	 * (any mif object)->list_in is a circular d-linked list. Each node+	 * of this list is a ILM. ILM's are added to this list when +	 */+	struct list_head list_in;  ++	/* +	 * Label Space for this interface +	 */+	int  labelspace;  +};++++extern struct mpls_interface* mpls_create_if_info(void);+extern void                   mpls_delete_if_info(struct mpls_interface *mpls_if);+++++/****************************************************************************+ * Socket Buffer Mangement & Hacks... + *+ *+ *+ ****************************************************************************/++struct mpls_skb_parm {+	struct mpls_prot_driver *prot;+	unsigned int  gap;+	unsigned int  label:20;+	unsigned int  ttl:8;+	unsigned int  exp:3;+	unsigned int  bos:1;+	unsigned char flag;+	unsigned char popped_bos;+	unsigned char *top_of_stack;+};++#define MPLSCB(skb) ((struct mpls_skb_parm*)((skb)->cb))+++++++/****************************************************************************+ * Result codes for Input/Output Opcodes. + * net/mpls/{mpls_opcode,mpls_opcode_all}.c+ *+ *+ *+ ****************************************************************************/++#define MPLS_RESULT_SUCCESS	0+#define MPLS_RESULT_RECURSE	1+#define MPLS_RESULT_DROP	2+#define MPLS_RESULT_DLV		3+#define MPLS_RESULT_FWD		4+++/**+ * mpls_instr - Struct to hold one instruction+ * @mi_opcode: Opcode. MPLS_OP_POP,etc...       + * @mi_data:   Opcode data.+ * @mi_next:   Next Instruction to execute. + **/+struct mpls_instr {+	struct mpls_instr  *mi_next;+	unsigned short      mi_opcode;+	enum mpls_dir       mi_dir;+	void               *mi_data; +	void *              mi_parent;+};+++struct mpls_nfmark_fwd_info {+	struct mpls_nhlfe *nfi_nhlfe[MPLS_NFMARK_NUM];+	unsigned short        nfi_mask;+};++struct mpls_dsmark_fwd_info {+	struct mpls_nhlfe *dfi_nhlfe[MPLS_DSMARK_NUM];+	unsigned char         dfi_mask;+};++struct mpls_tcindex_fwd_info {+	struct mpls_nhlfe *tfi_nhlfe[MPLS_TCINDEX_NUM];+	unsigned short        tfi_mask;+};++struct mpls_exp_fwd_info {+	struct mpls_nhlfe *efi_nhlfe[MPLS_EXP_NUM];+};++struct mpls_exp2dsmark_info {+	unsigned char e2d[MPLS_EXP_NUM];+};++struct mpls_exp2tcindex_info {+	unsigned short e2t[MPLS_EXP_NUM];+};++struct mpls_tcindex2exp_info {+	unsigned char t2e_mask;+	unsigned char t2e[MPLS_TCINDEX_NUM];+};++struct mpls_dsmark2exp_info {+	unsigned char d2e_mask;+	unsigned char d2e[MPLS_DSMARK_NUM];+};++struct mpls_nfmark2exp_info {+	unsigned char n2e_mask;+	unsigned char n2e[MPLS_NFMARK_NUM];+};++/****************************************************************************+ * Instruction (OPCODEs) Management + *+ *+ ****************************************************************************/++extern void               mpls_instr_release    (struct mpls_instr *mi);+extern struct mpls_instr* mpls_instr_alloc      (unsigned short opcode);+extern void               mpls_instrs_free	(struct mpls_instr *list);+++/* Instruction Sets */+extern int  mpls_instrs_build (+	struct mpls_instr_elem *mie, +	struct mpls_instr **instr, int length, +	enum mpls_dir dir,void *parent);+++++++/****************************************************************************+ * MPLS INPUT INFO (ILM) OBJECT MANAGEMENT+ * net/mpls/mpls_ilm.c+ *+ *+ ****************************************************************************/++struct mpls_ilm {++	union {+		struct dst_entry     dst;+		struct mpls_ilm *next;+	} u;++	struct list_head             global;++	/* To appear as an entry in the device ILM list                     */ +	struct list_head             dev_entry;+	/* Generic stats						    */+	struct gnet_stats_basic	     ilm_stats;+	unsigned int		     ilm_drops;+	/* List of NHLFE                                                    */ +	struct list_head             nhlfe_entry;+	/* Instructions to execute for this ILM                             */ +	struct mpls_instr           *ilm_instr;+	/* Incoming Label for this ILM                                      */+	struct mpls_label            ilm_label;+	/* Key used to lookup this object in a data structure               */+	unsigned int                 ilm_key;+	/* Jiffies                                                          */+	unsigned int                 ilm_age;+	/* L3 protocol driver for packets that use this ILM                 */+	struct mpls_prot_driver     *ilm_proto;+	/* Incoming Labelspace (see doc)                                    */+	unsigned short               ilm_labelspace;+};+++/****+ * Input Radix Tree Management+ **/++/* incoming Radix Tree                                                      */ +extern spinlock_t               mpls_ilm_lock;++/* incoming Radix Tree Lock                                                 */ +extern struct radix_tree_root   mpls_ilm_tree;++/* create an ilm oobject						   */+extern struct mpls_ilm* mpls_ilm_dst_alloc(unsigned int key,+	struct mpls_label *ml, unsigned short family,+	struct mpls_instr_elem *instr, int instr_len);++/* Initialize management for ILM objects                                    */ +int                   mpls_ilm_init(void);++/* Finaliize management for ILM objects                                     */ +void                  mpls_ilm_exit(void);++/* Flush Incoming Tree                                                      */+void                  mpls_flush_in_tree(void);++/* Insert ILM object into incoming tree                                     */+int                   mpls_insert_ilm(unsigned int, struct mpls_ilm* ilm);++/* Delete ILM Object from incoming tree                                     */+struct mpls_ilm*  mpls_delete_ilm(unsigned int key);++/* Get a reference to a given ILM object from a key                         */+struct mpls_ilm*  mpls_get_ilm   (unsigned int key);++/* Get a reference to a given ILM object from incoming label/labelspace     */+struct mpls_ilm*  mpls_get_ilm_by_label(struct mpls_label *label,+	int labelspace, char bos);++++/****************************************************************************+ * MPLS OUTPUT INFO (NHLFE) OBJECT MANAGEMENT+ * net/mpls/mpls_ilm.c+ *+ *+ ****************************************************************************/++struct mpls_nhlfe {+	/* FIXME : Describe this field                                      */+	union {+		struct dst_entry	dst;+		struct mpls_nhlfe	*next;+	} u;+#define nhlfe_mtu		u.dst.metrics[RTAX_MTU-1]++	struct list_head	global;++	/* Generic stats						    */+	struct gnet_stats_basic	nhlfe_stats;+	unsigned int		nhlfe_drops;+	/* List of notif                                                    */+	struct notifier_block*  nhlfe_notifier_list;+	/* List of NHLFE that are linked to this NHLFE                      */+	struct list_head        list_out;+	/* List of ILM that are linked to this NHLFE                        */+	struct list_head        list_in;+	/* To be added into a device list_out if the NHLFE uses (SET) the dev */+	struct list_head        dev_entry;+	/* To be added into list_out if this nhlfe uses (FWD) another NHLFE */+	struct list_head        nhlfe_entry;+	/* Array of instructions for this NHLFE                             */ +	struct mpls_instr      *nhlfe_instr;+	/* Key tu used to store/lookup a given NHLFE in the tree            */+	unsigned int            nhlfe_key;+	/* Age in jiffies                                                   */+	unsigned int            nhlfe_age;+	/* MTU Limit (e.g. from device MTU + number of pushes               */+	unsigned short          nhlfe_mtu_limit;+	unsigned char           nhlfe_propagate_ttl;+};+++struct mpls_fwd_block {+	struct notifier_block notifier_block;+	struct mpls_nhlfe *owner;+	struct mpls_nhlfe *fwd;+};++/****+ * Output Radix Tree Management+ **/++extern struct radix_tree_root mpls_nhlfe_tree;+extern spinlock_t             mpls_nhlfe_lock;++int                    mpls_nhlfe_init   (void);+void                   mpls_nhlfe_exit   (void);+int                    mpls_insert_nhlfe (unsigned int, struct mpls_nhlfe*);+struct mpls_nhlfe*  mpls_delete_nhlfe (unsigned int);+struct mpls_nhlfe*  mpls_get_nhlfe    (unsigned int);+void                   mpls_flush_out_tree(void);++++/****************************************************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -