Exemplo n.º 1
0
static void ack_work(struct work_struct *work)
{
    struct pptp_opt *opt=container_of(work,struct pptp_opt,ack_work);
    struct pppox_sock *po=container_of(opt,struct pppox_sock,proto.pptp);
#else
static void ack_work(struct pppox_sock *po)
{
	struct pptp_opt *opt=&po->proto.pptp;
#endif
	INC_ACK_WORKS;
	pptp_xmit(&po->chan,0);

	if (!test_and_set_bit(PPTP_FLAG_PROC,(unsigned long*)&opt->flags)){
		if (ppp_unit_number(&po->chan)!=-1){
			char unit[10];
			sprintf(unit,"ppp%i",ppp_unit_number(&po->chan));
			create_proc_read_entry(unit,0,proc_dir,read_proc,po);
		}else clear_bit(PPTP_FLAG_PROC,(unsigned long*)&opt->flags);
	}
}


static void do_ack_timeout_work(struct pppox_sock *po)
{
    struct pptp_opt *opt=&po->proto.pptp;
    int paused;
    
    spin_lock_bh(&opt->xmit_lock);
    paused=__test_and_clear_bit(PPTP_FLAG_PAUSE,(unsigned long*)&opt->flags);
    if (paused){
			if (opt->window>min_window) --opt->window;
			opt->ack_recv=opt->seq_sent;
    }
    spin_unlock_bh(&opt->xmit_lock);
    if (paused) ppp_output_wakeup(&po->chan);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
static void _ack_timeout_work(struct work_struct *work)
{
    struct pptp_opt *opt=container_of(work,struct pptp_opt,ack_timeout_work.work);
    struct pppox_sock *po=container_of(opt,struct pppox_sock,proto.pptp);
		INC_ACK_TIMEOUTS;
    do_ack_timeout_work(po);
}
#else
static void _ack_timeout_work(struct pppox_sock *po)
{
	INC_ACK_TIMEOUTS;
  do_ack_timeout_work(po);
}
Exemplo n.º 2
0
/*
 * Post an event to the control channel...
 * Put the event in the log, and then wait all process blocked on read
 * so they can read the log...
 */
static void
irnet_post_event(irnet_socket *	ap,
		 irnet_event	event,
		 __u32		addr,
		 char *		name)
{
  unsigned long		flags;		/* For spinlock */
  int			index;		/* In the log */

  DENTER(CTRL_TRACE, "(ap=0x%X, event=%d, addr=%08x, name=``%s'')\n",
	 (unsigned int) ap, event, addr, name);

  /* Protect this section via spinlock.
   * Note : as we are the only event producer, we only need to exclude
   * ourself when touching the log, which is nice and easy.
   */
  spin_lock_irqsave(&irnet_events.spinlock, flags);

  /* Copy the event in the log */
  index = irnet_events.index;
  irnet_events.log[index].event = event;
  irnet_events.log[index].addr = addr;
  /* Try to copy IrDA nickname */
  if(name)
    strcpy(irnet_events.log[index].name, name);
  else
    irnet_events.log[index].name[0] = '\0';
  /* Try to get ppp unit number */
  if((ap != (irnet_socket *) NULL) && (ap->ppp_open))
    irnet_events.log[index].unit = ppp_unit_number(&ap->chan);
  else
    irnet_events.log[index].unit = -1;

  /* Increment the index
   * Note that we increment the index only after the event is written,
   * to make sure that the readers don't get garbage... */
  irnet_events.index = (index + 1) % IRNET_MAX_EVENTS;

  DEBUG(CTRL_INFO, "New event index is %d\n", irnet_events.index);

  /* Spin lock end */
  spin_unlock_irqrestore(&irnet_events.spinlock, flags);

  /* Now : wake up everybody waiting for events... */
  wake_up_interruptible_all(&irnet_events.rwait);

  DEXIT(CTRL_TRACE, "\n");
}
Exemplo n.º 3
0
static void
irnet_post_event(irnet_socket *	ap,
		 irnet_event	event,
		 __u32		saddr,
		 __u32		daddr,
		 char *		name,
		 __u16		hints)
{
  int			index;		

  DENTER(CTRL_TRACE, "(ap=0x%p, event=%d, daddr=%08x, name=``%s'')\n",
	 ap, event, daddr, name);

  
  spin_lock_bh(&irnet_events.spinlock);

  
  index = irnet_events.index;
  irnet_events.log[index].event = event;
  irnet_events.log[index].daddr = daddr;
  irnet_events.log[index].saddr = saddr;
  
  if(name)
    strcpy(irnet_events.log[index].name, name);
  else
    irnet_events.log[index].name[0] = '\0';
  
  irnet_events.log[index].hints.word = hints;
  
  if((ap != (irnet_socket *) NULL) && (ap->ppp_open))
    irnet_events.log[index].unit = ppp_unit_number(&ap->chan);
  else
    irnet_events.log[index].unit = -1;

  
  irnet_events.index = (index + 1) % IRNET_MAX_EVENTS;

  DEBUG(CTRL_INFO, "New event index is %d\n", irnet_events.index);

  
  spin_unlock_bh(&irnet_events.spinlock);

  
  wake_up_interruptible_all(&irnet_events.rwait);

  DEXIT(CTRL_TRACE, "\n");
}