set netif->output to etharp_output by default to save a function call & removed all the xxx_output() functions that directly called etharp_output().

This commit is contained in:
goldsimon 2007-06-08 22:52:59 +00:00
parent 58dcaae372
commit dac9674c0d
8 changed files with 7 additions and 115 deletions

View File

@ -76,7 +76,6 @@ void cs8900if_reset(struct netif *netif);
err_t cs8900if_init(struct netif *); err_t cs8900if_init(struct netif *);
void cs8900if_service(struct netif *); void cs8900if_service(struct netif *);
void cs8900if_input(struct netif *netif); void cs8900if_input(struct netif *netif);
err_t cs8900if_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr);
void cs8900_send_debug(u8_t *p, u16_t len); void cs8900_send_debug(u8_t *p, u16_t len);

View File

@ -410,21 +410,6 @@ low_level_output(struct netif *netif, struct pbuf *p)
return ERR_OK; return ERR_OK;
} }
/*-----------------------------------------------------------------------------------*/
/*
* This function is called by the TCP/IP stack when an IP packet
* should be sent. It calls the function called low_level_output() to
* do the actuall transmission of the packet.
*
*/
/*-----------------------------------------------------------------------------------*/
static err_t
mcf5272fecif_output(struct netif *netif, struct pbuf *p,
struct ip_addr *ipaddr)
{
return etharp_output(netif, ipaddr, p);
}
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
static void static void
eth_input(struct pbuf *p, struct netif *netif) eth_input(struct pbuf *p, struct netif *netif)
@ -770,7 +755,7 @@ mcf5272fecif_init(struct netif *netif)
mcf5272if->netif = netif; mcf5272if->netif = netif;
netif->name[0] = IFNAME0; netif->name[0] = IFNAME0;
netif->name[1] = IFNAME1; netif->name[1] = IFNAME1;
netif->output = mcf5272fecif_output; netif->output = etharp_output;
netif->linkoutput = low_level_output; netif->linkoutput = low_level_output;
netif->mtu = MTU_FEC - 18; // mtu without ethernet header and crc netif->mtu = MTU_FEC - 18; // mtu without ethernet header and crc
mcf5272if->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); mcf5272if->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]);

View File

@ -88,8 +88,6 @@ static struct eth_addr broadcastaddr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
/* Forward declarations. */ /* Forward declarations. */
static void ethernetif_input(struct netif *netif); static void ethernetif_input(struct netif *netif);
static err_t ethernetif_output(struct netif *netif, struct pbuf *p,
struct ip_addr *ipaddr);
static struct netif *pktif_netif; static struct netif *pktif_netif;
@ -223,22 +221,7 @@ low_level_input(struct netif *netif)
return p; return p;
} }
/*-----------------------------------------------------------------------------------*/
/*
* ethernetif_output():
*
* This function is called by the TCP/IP stack when an IP packet
* should be sent. It calls the function called low_level_output() to
* do the actuall transmission of the packet.
*
*/
/*-----------------------------------------------------------------------------------*/
static err_t
ethernetif_output(struct netif *netif, struct pbuf *p,
struct ip_addr *ipaddr)
{
return etharp_output(netif, ipaddr, p);
}
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/* /*
* ethernetif_input(): * ethernetif_input():
@ -309,7 +292,7 @@ ethernetif_init(struct netif *netif)
netif->name[0] = IFNAME0; netif->name[0] = IFNAME0;
netif->name[1] = IFNAME1; netif->name[1] = IFNAME1;
netif->linkoutput = low_level_output; netif->linkoutput = low_level_output;
netif->output = ethernetif_output; netif->output = etharp_output;
netif->mtu = 1500; netif->mtu = 1500;
netif->flags = NETIF_FLAG_BROADCAST; netif->flags = NETIF_FLAG_BROADCAST;

View File

@ -31,7 +31,6 @@ err_t ne2k_init(struct netif *netif);
static void low_level_init(struct netif * netif); static void low_level_init(struct netif * netif);
static void arp_timer(void *arg); static void arp_timer(void *arg);
static err_t ne2k_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr);
static err_t low_level_output(struct netif * netif,struct pbuf *p); static err_t low_level_output(struct netif * netif,struct pbuf *p);
u16_t write_AX88796(u8_t * buf, u16_t remote_Addr, u16_t Count); u16_t write_AX88796(u8_t * buf, u16_t remote_Addr, u16_t Count);

View File

@ -60,7 +60,7 @@ err_t ne2k_init(struct netif *netif)
netif->state = ne2k_if; netif->state = ne2k_if;
netif->name[0] = IFNAME0; netif->name[0] = IFNAME0;
netif->name[1] = IFNAME1; netif->name[1] = IFNAME1;
netif->output = ne2k_output; netif->output = etharp_output;
netif->linkoutput = low_level_output; netif->linkoutput = low_level_output;
ne2k_if->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); ne2k_if->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]);
@ -179,22 +179,6 @@ static void low_level_init(struct netif * netif)
**************************************************************************************** ****************************************************************************************
----------------------------------------------------------------------------------------*/ ----------------------------------------------------------------------------------------*/
/*
* ethernetif_output():
*
* This function is called by the TCP/IP stack when an IP packet
* should be sent. It calls the function called low_level_output() to
* do the actual transmission of the packet.
*
*/
static err_t
ne2k_output(struct netif *netif, struct pbuf *p,
struct ip_addr *ipaddr)
{
/* resolve hardware address, then send (or queue) packet */
return etharp_output(netif, ipaddr, p);
}
/* /*
* low_level_output(): * low_level_output():
* *

View File

@ -82,8 +82,6 @@ struct tapif {
/* Forward declarations. */ /* Forward declarations. */
static void tapif_input(struct netif *netif); static void tapif_input(struct netif *netif);
static err_t tapif_output(struct netif *netif, struct pbuf *p,
struct ip_addr *ipaddr);
static void tapif_thread(void *data); static void tapif_thread(void *data);
@ -264,22 +262,6 @@ tapif_thread(void *arg)
} }
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/*
* tapif_output():
*
* This function is called by the TCP/IP stack when an IP packet
* should be sent. It calls the function called low_level_output() to
* do the actuall transmission of the packet.
*
*/
/*-----------------------------------------------------------------------------------*/
static err_t
tapif_output(struct netif *netif, struct pbuf *p,
struct ip_addr *ipaddr)
{
return etharp_output(netif, ipaddr, p);
}
/*-----------------------------------------------------------------------------------*/
/* /*
* tapif_input(): * tapif_input():
* *
@ -359,7 +341,7 @@ tapif_init(struct netif *netif)
netif->state = tapif; netif->state = tapif;
netif->name[0] = IFNAME0; netif->name[0] = IFNAME0;
netif->name[1] = IFNAME1; netif->name[1] = IFNAME1;
netif->output = tapif_output; netif->output = etharp_output;
netif->linkoutput = low_level_output; netif->linkoutput = low_level_output;
netif->mtu = 1500; netif->mtu = 1500;
/* hardware address length */ /* hardware address length */

