E1000: Rename uip_dev to netdev

This commit is contained in:
Gregory Nutt 2014-06-29 13:03:19 -06:00
parent fa68fcc843
commit ed1aa8c594

View File

@ -81,7 +81,7 @@
/* This is a helper pointer for accessing the contents of the Ethernet header */
#define BUF ((struct eth_hdr_s *)e1000->uip_dev.d_buf)
#define BUF ((struct eth_hdr_s *)e1000->netdev.d_buf)
/****************************************************************************
* Private Types
@ -119,13 +119,13 @@ struct e1000_dev
/* NuttX net data */
bool bifup; /* true:ifup false:ifdown */
WDOG_ID txpoll; /* TX poll timer */
WDOG_ID txtimeout; /* TX timeout timer */
bool bifup; /* true:ifup false:ifdown */
WDOG_ID txpoll; /* TX poll timer */
WDOG_ID txtimeout; /* TX timeout timer */
/* This holds the information visible to uIP/NuttX */
struct net_driver_s uip_dev; /* Interface understood by uIP */
struct net_driver_s netdev; /* Interface understood by networking layer */
};
struct e1000_dev_head
@ -415,7 +415,7 @@ static int e1000_transmit(struct e1000_dev *e1000)
int tail = e1000->tx_ring.tail;
unsigned char *cp = (unsigned char *)
(e1000->tx_ring.buf + tail * CONFIG_E1000_BUFF_SIZE);
int count = e1000->uip_dev.d_len;
int count = e1000->netdev.d_len;
/* 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
@ -431,7 +431,7 @@ static int e1000_transmit(struct e1000_dev *e1000)
/* Send the packet: address=skel->sk_dev.d_buf, length=skel->sk_dev.d_len */
memcpy(cp, e1000->uip_dev.d_buf, e1000->uip_dev.d_len);
memcpy(cp, e1000->netdev.d_buf, e1000->netdev.d_len);
/* prepare the transmit-descriptor */
@ -485,9 +485,9 @@ static int e1000_uiptxpoll(struct net_driver_s *dev)
* the field d_len is set to a value > 0.
*/
if (e1000->uip_dev.d_len > 0)
if (e1000->netdev.d_len > 0)
{
arp_out(&e1000->uip_dev);
arp_out(&e1000->netdev);
e1000_transmit(e1000);
/* Check if there is room in the device to hold another packet. If not,
@ -555,14 +555,14 @@ static void e1000_receive(struct e1000_dev *e1000)
goto next;
}
/* Copy the data data from the hardware to e1000->uip_dev.d_buf. Set
* amount of data in e1000->uip_dev.d_len
/* Copy the data data from the hardware to e1000->netdev.d_buf. Set
* amount of data in e1000->netdev.d_len
*/
/* now we try to copy these data-bytes to the UIP buffer */
memcpy(e1000->uip_dev.d_buf, cp, cnt);
e1000->uip_dev.d_len = cnt;
memcpy(e1000->netdev.d_buf, cp, cnt);
e1000->netdev.d_len = cnt;
/* We only accept IP packets of the configured type and ARP packets */
@ -573,28 +573,28 @@ static void e1000_receive(struct e1000_dev *e1000)
if (BUF->type == HTONS(UIP_ETHTYPE_IP))
#endif
{
arp_ipin(&e1000->uip_dev);
uip_input(&e1000->uip_dev);
arp_ipin(&e1000->netdev);
uip_input(&e1000->netdev);
/* If the above function invocation resulted in data that should be
* sent out on the network, the field d_len will set to a value > 0.
*/
if (e1000->uip_dev.d_len > 0)
if (e1000->netdev.d_len > 0)
{
arp_out(&e1000->uip_dev);
arp_out(&e1000->netdev);
e1000_transmit(e1000);
}
}
else if (BUF->type == htons(UIP_ETHTYPE_ARP))
{
arp_arpin(&e1000->uip_dev);
arp_arpin(&e1000->netdev);
/* If the above function invocation resulted in data that should be
* sent out on the network, the field d_len will set to a value > 0.
*/
if (e1000->uip_dev.d_len > 0)
if (e1000->netdev.d_len > 0)
{
e1000_transmit(e1000);
}
@ -641,7 +641,7 @@ static void e1000_txtimeout(int argc, uint32_t arg, ...)
/* Then poll uIP for new XMIT data */
(void)uip_poll(&e1000->uip_dev, e1000_uiptxpoll);
(void)uip_poll(&e1000->netdev, e1000_uiptxpoll);
}
/****************************************************************************
@ -681,7 +681,7 @@ static void e1000_polltimer(int argc, uint32_t arg, ...)
* we will missing TCP time state updates?
*/
(void)uip_timer(&e1000->uip_dev, e1000_uiptxpoll, E1000_POLLHSEC);
(void)uip_timer(&e1000->netdev, e1000_uiptxpoll, E1000_POLLHSEC);
/* Setup the watchdog poll timer again */
@ -819,7 +819,7 @@ static int e1000_txavail(struct net_driver_s *dev)
if (e1000->tx_ring.desc[tail].desc_status)
{
(void)uip_poll(&e1000->uip_dev, e1000_uiptxpoll);
(void)uip_poll(&e1000->netdev, e1000_uiptxpoll);
}
}
@ -938,7 +938,7 @@ static irqreturn_t e1000_interrupt_handler(int irq, void *dev_id)
if (intr_cause & (1<<0))
{
uip_poll(&e1000->uip_dev, e1000_uiptxpoll);
uip_poll(&e1000->netdev, e1000_uiptxpoll);
}
@ -1070,19 +1070,19 @@ static int e1000_probe(uint16_t addr, pci_id_t id)
/* Initialize the driver structure */
dev->uip_dev.d_ifup = e1000_ifup; /* I/F up (new IP address) callback */
dev->uip_dev.d_ifdown = e1000_ifdown; /* I/F down callback */
dev->uip_dev.d_txavail = e1000_txavail; /* New TX data callback */
dev->netdev.d_ifup = e1000_ifup; /* I/F up (new IP address) callback */
dev->netdev.d_ifdown = e1000_ifdown; /* I/F down callback */
dev->netdev.d_txavail = e1000_txavail; /* New TX data callback */
#ifdef CONFIG_NET_IGMP
dev->uip_dev.d_addmac = e1000_addmac; /* Add multicast MAC address */
dev->uip_dev.d_rmmac = e1000_rmmac; /* Remove multicast MAC address */
dev->netdev.d_addmac = e1000_addmac; /* Add multicast MAC address */
dev->netdev.d_rmmac = e1000_rmmac; /* Remove multicast MAC address */
#endif
dev->uip_dev.d_private = dev; /* Used to recover private state from dev */
dev->netdev.d_private = dev; /* Used to recover private state from dev */
/* Create a watchdog for timing polling for and timing of transmisstions */
dev->txpoll = wd_create(); /* Create periodic poll timer */
dev->txtimeout = wd_create(); /* Create TX timeout timer */
dev->txpoll = wd_create(); /* Create periodic poll timer */
dev->txtimeout = wd_create(); /* Create TX timeout timer */
/* Put the interface in the down state.
* e1000 reset
@ -1092,11 +1092,11 @@ static int e1000_probe(uint16_t addr, pci_id_t id)
/* Read the MAC address from the hardware */
memcpy(dev->uip_dev.d_mac.ether_addr_octet, (void *)(dev->io_mem_base+E1000_RA), 6);
memcpy(dev->netdev.d_mac.ether_addr_octet, (void *)(dev->io_mem_base+E1000_RA), 6);
/* Register the device with the OS so that socket IOCTLs can be performed */
err = netdev_register(&dev->uip_dev);
err = netdev_register(&dev->netdev);
if (err)
{
goto err2;
@ -1145,7 +1145,7 @@ void e1000_mod_exit(void)
for (dev=e1000_list.next; dev!=NULL; dev=dev->next)
{
netdev_unregister(&dev->uip_dev);
netdev_unregister(&dev->netdev);
e1000_reset(dev);
wd_delete(dev->txpoll);
wd_delete(dev->txtimeout);