--- zzzz-none-000/linux-2.6.28.10/include/linux/netdevice.h 2009-05-02 18:54:43.000000000 +0000 +++ puma5-6360-529/linux-2.6.28.10/include/linux/netdevice.h 2011-10-27 15:46:53.000000000 +0000 @@ -44,6 +44,10 @@ #include #include +#ifdef CONFIG_TI_PACKET_PROCESSOR +#include +#endif /* CONFIG_TI_PACKET_PROCESSOR */ + struct vlan_group; struct ethtool_ops; struct netpoll_info; @@ -117,6 +121,15 @@ #endif /* __KERNEL__ */ +#ifdef CONFIG_TI_DEVICE_INDEX_REUSE +/* Maximum number of net devices supported. TI L2 Selective forwarder uses + * 32 bits to mark the packet to indicate the device on which the packets should + * be forwarded. Hence Max Device Index is limited to 32. + * Do not increment the number. + */ +#define TI_MAX_DEVICE_INDEX 32 +#endif /* CONFIG_TI_DEVICE_INDEX_REUSE */ + /* * Network device statistics. Akin to the 2.0 ether stats but * with byte counters. @@ -743,8 +756,55 @@ /* mid-layer private */ void *ml_priv; +#ifdef CONFIG_AVM_PA + union { + struct avm_pa_dev_info devinfo; + u8 buf[32]; + } avm_pa; +#define AVM_PA_DEVINFO(dev) (&(dev)->avm_pa.devinfo) +#endif + /* bridge stuff */ struct net_bridge_port *br_port; + +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +#ifdef CONFIG_TI_DEVICE_PROTOCOL_HANDLING + int (*packet_handler)(struct sk_buff *skb); +#endif + +#ifdef CONFIG_TI_EGRESS_HOOK + int (*egress_hook)(struct sk_buff *skb); +#endif + +#ifdef CONFIG_TI_DOCSIS_EGRESS_HOOK + int (*docsis_egress_hook)(struct sk_buff *skb); +#endif + +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* PPM Device Information. Each networking device can be considered as a VPID + * instance executing on a PID. The PID is created when the hardware associated + * with the device has been initialized; the VPID Information is initialized and + * every subsequent call to bring the interface UP and DOWN results in VPID + * creation and deletion. Virtual networking interfaces do not have a matching + * VPID. So if the PID handle is -1 then there is no VPID manipulation done on the + * device. */ + int pid_handle; + int vpid_handle; + + /* The VPID Information block which is associated with the networking device. + * This field is kept in the networking device because it gives us a convenient + * place to store all the VPID specific information. As mentioned above not all + * networking devices are a networking endpoint. In such cases the values in this + * structure are ignored. */ + TI_PP_VPID vpid_block; + + int (*qos_setup_hook) (struct net_device *dev_p); + int (*qos_shutdown_hook)(struct net_device *dev_p); + int (*qos_select_hook) (struct sk_buff *skb); + +#endif + /* macvlan */ struct macvlan_port *macvlan_port; /* GARP */ @@ -793,7 +853,7 @@ * Net namespace inlines */ static inline -struct net *dev_net(const struct net_device *dev) +struct net *dev_net(const struct net_device *dev __attribute__ ((unused))) { #ifdef CONFIG_NET_NS return dev->nd_net; @@ -803,7 +863,8 @@ } static inline -void dev_net_set(struct net_device *dev, struct net *net) +void dev_net_set(struct net_device *dev __attribute__ ((unused)), + struct net *net __attribute__ ((unused))) { #ifdef CONFIG_NET_NS release_net(dev->nd_net); @@ -811,7 +872,7 @@ #endif } -static inline bool netdev_uses_dsa_tags(struct net_device *dev) +static inline bool netdev_uses_dsa_tags(struct net_device *dev __attribute__ ((unused))) { #ifdef CONFIG_NET_DSA_TAG_DSA if (dev->dsa_ptr != NULL) @@ -821,7 +882,7 @@ return 0; } -static inline bool netdev_uses_trailer_tags(struct net_device *dev) +static inline bool netdev_uses_trailer_tags(struct net_device *dev __attribute__ ((unused))) { #ifdef CONFIG_NET_DSA_TAG_TRAILER if (dev->dsa_ptr != NULL) @@ -859,7 +920,7 @@ * netif_napi_add() must be used to initialize a napi context prior to calling * *any* of the other napi related functions. */ -static inline void netif_napi_add(struct net_device *dev, +static inline void netif_napi_add(struct net_device *dev __attribute__ ((unused)), struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) @@ -882,7 +943,7 @@ * * netif_napi_del() removes a napi context from the network device napi list */ -static inline void netif_napi_del(struct napi_struct *napi) +static inline void netif_napi_del(struct napi_struct *napi __attribute__ ((unused))) { #ifdef CONFIG_NETPOLL list_del(&napi->dev_list); @@ -901,6 +962,13 @@ int (*gso_send_check)(struct sk_buff *skb); void *af_packet_priv; struct list_head list; +#ifdef CONFIG_AVM_PA + union { + struct avm_pa_dev_info devinfo; + u8 buf[32]; + } avm_pa; +#define AVM_PA_PTYPE_DEVINFO(ptype) (&(ptype)->avm_pa.devinfo) +#endif }; #include @@ -1274,6 +1342,40 @@ /* Called by rtnetlink.c:rtnl_unlock() */ extern void netdev_run_todo(void); +#ifdef CONFIG_DEV_REFCNT_DEBUG + +#include "linux/kallsyms.h" + +static inline void show_here(char *func, struct net_device *dev, + char *fn, int ln, + unsigned long ip) +{ + printk(KERN_DEBUG "%s: dev %d %s() %s:%d", + dev->name, atomic_read(&dev->refcnt), + func, fn, ln); + print_ip_sym(ip); +} + +#define dev_put(dev) ____dev_put(dev, __FILE__, __LINE__) + +static inline void ____dev_put(struct net_device *dev, char *fn, int ln) +{ + atomic_dec(&dev->refcnt); + show_here("dev_put", dev, fn, ln, + (unsigned long)__builtin_return_address(0)); +} + +#define dev_hold(dev) ____dev_hold(dev, __FILE__, __LINE__) + +static inline void ____dev_hold(struct net_device *dev, char *fn, int ln) +{ + atomic_inc(&dev->refcnt); + show_here("dev_hold", dev, fn, ln, + (unsigned long)__builtin_return_address(0)); +} + +#else + /** * dev_put - release reference to device * @dev: network device @@ -1295,6 +1397,7 @@ { atomic_inc(&dev->refcnt); } +#endif /* Carrier loss detection, dial on demand. The functions netif_carrier_on * and _off may be called from IRQ context, but it is caller @@ -1435,7 +1538,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) { /* use default */ - if (debug_value < 0 || debug_value >= (sizeof(u32) * 8)) + if (debug_value < 0 || debug_value >= (int)(sizeof(u32) * 8)) return default_msg_enable_bits; if (debug_value == 0) /* no output */ return 0; @@ -1444,8 +1547,8 @@ } /* Test if receive needs to be scheduled but only if up */ -static inline int netif_rx_schedule_prep(struct net_device *dev, - struct napi_struct *napi) +static inline int netif_rx_schedule_prep(struct net_device *dev __attribute__ ((unused)), + struct napi_struct *napi) { return napi_schedule_prep(napi); } @@ -1453,8 +1556,8 @@ /* Add interface to tail of rx poll list. This assumes that _prep has * already been called and returned 1. */ -static inline void __netif_rx_schedule(struct net_device *dev, - struct napi_struct *napi) +static inline void __netif_rx_schedule(struct net_device *dev __attribute__ ((unused)), + struct napi_struct *napi) { __napi_schedule(napi); } @@ -1482,8 +1585,8 @@ /* same as netif_rx_complete, except that local_irq_save(flags) * has already been issued */ -static inline void __netif_rx_complete(struct net_device *dev, - struct napi_struct *napi) +static inline void __netif_rx_complete(struct net_device *dev __attribute__ ((unused)), + struct napi_struct *napi) { __napi_complete(napi); } @@ -1769,6 +1872,11 @@ return 0; } +#ifdef CONFIG_TI_DEVICE_PROTOCOL_HANDLING +extern int ti_register_protocol_handler (struct net_device* dev, int (*packet_handler)(struct sk_buff *skb)); +extern int ti_deregister_protocol_handler (struct net_device* dev); +#endif /* CONFIG_TI_DEVICE_PROTOCOL_HANDLING */ + #endif /* __KERNEL__ */ #endif /* _LINUX_DEV_H */