Пример #1
0
static int vnet_transmit(FAR struct vnet_driver_s *vnet)
{
  int err;

  /* Verify that the hardware is ready to send another packet.  If we get
   * here, then we are committed to sending a packet; Higher level logic
   * must have assured that there is not transmission in progress.
   */

  /* Send the packet: address=vnet->sk_dev.d_buf, length=vnet->sk_dev.d_len */

  err = vnet_xmit(vnet->vnet, (char *)vnet->sk_dev.d_buf, vnet->sk_dev.d_len);
  if (err)
    {
      /* When vnet_xmit fail, it means TX buffer is full. Watchdog
       * is of no use here because no TX done INT will happen. So
       * we reset the TX buffer directly.
       */

#ifdef CONFIG_DEBUG
      cprintf("VNET: TX buffer is full\n");
#endif
      return ERROR;
    }
  else
    {
      /* This step may be unnecessary here */

      vnet_txdone(vnet);
    }

  return OK;
}
Пример #2
0
static int vnet_transmit(FAR struct vnet_driver_s *vnet)
{
    int err;

  /* Verify that the hardware is ready to send another packet.  If we get
   * here, then we are committed to sending a packet; Higher level logic
   * must have assured that there is not transmission in progress.
   */

  /* Increment statistics */

  /* Send the packet: address=vnet->sk_dev.d_buf, length=vnet->sk_dev.d_len */
    err = vnet_xmit(vnet->vnet, (char *)vnet->sk_dev.d_buf, vnet->sk_dev.d_len);
    if (err) {
	/* Setup the TX timeout watchdog (perhaps restarting the timer) */
	//(void)wd_start(vnet->sk_txtimeout, VNET_TXTIMEOUT, vnet_txtimeout, 1, (uint32_t)vnet);

	// When vnet_xmit fail, it means TX buffer is full. Watchdog 
	// is of no use here because no TX done INT will happen. So 
	// we reset the TX buffer directly.
#ifdef CONFIG_DEBUG
	cprintf("VNET: TX buffer is full\n");
#endif
	return ERROR;
    }
    else {
	// this step may be unnecessary here
	vnet_txdone(vnet);
    }

    return OK;
}