diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-05-13 10:14:24 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-05-13 10:14:24 -0300 |
commit | 14944d72c315df4b3a656eb0fd4efb98e5a267f7 (patch) | |
tree | 0863730b028e4b21e9f3d83696f212563ac29053 /linux/drivers/media/dvb/dvb-core | |
parent | 86f937203f18d8759d1b87cc3f2f4ab9a7e619e7 (diff) | |
download | mediapointer-dvb-s2-14944d72c315df4b3a656eb0fd4efb98e5a267f7.tar.gz mediapointer-dvb-s2-14944d72c315df4b3a656eb0fd4efb98e5a267f7.tar.bz2 |
Backport several changesets on dvb_net.c
From: Mauro Carvalho Chehab <mchehab@infradead.org>
kernel-sync:
Backport several patches from Arnaldo Carvalho de Melo
<acme@redhat.com>:
[SK_BUFF]: Introduce skb_copy_from_linear_data{_offset}
[SK_BUFF]: Convert skb->tail to sk_buff_data_t
[SK_BUFF]: Introduce skb_mac_header()
The API changed on 2.6.22, so this patch add the proper compat macros to
allow compilation with older versions.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_net.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c index 7089412e3..408c3b638 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_net.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c @@ -183,7 +183,11 @@ static unsigned short dvb_net_eth_type_trans(struct sk_buff *skb, struct ethhdr *eth; unsigned char *rawp; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) skb->mac.raw=skb->data; +#else + skb_reset_mac_header(skb); +#endif skb_pull(skb,dev->hard_header_len); eth = eth_hdr(skb); @@ -609,6 +613,9 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) /* Check CRC32, we've got it in our skb already. */ unsigned short ulen = htons(priv->ule_sndu_len); unsigned short utype = htons(priv->ule_sndu_type); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) + const u8 *tail; +#endif struct kvec iov[3] = { { &ulen, sizeof ulen }, { &utype, sizeof utype }, @@ -622,10 +629,18 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) } ule_crc = iov_crc32(ule_crc, iov, 3); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) expected_crc = *((u8 *)priv->ule_skb->tail - 4) << 24 | *((u8 *)priv->ule_skb->tail - 3) << 16 | *((u8 *)priv->ule_skb->tail - 2) << 8 | *((u8 *)priv->ule_skb->tail - 1); +#else + tail = skb_tail_pointer(priv->ule_skb); + expected_crc = *(tail - 4) << 24 | + *(tail - 3) << 16 | + *(tail - 2) << 8 | + *(tail - 1); +#endif if (ule_crc != expected_crc) { printk(KERN_WARNING "%lu: CRC32 check FAILED: %08x / %08x, SNDU len %d type %#x, ts_remain %d, next 2: %x.\n", priv->ts_count, ule_crc, expected_crc, priv->ule_sndu_len, priv->ule_sndu_type, ts_remain, ts_remain > 2 ? *(unsigned short *)from_where : 0); @@ -704,7 +719,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) } else { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) memcpy(dest_addr, priv->ule_skb->data, ETH_ALEN); +#else + skb_copy_from_linear_data(priv->ule_skb, + dest_addr, + ETH_ALEN); +#endif skb_pull(priv->ule_skb, ETH_ALEN); } } |