本文整理汇总了C++中LINK_STATS_INC函数的典型用法代码示例。如果您正苦于以下问题:C++ LINK_STATS_INC函数的具体用法?C++ LINK_STATS_INC怎么用?C++ LINK_STATS_INC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LINK_STATS_INC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: netfe_incoming
static void netfe_incoming(netfe_t *fe, uint8_t *packet, int pack_len)
{
#ifdef EXP_LINC_LATENCY
// DSCP:ECN must be 42
// 6 +6 +2 ether
// 20 ip
// - icmp
if (pack_len >= 6 +6 +2 +20 && packet[6 +6 +2 +1] == 42)
linc_incoming(fe->index);
#endif // EXP_LINC_LATENCY
// NI
if (fe->attached_lwip_netif != 0)
{
LINK_STATS_INC(link.recv);
struct pbuf *p = packet_to_pbuf(packet, pack_len);
if (p != 0)
{
struct netif *nf = fe->attached_lwip_netif;
if (nf->input(p, nf) != ERR_OK)
{
printk("netfe_incoming: input error\n");
pbuf_free(p);
}
}
else
{
//printk("netfe_incoming: packet dropped\n");
LINK_STATS_INC(link.memerr);
LINK_STATS_INC(link.drop);
}
}
// OL
if (fe->attached_outlet != 0)
outlet_new_data(fe->attached_outlet, packet, pack_len);
}
示例2: low_level_output
/**
* This function should do the actual transmission of the packet. The packet is
* contained in the pbuf that is passed to the function. This pbuf
* might be chained.
*
* @param netif the lwip network interface structure for this ethernetif
* @param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
* @return ERR_OK if the packet could be sent
* an err_t value if the packet couldn't be sent
*
* @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
* strange results. You might consider waiting for space in the DMA queue
* to become availale since the stack doesn't retry to send a packet
* dropped because of memory failure (except for the TCP timers).
*/
static err_t low_level_output(struct netif *netif, struct pbuf *p)
{
struct pbuf *q;
u32_t l = 0;
unsigned char *pcTxData;
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif
/* Get a DMA buffer into which we can write the data to send. */
for( int i = 0; i < netifBUFFER_WAIT_ATTEMPTS; i++ ) {
pcTxData = pcGetNextBuffer();
if( pcTxData ) {
break;
} else {
vTaskDelay( netifBUFFER_WAIT_DELAY );
}
}
if (pcTxData == NULL) {
portNOP();
return ERR_BUF;
} else {
for(q = p; q != NULL; q = q->next) {
/* Send the data from the pbuf to the interface, one pbuf at a
time. The size of the data in each pbuf is kept in the ->len
variable. */
vTaskSuspendAll();
memcpy(&pcTxData[l], (u8_t*)q->payload, q->len);
xTaskResumeAll();
l += q->len;
}
}
ENET_TxPkt( &pcTxData, l );
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif
LINK_STATS_INC(link.xmit);
return ERR_OK;
}
示例3: handleDataEvt
static void handleDataEvt(cbBCM_Handle connHandle, cb_uint8* pData, cb_uint16 length)
{
(void)connHandle;
struct pbuf* pbuf;
struct netif* netif = &panIf.hInterface;
pbuf = (struct pbuf*)cbIP_allocDataFrame(length);
MBED_ASSERT(pbuf != NULL);
cb_boolean status = cbIP_copyToDataFrame((cbIP_frame*)pbuf,pData,length,0);
MBED_ASSERT(status);
panIf.statusCallback(cbIP_NETWORK_ACTIVITY, NULL, NULL, panIf.callbackArg);
netif->input(pbuf, netif);
LINK_STATS_INC(link.recv);
}
示例4: low_level_output
static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
struct pbuf *q;
#ifdef FREERTOS_USED
static xSemaphoreHandle xTxSemaphore = NULL;
#endif
( void )netif; // Unused param, avoid a compiler warning.
#ifdef FREERTOS_USED
if( xTxSemaphore == NULL )
{
vSemaphoreCreateBinary( xTxSemaphore );
}
#endif
#if ETH_PAD_SIZE
pbuf_header( p, -ETH_PAD_SIZE ); /* drop the padding word */
#endif
#ifdef FREERTOS_USED
/* Access to the MACB is guarded using a semaphore. */
if( xSemaphoreTake( xTxSemaphore, netifGUARD_BLOCK_NBTICKS ) )
{
#endif
for( q = p; q != NULL; q = q->next )
{
/* Send the data from the pbuf to the interface, one pbuf at a time. The
size of the data in each pbuf is kept in the ->len variable.
This function also signals to the MACB that the packet should be sent. */
lMACBSend(&AVR32_MACB, q->payload, q->len, ( q->next == NULL ) );
}
#ifdef FREERTOS_USED
xSemaphoreGive( xTxSemaphore );
}
#endif
#if ETH_PAD_SIZE
pbuf_header( p, ETH_PAD_SIZE ); /* reclaim the padding word */
#endif
LINK_STATS_INC(link.xmit); // Traces
return ERR_OK;
}
示例5: low_level_output
static err_t low_level_output(struct netif *netif, struct pbuf *p)
{
struct pbuf *q = NULL;
int l = 0;
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif
pin_toggle();
if (g_bTimerStopped) {
csi_kernel_timer_stop(timer_send_handle);
csi_kernel_timer_start(timer_send_handle, csi_kernel_ms2tick(10000));
g_bTimerStopped = 0;
}
csi_eth_mac_ex_send_frame_begin(eth_mac_handle, p->tot_len);
for (q = p; q != NULL; q = q->next) {
csi_eth_mac_ex_send_frame(eth_mac_handle, q->payload, q->len, 0);
l = l + q->len;
}
csi_eth_mac_ex_send_frame_end(eth_mac_handle);
pin_toggle();
MIB2_STATS_NETIF_ADD(netif, ifoutoctets, p->tot_len);
if (((u8_t *)p->payload)[0] & 1) {
/* broadcast or multicast packet */
MIB2_STATS_NETIF_INC(netif, ifoutnucastpkts);
} else {
/* unicast packet */
MIB2_STATS_NETIF_INC(netif, ifoutucastpkts);
}
/* increase ifoutdiscards or ifouterrors on error */
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif
LINK_STATS_INC(link.xmit);
return ERR_OK;
}
示例6: pbuf_alloc
/**
* Should allocate a pbuf and transfer the bytes of the incoming
* packet from the interface into the pbuf.
*
* @param pxNetIf the lwip network interface structure for this ethernetif
* @return a pbuf filled with the received packet (including MAC header)
* NULL on memory error
*/
static struct pbuf *prvLowLevelInput( const unsigned char * const pucInputData, long lDataLength )
{
struct pbuf *p = NULL, *q;
if( lDataLength > 0 )
{
#if ETH_PAD_SIZE
len += ETH_PAD_SIZE; /* allow room for Ethernet padding */
#endif
/* We allocate a pbuf chain of pbufs from the pool. */
p = pbuf_alloc( PBUF_RAW, lDataLength, PBUF_POOL );
if( p != NULL )
{
#if ETH_PAD_SIZE
pbuf_header( p, -ETH_PAD_SIZE ); /* drop the padding word */
#endif
/* We iterate over the pbuf chain until we have read the entire
* packet into the pbuf. */
lDataLength = 0;
for( q = p; q != NULL; q = q->next )
{
/* Read enough bytes to fill this pbuf in the chain. The
* available data in the pbuf is given by the q->len
* variable.
* This does not necessarily have to be a memcpy, you can also preallocate
* pbufs for a DMA-enabled MAC and after receiving truncate it to the
* actually received size. In this case, ensure the usTotalLength member of the
* pbuf is the sum of the chained pbuf len members.
*/
memcpy( q->payload, &( pucInputData[ lDataLength ] ), q->len );
lDataLength += q->len;
}
#if ETH_PAD_SIZE
pbuf_header( p, ETH_PAD_SIZE ); /* reclaim the padding word */
#endif
LINK_STATS_INC( link.recv );
}
}
return p;
}
示例7: eth_output
static err_t eth_output(struct netif *netif, struct pbuf *p) {
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif
do {
pEth->write((const char *)p->payload, p->len);
} while((p = p->next)!=NULL);
pEth->send();
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif
LINK_STATS_INC(link.xmit);
return ERR_OK;
}
示例8: low_level_output
/**
* This function should do the actual transmission of the packet. The packet is
* contained in the pbuf that is passed to the function. This pbuf
* might be chained.
*
* @param netif the lwip network interface structure for this ethernetif
* @param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
* @return ERR_OK if the packet could be sent
* an err_t value if the packet couldn't be sent
*
* @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
* strange results. You might consider waiting for space in the DMA queue
* to become availale since the stack doesn't retry to send a packet
* dropped because of memory failure (except for the TCP timers).
*/
static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif
//acoral_prints("\r\nlowLOutput=sta\r\n");
//hw_sendPacket(p);
acoral_dev_write(net_dev_id, p, 0, 0, 0);
//acoral_prints("\r\nlowLOutput=end\r\n");
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif
LINK_STATS_INC(link.xmit);
return ERR_OK;
}
示例9: low_level_output
static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
struct ethernetif *ethernetif = netif->state;
struct pbuf *q;
uint8 result;
uint8 index = 0;
err_t err = ERR_OK;
TCPIP_PACKET_INFO_T tcpip_packet;
TCPIP_PACKET_INFO_T *p_packet = &tcpip_packet;
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif
p_packet->packet_len = 0;
for(q = p; q != NULL; q = q->next) {
/* Send the data from the pbuf to the interface, one pbuf at a
time. The size of the data in each pbuf is kept in the ->len
variable. */
p_packet->data_ptr[index] = q->payload;
p_packet->data_len[index] = q->len;
p_packet->packet_len += q->len;
index++;
}
p_packet->pbuf_num = index;
if (ethernetif->tcpip_wifi_xmit) {
result = ethernetif->tcpip_wifi_xmit(&tcpip_packet);
if (result != 0) {
DEBUG_ERROR("the xmit packet is dropped!");
err = ERR_IF;
}
}
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif
LINK_STATS_INC(link.xmit);
return err;
}
示例10: low_level_output
static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
struct pbuf *q;
static xSemaphoreHandle xTxSemaphore = NULL;
err_t xReturn = ERR_OK;
( void )netif; // Unused param, avoid a compiler warning.
if( xTxSemaphore == NULL )
{
vSemaphoreCreateBinary( xTxSemaphore );
}
#if ETH_PAD_SIZE
pbuf_header( p, -ETH_PAD_SIZE ); /* drop the padding word */
#endif
/* Access to the MACB is guarded using a semaphore. */
if( xSemaphoreTake( xTxSemaphore, netifGUARD_BLOCK_NBTICKS ) )
{
for( q = p; q != NULL; q = q->next )
{
/* Send the data from the pbuf to the interface, one pbuf at a
time. The size of the data in each pbuf is kept in the ->len
variable. if q->next == NULL then this is the last pbuf in the
chain. */
if( !lMACBSend(&AVR32_MACB, q->payload, q->len, ( q->next == NULL ) ) )
{
xReturn = ~ERR_OK;
}
}
xSemaphoreGive( xTxSemaphore );
}
#if ETH_PAD_SIZE
pbuf_header( p, ETH_PAD_SIZE ); /* reclaim the padding word */
#endif
LINK_STATS_INC(link.xmit); // Traces
return ERR_OK;
}
示例11: low_level_output
/**
* \brief This function should do the actual transmission of the packet. The
* packet is contained in the pbuf that is passed to the function. This pbuf
* might be chained.
* note: Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
* strange results. You might consider waiting for space in the DMA queue
* to become available since the stack doesn't retry to send a packet
* dropped because of memory failure (except for the TCP timers).
*
* \param netif the lwip network interface structure for this ethernetif
* \param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
*
* \return ERR_OK if the packet could be sent
* an err_t value if the packet couldn't be sent.
*/
static err_t low_level_output(struct netif *netif, struct pbuf *p)
{
struct pbuf *q = NULL;
int8_t pc_buf[NET_RW_BUFF_SIZE];
int8_t *bufptr = &pc_buf[0];
uint8_t uc_rc;
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* Drop the padding word */
#endif
/* Check the buffer boundary */
if (p->tot_len > NET_RW_BUFF_SIZE) {
return ERR_BUF;
}
/* Clear the output buffer */
memset(bufptr, 0x0, NET_RW_BUFF_SIZE);
for (q = p; q != NULL; q = q->next) {
/* Send the data from the pbuf to the interface, one pbuf at a
* time. The size of the data in each pbuf is kept in the ->len
* variable. */
/* Send data from(q->payload, q->len); */
memcpy(bufptr, q->payload, q->len);
bufptr += q->len;
}
/* Signal that packet should be sent(); */
uc_rc = emac_dev_write(&gs_emac_dev, pc_buf, p->tot_len, NULL);
if (uc_rc != EMAC_OK) {
return ERR_BUF;
}
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* Reclaim the padding word */
#endif
LINK_STATS_INC(link.xmit);
return ERR_OK;
}
示例12: netfe_output
void netfe_output(netfe_t *fe, uint8_t *packet, int pack_len)
{
assert(pack_len <= ETH_MTU +ETH_HDR_LEN +ETH_CSUM_LEN);
assert(pack_len <= PAGE_SIZE);
#ifdef EXP_LINC_LATENCY
// see comment above
if (pack_len >= 6 +6 +2 +20 && packet[6 +6 +2 +1] == 42)
linc_output(fe->index);
#endif // EXP_LINC_LATENCY
if (fe->free_tx_head == NO_TX_BUFFER)
{
//printk("netfe_output: packet dropped [size %d]\n", pack_len);
LINK_STATS_INC(link.drop);
return;
}
int tx_buf = fe->free_tx_head;
fe->free_tx_head = fe->free_tx_bufs[tx_buf];
uint8_t *p = fe->tx_buffers[tx_buf];
memcpy(p, packet, pack_len);
RING_IDX prod = fe->tx_ring.req_prod_pvt;
netif_tx_request_t *req = RING_GET_REQUEST(&fe->tx_ring, prod);
req->gref = fe->tx_buf_refs[tx_buf];
req->id = tx_buf;
req->offset = 0;
req->flags = 0;
req->size = pack_len;
fe->tx_ring.req_prod_pvt = prod +1;
wmb(); // dark
int notify;
RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&fe->tx_ring, notify);
if (notify)
event_kick(fe->evtchn);
netfe_tx_buf_gc(fe);
}
示例13: netif_output
static err_t netif_output(struct netif *netif, struct pbuf *p)
{
LINK_STATS_INC(link.xmit);
/* Update SNMP stats (only if you use SNMP) */
MIB2_STATS_NETIF_ADD(netif, ifoutoctets, p->tot_len);
int unicast = ((p->payload[0] & 0x01) == 0);
if (unicast) {
MIB2_STATS_NETIF_INC(netif, ifoutucastpkts);
} else {
MIB2_STATS_NETIF_INC(netif, ifoutnucastpkts);
}
lock_interrupts();
pbuf_copy_partial(p, mac_send_buffer, p->tot_len, 0);
/* Start MAC transmit here */
unlock_interrupts();
return ERR_OK;
}
示例14: linkoutput
static err_t linkoutput(struct netif *netif, struct pbuf *p)
{
struct ethernetif *ethernetif = netif->state;
struct pbuf *q;
uint16_t total_len = p->tot_len; // The length of the packet.
int fragcnt = 0; // The number of fragments.
unsigned flags = ethernetif->ops->flags;
if (flags & ETHIF_FRAGCNT) {
// Pre-calculate the number of fragments for startoutput().
for(q = p; q != NULL; q = q->next) {
++fragcnt;
}
}
if(!ethernetif->ops->startoutput(ethernetif->priv, total_len, fragcnt))
return ERR_IF;
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); // Drop the padding word.
#endif
for(q = p; q != NULL; q = q->next) {
/* Send the data from the pbuf to the interface, one pbuf at a
* time. The size of the data in each pbuf is kept in the ->len
* variable.
*/
ethernetif->ops->output(ethernetif->priv, q->payload, q->len);
}
ethernetif->ops->endoutput(ethernetif->priv, total_len);
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); // Reclaim the padding word.
#endif
LINK_STATS_INC(link.xmit);
return ERR_OK;
}
示例15: low_level_output
static err_t low_level_output(UNUSED_ARG(struct netif *, netif), struct pbuf *p)
{
struct pbuf *q;
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif
proc_forbid();
for (q = p; q != NULL; q = q->next)
eth_putFrame(q->payload, q->len);
eth_sendFrame();
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif
LINK_STATS_INC(link.xmit);
proc_permit();
return ERR_OK;
}