View File

@ -81,8 +81,6 @@ static const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};
/* Forward declarations. */ /* Forward declarations. */
static void mintapif_input(struct netif *netif); static void mintapif_input(struct netif *netif);
static err_t mintapif_output(struct netif *netif, struct pbuf *p,
struct ip_addr *ipaddr);
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
static void static void
@ -233,22 +231,6 @@ low_level_input(struct netif *netif)
return p; return p;
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/*
* mintapif_output():
*
* This function is called by the TCP/IP stack when an IP packet
* should be sent. It calls the function called low_level_output() to
* do the actuall transmission of the packet.
*
*/
/*-----------------------------------------------------------------------------------*/
static err_t
mintapif_output(struct netif *netif, struct pbuf *p,
struct ip_addr *ipaddr)
{
return etharp_output(netif, ipaddr, p);
}
/*-----------------------------------------------------------------------------------*/
/* /*
* mintapif_input(): * mintapif_input():
* *
@ -341,7 +323,7 @@ mintapif_init(struct netif *netif)
netif->hwaddr_len = 6; netif->hwaddr_len = 6;
netif->name[0] = IFNAME0; netif->name[0] = IFNAME0;
netif->name[1] = IFNAME1; netif->name[1] = IFNAME1;
netif->output = mintapif_output; netif->output = etharp_output;
netif->linkoutput = low_level_output; netif->linkoutput = low_level_output;
netif->mtu = 1500; netif->mtu = 1500;

View File

@ -84,12 +84,6 @@
static const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}}; static const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};
extern XEmacIf_Config XEmacIf_ConfigTable[]; extern XEmacIf_Config XEmacIf_ConfigTable[];
/*---------------------------------------------------------------------------*/
/* Forward declarations */
/*---------------------------------------------------------------------------*/
static err_t xemacif_output(struct netif *netif, struct pbuf *p,
struct ip_addr *ipaddr);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* low_level_init function */ /* low_level_init function */
/* - hooks up the data structures and sets the mac options and mac */ /* - hooks up the data structures and sets the mac options and mac */
@ -289,22 +283,6 @@ static struct pbuf * low_level_input(XEmacIf_Config *xemacif_ptr)
return p; return p;
} }
/*---------------------------------------------------------------------------*/
/* xemacif_output(): */
/* */
/* This function is called by the TCP/IP stack when an IP packet */
/* should be sent. It calls the function called low_level_output() to */
/* do the actuall transmission of the packet. */
/*---------------------------------------------------------------------------*/
static err_t xemacif_output(struct netif *netif_ptr,
struct pbuf *p,
struct ip_addr *ipaddr)
{
XEmacIf_Config *xemacif_ptr = xemacif_ptr = netif_ptr->state;
return etharp_output(netif_ptr, ipaddr, p);
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* xemacif_input(): */ /* xemacif_input(): */
/* */ /* */
@ -396,7 +374,7 @@ err_t xemacif_init(struct netif *netif_ptr)
netif_ptr->hwaddr[5] = xemacif_ptr->ethaddr.addr[5]; netif_ptr->hwaddr[5] = xemacif_ptr->ethaddr.addr[5];
netif_ptr->name[0] = IFNAME0; netif_ptr->name[0] = IFNAME0;
netif_ptr->name[1] = IFNAME1; netif_ptr->name[1] = IFNAME1;
netif_ptr->output = xemacif_output; netif_ptr->output = etharp_output;
netif_ptr->linkoutput = low_level_output; netif_ptr->linkoutput = low_level_output;
/* removed this statement because the ethaddr in the XEmacIf_Config /* removed this statement because the ethaddr in the XEmacIf_Config