summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 19:02:10 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 19:02:10 -0300
commit9204bc59f7e30d4441efb2262a1debc8782b5b74 (patch)
treed4ba430d96b0a0b148b647f96fb962a30dcef934 /linux/drivers/media/dvb
parentca8ea83f7dfae217f7a0dec64a982cb04d158985 (diff)
downloadmediapointer-dvb-s2-9204bc59f7e30d4441efb2262a1debc8782b5b74.tar.gz
mediapointer-dvb-s2-9204bc59f7e30d4441efb2262a1debc8782b5b74.tar.bz2
dvb-net: backport upstream changes fb875333c8 and 0eade1f930
From: Mauro Carvalho Chehab <mchehab@redhat.com> kernel-sync: commit fb875333c80942455551f690f306a899ceeee5df Author: Stephen Hemminger <shemminger@vyatta.com> Date: Wed Jan 7 18:02:53 2009 -0800 dvb: update network device to current API Use internal network_device_stats that exist in network device and net_device_ops. Compile tested only. commit 0eade1f930fa3ba6461b34baf3ed8fa7c4abc40f Author: Wang Chen <wangchen@cn.fujitsu.com> Date: Wed Dec 3 21:13:13 2008 -0800 dvb: Kill directly reference of netdev->priv Simply replace netdev->priv with netdev_priv(). Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_net.c65
1 files changed, 64 insertions, 1 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c
index 5f4856c6d..1eede48a9 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c
@@ -126,7 +126,9 @@ static void hexdump( const unsigned char *buf, unsigned short len )
struct dvb_net_priv {
int in_use;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
struct net_device_stats stats;
+#endif
u16 pid;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
struct net_device *net;
@@ -391,8 +393,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
if (priv->ule_skb) {
dev_kfree_skb( priv->ule_skb );
/* Prepare for next SNDU. */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
priv->stats.rx_errors++;
priv->stats.rx_frame_errors++;
+#else
+ dev->stats.rx_errors++;
+ dev->stats.rx_frame_errors++;
+#endif
}
reset_ule(priv);
priv->need_pusi = 1;
@@ -445,8 +452,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
dev_kfree_skb( priv->ule_skb );
/* Prepare for next SNDU. */
// reset_ule(priv); moved to below.
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
priv->stats.rx_errors++;
priv->stats.rx_frame_errors++;
+#else
+ dev->stats.rx_errors++;
+ dev->stats.rx_frame_errors++;
+#endif
}
reset_ule(priv);
/* skip to next PUSI. */
@@ -467,8 +479,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
/* Drop partly decoded SNDU, reset state, resync on PUSI. */
if (priv->ule_skb) {
dev_kfree_skb( priv->ule_skb );
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
priv->stats.rx_errors++;
priv->stats.rx_frame_errors++;
+#else
+ dev->stats.rx_errors++;
+ dev->stats.rx_frame_errors++;
+#endif
}
reset_ule(priv);
priv->need_pusi = 1;
@@ -484,8 +501,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
if (priv->ule_sndu_remain > 183) {
/* Current SNDU lacks more data than there could be available in the
* current TS cell. */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
priv->stats.rx_errors++;
priv->stats.rx_length_errors++;
+#else
+ dev->stats.rx_errors++;
+ dev->stats.rx_length_errors++;
+#endif
printk(KERN_WARNING "%lu: Expected %d more SNDU bytes, but "
"got PUSI (pf %d, ts_remain %d). Flushing incomplete payload.\n",
priv->ts_count, priv->ule_sndu_remain, ts[4], ts_remain);
@@ -527,8 +549,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
if (priv->ule_sndu_len < 5) {
printk(KERN_WARNING "%lu: Invalid ULE SNDU length %u. "
"Resyncing.\n", priv->ts_count, priv->ule_sndu_len);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
priv->stats.rx_errors++;
priv->stats.rx_length_errors++;
+#else
+ dev->stats.rx_errors++;
+ dev->stats.rx_length_errors++;
+#endif
priv->ule_sndu_len = 0;
priv->need_pusi = 1;
new_ts = 1;
@@ -580,7 +607,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
if (priv->ule_skb == NULL) {
printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n",
dev->name);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
priv->stats.rx_dropped++;
+#else
+ dev->stats.rx_dropped++;
+#endif
return;
}
@@ -653,8 +684,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
ule_dump = 1;
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
priv->stats.rx_errors++;
priv->stats.rx_crc_errors++;
+#else
+ dev->stats.rx_errors++;
+ dev->stats.rx_crc_errors++;
+#endif
dev_kfree_skb(priv->ule_skb);
} else {
/* CRC32 verified OK. */
@@ -764,8 +800,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
* receive the packet anyhow. */
/* if (priv->ule_dbit && skb->pkt_type == PACKET_OTHERHOST)
priv->ule_skb->pkt_type = PACKET_HOST; */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
priv->stats.rx_packets++;
priv->stats.rx_bytes += priv->ule_skb->len;
+#else
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += priv->ule_skb->len;
+#endif
netif_rx(priv->ule_skb);
}
sndu_done:
@@ -820,8 +861,12 @@ static void dvb_net_sec(struct net_device *dev,
{
u8 *eth;
struct sk_buff *skb;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
struct net_device_stats *stats =
&((struct dvb_net_priv *) netdev_priv(dev))->stats;
+#else
+ struct net_device_stats *stats = &dev->stats;
+#endif
int snap = 0;
/* note: pkt_len includes a 32bit checksum */
@@ -1269,11 +1314,12 @@ static int dvb_net_stop(struct net_device *dev)
return dvb_net_feed_stop(dev);
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
{
return &((struct dvb_net_priv *) netdev_priv(dev))->stats;
}
-
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
static const struct header_ops dvb_header_ops = {
.create = eth_header,
@@ -1282,6 +1328,19 @@ static const struct header_ops dvb_header_ops = {
};
#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
+static const struct net_device_ops dvb_netdev_ops = {
+ .ndo_open = dvb_net_open,
+ .ndo_stop = dvb_net_stop,
+ .ndo_start_xmit = dvb_net_tx,
+ .ndo_set_multicast_list = dvb_net_set_multicast_list,
+ .ndo_set_mac_address = dvb_net_set_mac,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_validate_addr = eth_validate_addr,
+};
+#endif
+
static void dvb_net_setup(struct net_device *dev)
{
ether_setup(dev);
@@ -1291,12 +1350,16 @@ static void dvb_net_setup(struct net_device *dev)
#else
dev->hard_header_cache = NULL;
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
dev->open = dvb_net_open;
dev->stop = dvb_net_stop;
dev->hard_start_xmit = dvb_net_tx;
dev->get_stats = dvb_net_get_stats;
dev->set_multicast_list = dvb_net_set_multicast_list;
dev->set_mac_address = dvb_net_set_mac;
+#else
+ dev->netdev_ops = &dvb_netdev_ops;
+#endif
dev->mtu = 4096;
dev->mc_count = 0;