FreeBSD/sys/dev/ixgbe/if_ixv.c
/*
 * Add statistic sysctls for the VF.
 */
Add statistic sysctls for the VF.
Add statistic sysctls for the VF .
static void
ixv_add_stats_sysctls(struct adapter *adapter)
{
	device_t dev = adapter->dev;
	struct ix_queue *que = &adapter->queues[0];
	struct tx_ring *txr = que->txr;
	struct rx_ring *rxr = que->rxr;
	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
	struct sysctl_oid *tree = device_get_sysctl_tree(dev);
	struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
	struct ixgbevf_hw_stats *stats = &adapter->stats.vf;
	struct sysctl_oid *stat_node, *queue_node;
	struct sysctl_oid_list *stat_list, *queue_list;
	SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped",
			CTLFLAG_RD, &adapter->dropped_pkts,
			"Driver dropped packets");
	SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_defrag_failed",
			CTLFLAG_RD, &adapter->mbuf_defrag_failed,
			"m_defrag() failed");
	SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "watchdog_events",
			CTLFLAG_RD, &adapter->watchdog_events,
			"Watchdog timeouts");
	stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac",
				    CTLFLAG_RD, NULL,
				    "VF Statistics (read from HW registers)");
	stat_list = SYSCTL_CHILDREN(stat_node);
	SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "good_pkts_rcvd",
			CTLFLAG_RD, &stats->vfgprc,
			"Good Packets Received");
	SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "good_octets_rcvd",
			CTLFLAG_RD, &stats->vfgorc, 
			"Good Octets Received"); 
	SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_rcvd",
			CTLFLAG_RD, &stats->vfmprc,
			"Multicast Packets Received");
	SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "good_pkts_txd",
			CTLFLAG_RD, &stats->vfgptc,
			"Good Packets Transmitted");
	SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "good_octets_txd",
			CTLFLAG_RD, &stats->vfgotc, 
			"Good Octets Transmitted"); 
	queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "que",
				    CTLFLAG_RD, NULL,
				    "Queue Statistics (collected by SW)");
	queue_list = SYSCTL_CHILDREN(queue_node);
	SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "irqs",
			CTLFLAG_RD, &(que->irqs),
			"IRQs on queue");
	SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_irqs",
			CTLFLAG_RD, &(rxr->rx_irq),
			"RX irqs on queue");
	SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_packets",
			CTLFLAG_RD, &(rxr->rx_packets),
			"RX packets");
	SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_bytes",
			CTLFLAG_RD, &(rxr->rx_bytes),
			"RX bytes");
	SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "rx_discarded",
			CTLFLAG_RD, &(rxr->rx_discarded),
			"Discarded RX packets");
	SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "tx_packets",
			CTLFLAG_RD, &(txr->total_packets),
			"TX Packets");
	SYSCTL_ADD_UQUAD(ctx, queue_list, OID_AUTO, "tx_no_desc",
			CTLFLAG_RD, &(txr->no_desc_avail),
			"# of times not enough descriptors were available during TX");
}
static void ixv_add_stats_sysctls ( struct adapter * adapter ) { device_t dev = adapter -> dev ; struct ix_queue * que = & adapter -> queues [ 0 ] ; struct tx_ring * txr = que -> txr ; struct rx_ring * rxr = que -> rxr ; struct sysctl_ctx_list * ctx = device_get_sysctl_ctx ( dev ) ; struct sysctl_oid * tree = device_get_sysctl_tree ( dev ) ; struct sysctl_oid_list * child = SYSCTL_CHILDREN ( tree ) ; struct ixgbevf_hw_stats * stats = & adapter -> stats . vf ; struct sysctl_oid * stat_node , * queue_node ; struct sysctl_oid_list * stat_list , * queue_list ; SYSCTL_ADD_ULONG ( ctx , child , OID_AUTO , " " , CTLFLAG_RD , & adapter -> dropped_pkts , " " ) ; SYSCTL_ADD_ULONG ( ctx , child , OID_AUTO , " " , CTLFLAG_RD , & adapter -> mbuf_defrag_failed , " " ) ; SYSCTL_ADD_ULONG ( ctx , child , OID_AUTO , " " , CTLFLAG_RD , & adapter -> watchdog_events , " " ) ; stat_node = SYSCTL_ADD_NODE ( ctx , child , OID_AUTO , " " , CTLFLAG_RD , NULL , " " ) ; stat_list = SYSCTL_CHILDREN ( stat_node ) ; SYSCTL_ADD_UQUAD ( ctx , stat_list , OID_AUTO , " " , CTLFLAG_RD , & stats -> vfgprc , " " ) ; SYSCTL_ADD_UQUAD ( ctx , stat_list , OID_AUTO , " " , CTLFLAG_RD , & stats -> vfgorc , " " ) ; SYSCTL_ADD_UQUAD ( ctx , stat_list , OID_AUTO , " " , CTLFLAG_RD , & stats -> vfmprc , " " ) ; SYSCTL_ADD_UQUAD ( ctx , stat_list , OID_AUTO , " " , CTLFLAG_RD , & stats -> vfgptc , " " ) ; SYSCTL_ADD_UQUAD ( ctx , stat_list , OID_AUTO , " " , CTLFLAG_RD , & stats -> vfgotc , " " ) ; queue_node = SYSCTL_ADD_NODE ( ctx , child , OID_AUTO , " " , CTLFLAG_RD , NULL , " " ) ; queue_list = SYSCTL_CHILDREN ( queue_node ) ; SYSCTL_ADD_UQUAD ( ctx , queue_list , OID_AUTO , " " , CTLFLAG_RD , & ( que -> irqs ) , " " ) ; SYSCTL_ADD_UQUAD ( ctx , queue_list , OID_AUTO , " " , CTLFLAG_RD , & ( rxr -> rx_irq ) , " " ) ; SYSCTL_ADD_UQUAD ( ctx , queue_list , OID_AUTO , " " , CTLFLAG_RD , & ( rxr -> rx_packets ) , " " ) ; SYSCTL_ADD_UQUAD ( ctx , queue_list , OID_AUTO , " " , CTLFLAG_RD , & ( rxr -> rx_bytes ) , " " ) ; SYSCTL_ADD_UQUAD ( ctx , queue_list , OID_AUTO , " " , CTLFLAG_RD , & ( rxr -> rx_discarded ) , " " ) ; SYSCTL_ADD_UQUAD ( ctx , queue_list , OID_AUTO , " " , CTLFLAG_RD , & ( txr -> total_packets ) , " " ) ; SYSCTL_ADD_UQUAD ( ctx , queue_list , OID_AUTO , " " , CTLFLAG_RD , & ( txr -> no_desc_avail ) , " " ) ; }
Add statistic sysctls for the VF.
Add statistic sysctls for the VF .
/* Driver Statistics */