diff options
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_net.c | 71 |
1 files changed, 55 insertions, 16 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c index a108db354..147ca7b3a 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_net.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c @@ -730,7 +730,7 @@ static int dvb_net_feed_start(struct net_device *dev) priv->secfilter=0; priv->tsfeed = 0; - if (priv->feedtype == FEEDTYPE_SEC) { + if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) { dprintk("%s: alloc secfeed\n", __FUNCTION__); ret=demux->allocate_section_feed(demux, &priv->secfeed, dvb_net_sec_callback); @@ -776,8 +776,7 @@ static int dvb_net_feed_start(struct net_device *dev) dprintk("%s: start filtering\n", __FUNCTION__); priv->secfeed->start_filtering(priv->secfeed); - } - else { + } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) { struct timespec timeout = { 0, 30000000 }; // 30 msec /* we have payloads encapsulated in TS */ @@ -806,18 +805,19 @@ static int dvb_net_feed_start(struct net_device *dev) dprintk("%s: start filtering\n", __FUNCTION__); priv->tsfeed->start_filtering(priv->tsfeed); - } + } else + return -EINVAL; return 0; } -static void dvb_net_feed_stop(struct net_device *dev) +static int dvb_net_feed_stop(struct net_device *dev) { struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv; int i; dprintk("%s\n", __FUNCTION__); - if (priv->feedtype == FEEDTYPE_SEC) { + if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) { if (priv->secfeed) { if (priv->secfeed->is_filtering) { dprintk("%s: stop secfeed\n", __FUNCTION__); @@ -845,8 +845,7 @@ static void dvb_net_feed_stop(struct net_device *dev) priv->secfeed = 0; } else printk("%s: no feed to stop\n", dev->name); - } - else { + } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) { if (priv->tsfeed) { if (priv->tsfeed->is_filtering) { dprintk("%s: stop tsfeed\n", __FUNCTION__); @@ -857,7 +856,9 @@ static void dvb_net_feed_stop(struct net_device *dev) } else printk("%s: no ts feed to stop\n", dev->name); - } + } else + return -EINVAL; + return 0; } @@ -966,8 +967,7 @@ static int dvb_net_stop(struct net_device *dev) struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv; priv->in_use--; - dvb_net_feed_stop(dev); - return 0; + return dvb_net_feed_stop(dev); } static struct net_device_stats * dvb_net_get_stats(struct net_device *dev) @@ -1028,6 +1028,8 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype) int result; int if_num; + if (feedtype != DVB_NET_FEEDTYPE_MPE && feedtype != DVB_NET_FEEDTYPE_ULE) + return -EINVAL; if ((if_num = get_if(dvbnet)) < 0) return -EINVAL; @@ -1053,6 +1055,10 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype) priv->pid = pid; priv->rx_mode = RX_MODE_UNI; priv->host = dvbnet; + priv->need_pusi = 1; + priv->tscc = 0; + priv->feedtype = feedtype; + reset_ule(priv); INIT_WORK(&priv->set_multicast_list_wq, wq_set_multicast_list, net); INIT_WORK(&priv->restart_net_feed_wq, wq_restart_net_feed, net); @@ -1073,6 +1079,8 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype) int result; int if_num; + if (feedtype != DVB_NET_FEEDTYPE_MPE && feedtype != DVB_NET_FEEDTYPE_ULE) + return -EINVAL; if ((if_num = get_if(dvbnet)) < 0) return -EINVAL; @@ -1095,11 +1103,7 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype) priv->need_pusi = 1; priv->tscc = 0; priv->feedtype = feedtype; - reset_ule( priv ); - priv->need_pusi = 1; - priv->tscc = 0; - priv->feedtype = feedtype; - reset_ule( priv ); + reset_ule(priv); INIT_WORK(&priv->set_multicast_list_wq, wq_set_multicast_list, net); INIT_WORK(&priv->restart_net_feed_wq, wq_restart_net_feed, net); @@ -1195,12 +1199,47 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file, #endif priv_data=(struct dvb_net_priv*)netdev->priv; dvbnetif->pid=priv_data->pid; + dvbnetif->feedtype=priv_data->feedtype; break; } case NET_REMOVE_IF: if (!capable(CAP_SYS_ADMIN)) return -EPERM; return dvb_net_remove_if(dvbnet, (int) (long) parg); + + /* binary compatiblity cruft */ + case __NET_ADD_IF_OLD: + { + struct __dvb_net_if_old *dvbnetif=(struct __dvb_net_if_old *)parg; + int result; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + result=dvb_net_add_if(dvbnet, dvbnetif->pid, DVB_NET_FEEDTYPE_MPE); + if (result<0) + return result; + dvbnetif->if_num=result; + break; + } + case __NET_GET_IF_OLD: + { + struct net_device *netdev; + struct dvb_net_priv *priv_data; + struct __dvb_net_if_old *dvbnetif=(struct __dvb_net_if_old *)parg; + + if (dvbnetif->if_num >= DVB_NET_DEVICES_MAX || + !dvbnet->state[dvbnetif->if_num]) + return -EINVAL; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + netdev = &dvbnet->device[dvbnetif->if_num]; +#else + netdev = dvbnet->device[dvbnetif->if_num]; +#endif + priv_data=(struct dvb_net_priv*)netdev->priv; + dvbnetif->pid=priv_data->pid; + break; + } default: return -ENOTTY; } |