Lines Matching refs:lp
85 int (*open)(struct iss_net_private *lp);
86 void (*close)(struct iss_net_private *lp);
87 int (*read)(struct iss_net_private *lp, struct sk_buff **skb);
88 int (*write)(struct iss_net_private *lp, struct sk_buff **skb);
90 int (*poll)(struct iss_net_private *lp);
160 static int tuntap_open(struct iss_net_private *lp) in tuntap_open() argument
163 char *dev_name = lp->tp.info.tuntap.dev_name; in tuntap_open()
170 lp->dev->name, fd, errno); in tuntap_open()
181 lp->dev->name, dev_name, err, errno); in tuntap_open()
186 lp->tp.info.tuntap.fd = fd; in tuntap_open()
190 static void tuntap_close(struct iss_net_private *lp) in tuntap_close() argument
192 simc_close(lp->tp.info.tuntap.fd); in tuntap_close()
193 lp->tp.info.tuntap.fd = -1; in tuntap_close()
196 static int tuntap_read(struct iss_net_private *lp, struct sk_buff **skb) in tuntap_read() argument
198 return simc_read(lp->tp.info.tuntap.fd, in tuntap_read()
202 static int tuntap_write(struct iss_net_private *lp, struct sk_buff **skb) in tuntap_write() argument
204 return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len); in tuntap_write()
212 static int tuntap_poll(struct iss_net_private *lp) in tuntap_poll() argument
214 return simc_poll(lp->tp.info.tuntap.fd); in tuntap_poll()
221 static int tuntap_probe(struct iss_net_private *lp, int index, char *init) in tuntap_probe() argument
223 struct net_device *dev = lp->dev; in tuntap_probe()
251 strlcpy(lp->tp.info.tuntap.dev_name, dev_name, in tuntap_probe()
252 sizeof(lp->tp.info.tuntap.dev_name)); in tuntap_probe()
256 lp->mtu = TRANSPORT_TUNTAP_MTU; in tuntap_probe()
258 lp->tp.info.tuntap.fd = -1; in tuntap_probe()
260 lp->tp.open = tuntap_open; in tuntap_probe()
261 lp->tp.close = tuntap_close; in tuntap_probe()
262 lp->tp.read = tuntap_read; in tuntap_probe()
263 lp->tp.write = tuntap_write; in tuntap_probe()
264 lp->tp.protocol = tuntap_protocol; in tuntap_probe()
265 lp->tp.poll = tuntap_poll; in tuntap_probe()
274 struct iss_net_private *lp = netdev_priv(dev); in iss_net_rx() local
280 if (lp->tp.poll(lp) == 0) in iss_net_rx()
287 lp->stats.rx_dropped++; in iss_net_rx()
297 pkt_len = lp->tp.read(lp, &skb); in iss_net_rx()
302 skb->protocol = lp->tp.protocol(skb); in iss_net_rx()
304 lp->stats.rx_bytes += skb->len; in iss_net_rx()
305 lp->stats.rx_packets++; in iss_net_rx()
321 struct iss_net_private *lp; in iss_net_poll() local
323 lp = list_entry(ele, struct iss_net_private, opened_list); in iss_net_poll()
325 if (!netif_running(lp->dev)) in iss_net_poll()
328 spin_lock(&lp->lock); in iss_net_poll()
330 while ((err = iss_net_rx(lp->dev)) > 0) in iss_net_poll()
333 spin_unlock(&lp->lock); in iss_net_poll()
337 lp->dev->name, err); in iss_net_poll()
338 dev_close(lp->dev); in iss_net_poll()
351 struct iss_net_private *lp = from_timer(lp, t, timer); in iss_net_timer() local
354 spin_lock(&lp->lock); in iss_net_timer()
355 mod_timer(&lp->timer, jiffies + lp->timer_val); in iss_net_timer()
356 spin_unlock(&lp->lock); in iss_net_timer()
362 struct iss_net_private *lp = netdev_priv(dev); in iss_net_open() local
365 spin_lock_bh(&lp->lock); in iss_net_open()
367 err = lp->tp.open(lp); in iss_net_open()
380 spin_unlock_bh(&lp->lock); in iss_net_open()
382 list_add(&lp->opened_list, &opened); in iss_net_open()
384 spin_lock_bh(&lp->lock); in iss_net_open()
386 timer_setup(&lp->timer, iss_net_timer, 0); in iss_net_open()
387 lp->timer_val = ISS_NET_TIMER_VALUE; in iss_net_open()
388 mod_timer(&lp->timer, jiffies + lp->timer_val); in iss_net_open()
391 spin_unlock_bh(&lp->lock); in iss_net_open()
397 struct iss_net_private *lp = netdev_priv(dev); in iss_net_close() local
399 spin_lock_bh(&lp->lock); in iss_net_close()
405 del_timer_sync(&lp->timer); in iss_net_close()
407 lp->tp.close(lp); in iss_net_close()
409 spin_unlock_bh(&lp->lock); in iss_net_close()
415 struct iss_net_private *lp = netdev_priv(dev); in iss_net_start_xmit() local
419 spin_lock_bh(&lp->lock); in iss_net_start_xmit()
421 len = lp->tp.write(lp, &skb); in iss_net_start_xmit()
424 lp->stats.tx_packets++; in iss_net_start_xmit()
425 lp->stats.tx_bytes += skb->len; in iss_net_start_xmit()
434 lp->stats.tx_dropped++; in iss_net_start_xmit()
441 spin_unlock_bh(&lp->lock); in iss_net_start_xmit()
450 struct iss_net_private *lp = netdev_priv(dev); in iss_net_get_stats() local
451 return &lp->stats; in iss_net_get_stats()
464 struct iss_net_private *lp = netdev_priv(dev); in iss_net_set_mac() local
469 spin_lock_bh(&lp->lock); in iss_net_set_mac()
471 spin_unlock_bh(&lp->lock); in iss_net_set_mac()
508 struct iss_net_private *lp = in iss_net_pdev_release() local
511 free_netdev(lp->dev); in iss_net_pdev_release()
517 struct iss_net_private *lp; in iss_net_configure() local
519 dev = alloc_etherdev(sizeof(*lp)); in iss_net_configure()
527 lp = netdev_priv(dev); in iss_net_configure()
528 *lp = (struct iss_net_private) { in iss_net_configure()
529 .device_list = LIST_HEAD_INIT(lp->device_list), in iss_net_configure()
530 .opened_list = LIST_HEAD_INIT(lp->opened_list), in iss_net_configure()
535 spin_lock_init(&lp->lock); in iss_net_configure()
548 if (!tuntap_probe(lp, index, init)) { in iss_net_configure()
565 list_add(&lp->device_list, &devices); in iss_net_configure()
568 lp->pdev.id = index; in iss_net_configure()
569 lp->pdev.name = DRIVER_NAME; in iss_net_configure()
570 lp->pdev.dev.release = iss_net_pdev_release; in iss_net_configure()
571 if (platform_device_register(&lp->pdev)) in iss_net_configure()
573 SET_NETDEV_DEV(dev, &lp->pdev.dev); in iss_net_configure()
576 dev->mtu = lp->mtu; in iss_net_configure()
584 platform_device_unregister(&lp->pdev); in iss_net_configure()
589 timer_setup(&lp->tl, iss_net_user_timer_expire, 0); in iss_net_configure()