1 #ifndef LINUX_3_2_COMPAT_H
2 #define LINUX_3_2_COMPAT_H
4 #include <linux/version.h>
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0))
8 #include <linux/skbuff.h>
9 #include <linux/dma-mapping.h>
12 * This is not part of The 2.6.37 kernel yet but we
13 * we use it to optimize the backport code we
14 * need to implement. Instead of using ifdefs
15 * to check what version of the check we use
16 * we just replace all checks on current code
17 * with this. I'll submit this upstream too, that
18 * way all we'd have to do is to implement this
19 * for older kernels, then we would not have to
20 * edit the upstrema code for backport efforts.
22 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
23 #define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT)
25 #define br_port_exists(dev) (dev->br_port)
28 #define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)
31 * skb_frag_page - retrieve the page refered to by a paged fragment
32 * @frag: the paged fragment
34 * Returns the &struct page associated with @frag.
36 static inline struct page *skb_frag_page(const skb_frag_t *frag)
42 * skb_frag_dma_map - maps a paged fragment via the DMA API
43 * @device: the device to map the fragment to
44 * @frag: the paged fragment to map
45 * @offset: the offset within the fragment (starting at the
46 * fragment's own offset)
47 * @size: the number of bytes to map
48 * @direction: the direction of the mapping (%PCI_DMA_*)
50 * Maps the page associated with @frag to @device.
52 static inline dma_addr_t skb_frag_dma_map(struct device *dev,
53 const skb_frag_t *frag,
54 size_t offset, size_t size,
55 enum dma_data_direction dir)
57 return dma_map_page(dev, skb_frag_page(frag),
58 frag->page_offset + offset, size, dir);
61 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) */
63 #endif /* LINUX_3_2_COMPAT_H */