src/netvsc_drv.c
/*
 * netvsc_recv_callback -  Callback when we receive a packet from the
 * "wire" on the specified device.
 */
Callback when we receive a packet from the
"wire" on the specified device.
Callback when we receive a packet from the " wire " on the specified device .
int netvsc_recv_callback(struct net_device *net,
			 struct netvsc_device *net_device,
			 struct netvsc_channel *nvchan)
{
	struct net_device_context *net_device_ctx = netdev_priv(net);
	struct vmbus_channel *channel = nvchan->channel;
	u16 q_idx = channel->offermsg.offer.sub_channel_index;
	struct sk_buff *skb;
	struct netvsc_stats *rx_stats;
	if (net->reg_state != NETREG_REGISTERED)
		return NVSP_STAT_FAIL;
	skb = netvsc_alloc_recv_skb(net, nvchan);
	if (unlikely(!skb)) {
		++net_device_ctx->eth_stats.rx_no_memory;
		return NVSP_STAT_FAIL;
	}
	skb_record_rx_queue(skb, q_idx);
	rx_stats = &nvchan->rx_stats;
	u64_stats_update_begin(&rx_stats->syncp);
	rx_stats->packets++;
	rx_stats->bytes += nvchan->rsc.pktlen;
	if (skb->pkt_type == PACKET_BROADCAST)
		++rx_stats->broadcast;
	else if (skb->pkt_type == PACKET_MULTICAST)
		++rx_stats->multicast;
	u64_stats_update_end(&rx_stats->syncp);
	napi_gro_receive(&nvchan->napi, skb);
	return NVSP_STAT_SUCCESS;
}
int netvsc_recv_callback ( struct net_device * net , struct netvsc_device * net_device , struct netvsc_channel * nvchan ) { struct net_device_context * net_device_ctx = netdev_priv ( net ) ; struct vmbus_channel * channel = nvchan -> channel ; u16 q_idx = channel -> offermsg . offer . sub_channel_index ; struct sk_buff * skb ; struct netvsc_stats * rx_stats ; if ( net -> reg_state != NETREG_REGISTERED ) return NVSP_STAT_FAIL ; skb = netvsc_alloc_recv_skb ( net , nvchan ) ; if ( unlikely ( ! skb ) ) { ++ net_device_ctx -> eth_stats . rx_no_memory ; return NVSP_STAT_FAIL ; } skb_record_rx_queue ( skb , q_idx ) ; rx_stats = & nvchan -> rx_stats ; u64_stats_update_begin ( & rx_stats -> syncp ) ; rx_stats -> packets ++ ; rx_stats -> bytes += nvchan -> rsc . pktlen ; if ( skb -> pkt_type == PACKET_BROADCAST ) ++ rx_stats -> broadcast ; else if ( skb -> pkt_type == PACKET_MULTICAST ) ++ rx_stats -> multicast ; u64_stats_update_end ( & rx_stats -> syncp ) ; napi_gro_receive ( & nvchan -> napi , skb ) ; return NVSP_STAT_SUCCESS ; }
netvsc_recv_callback -  Callback when we receive a packet from the
 "wire" on the specified device.
netvsc_recv_callback - Callback when we receive a packet from the " wire " on the specified device .
/* Allocate a skb - TODO direct I/O to pages? */ /*
	 * Even if injecting the packet, record the statistics
	 * on the synthetic device because modifying the VF device
	 * statistics will not work correctly.
	 */