📄 lan.c
字号:
/*-----------------------------------------------------------------*/
if (broadcats)
MG_stat.innucastpkts++;
else
MG_stat.inucastpkts++;
#if BSP_LITTLE_ENDIAN
/*-------------------------------------------------------------*/
/* Add code here to adjust packet type to network order */
/* (BIG ENDIAN). */
/*-------------------------------------------------------------*/
#endif
/*-----------------------------------------------------------------*/
/* Attach packet to a message block. */
/* The frtn struct will be used when the mblk is freed. */
/* Lower the interrupt mask to allow interrupts while we */
/* get the message buffer. */
/*-----------------------------------------------------------------*/
frtn.free_func = (void (*)())ni_retpkb;
frtn.free_arg = (char *) pkb + DATA_OFFSET;
splx(imask);
if ((mblkPtr = Ni_funcs.esballoc((UCHAR *)frame,
(count), 0, &frtn)) == 0)
{
/*-------------------------------------------------------------*/
/* There is no message block to attach the packet to so */
/* it will be droped. Set return_pkb so the packet will */
/* be added back to the Receive Frame Area. */
/*-------------------------------------------------------------*/
return_pkb = 1;
}
else
{
/*-------------------------------------------------------------*/
/* Set the message blocks write pointer to point to the */
/* end of the packets data area. */
/*-------------------------------------------------------------*/
mblkPtr->b_wptr += (pkb->count & 0x3fff) - 14;
/*-------------------------------------------------------------*/
/* Call the Announce_Packet function to send the packet to the */
/* protocol layer. */
/*-------------------------------------------------------------*/
psos_up_flag = (*ap_addr)(type,
(char *)mblkPtr,
(count & 0x3FFF),
if_num,
(char *)src_addr,
(char *)dist_addr);
/*---------------------------------------------------------*/
/* Raise interrupt mask to protect remain section. */
/*---------------------------------------------------------*/
imask = splx(MAX_ILEV);
}
}
/*---------------------------------------------------------------------*/
/* Add code here to clear any interrupt pending state of the chip */
/*---------------------------------------------------------------------*/
return psos_up_flag;
}
/***********************************************************************/
/* ni_pna_init: This function is called from the ni_ioctl function. */
/* It is used to tell the driver that pna has */
/* re/initialize. */
/* */
/* */
/* INPUTS: NONE */
/* */
/* RETURNS: NONE */
/* OUTPUTS: NONE */
/* NOTE(S): This function needs to do what ever is necessary to */
/* reinitialize the driver to a startup state. All */
/* receive and transmit buffers must be flushed. */
/* */
/***********************************************************************/
void ni_pna_init(void)
{
/*---------------------------------------------------------------------*/
/* Add code here */
/*---------------------------------------------------------------------*/
}
/***********************************************************************/
/* get_lan_indiscards: used by MIB to get the number of packets that */
/* were discarded because of lack of resources. */
/* */
/* INPUTS: NONE: */
/* */
/* RETURNS: number of discards because of lack of resources */
/* OUTPUTS: NONE */
/* NOTE(S): This function is called from lan_mib.c */
/* */
/***********************************************************************/
long get_lan_indiscards(void)
{
/*---------------------------------------------------------------------*/
/* Add code here to get the number of packets discarded because of */
/* lack of resources such as no message blocks. */
/*---------------------------------------------------------------------*/
return((long)0);
}
/***********************************************************************/
/* get_lan_inerrors: used by MIB to get number of packets that were */
/* discarded bacause of errors. */
/* */
/* */
/* INPUTS: NONE: */
/* */
/* RETURNS: number of packets discarded because of errors */
/* OUTPUTS: NONE */
/* NOTE(S): This function is called from lan_mib.c */
/* */
/***********************************************************************/
long get_lan_inerrors(void)
{
/*---------------------------------------------------------------------*/
/* Add code here to get the number of incomming packet that were */
/* discarded because of errors such as overruns. */
/*---------------------------------------------------------------------*/
return((long)0);
}
/***********************************************************************/
/* get_lan_outerrors: used by MIB to get number of out packets that */
/* were discarded bacause of errors. */
/* */
/* */
/* INPUTS: NONE: */
/* */
/* RETURNS: number of packets discarded because of errors */
/* OUTPUTS: NONE */
/* NOTE(S): This function is called from lan_mib.c */
/* */
/***********************************************************************/
long get_lan_outerrors(void)
{
/*---------------------------------------------------------------------*/
/* Add code here to get the number of out going packets that were */
/* discarded due to errors. */
/*---------------------------------------------------------------------*/
return((long)0);
}
/***********************************************************************/
/* get_lan_outdiscards: used by MIB to get the number of packets out */
/* that were discarded because of lack of */
/* resources. */
/* */
/* INPUTS: NONE: */
/* */
/* RETURNS: number of discards because of lack of resources */
/* OUTPUTS: NONE */
/* NOTE(S): This function is called from lan_mib.c */
/* */
/***********************************************************************/
long get_lan_outdiscards(void)
{
/*---------------------------------------------------------------------*/
/* Add code here to get the number of out going packets that were */
/* discarded due to lack of resources such as transmit queue full. */
/*---------------------------------------------------------------------*/
return((long)0);
}
/***********************************************************************/
/* clear: clear a memory area. */
/* */
/* INPUTS: pointer to start of memory to be cleared */
/* size of memory to be cleared */
/* */
/* RETURNS: NONE */
/* OUTPUTS: NONE */
/* NOTE(S): Simple clear memory function */
/* */
/***********************************************************************/
static void clear(volatile void *ptr, ULONG size)
{
while (size--) *((char *)ptr)++ = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -