drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_tqp_stats.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_tqp_stats.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/hisilicon/hns3/hns3_common/hclge_comm_tqp_stats.c
Extension
.c
Size
3115 bytes
Lines
116
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ret) {
			dev_err(&hw->cmq.csq.pdev->dev,
				"failed to get tqp stat, ret = %d, rx = %u.\n",
				ret, i);
			return ret;
		}
		tqp->tqp_stats.rcb_rx_ring_pktnum_rcd +=
			le32_to_cpu(desc.data[1]);

		hclge_comm_cmd_setup_basic_desc(&desc, HCLGE_OPC_QUERY_TX_STATS,
						true);

		desc.data[0] = cpu_to_le32(tqp->index);
		ret = hclge_comm_cmd_send(hw, &desc, 1);
		if (ret) {
			dev_err(&hw->cmq.csq.pdev->dev,
				"failed to get tqp stat, ret = %d, tx = %u.\n",
				ret, i);
			return ret;
		}
		tqp->tqp_stats.rcb_tx_ring_pktnum_rcd +=
			le32_to_cpu(desc.data[1]);
	}

	return 0;
}
EXPORT_SYMBOL_GPL(hclge_comm_tqps_update_stats);

void hclge_comm_reset_tqp_stats(struct hnae3_handle *handle)
{
	struct hnae3_knic_private_info *kinfo = &handle->kinfo;
	struct hclge_comm_tqp *tqp;
	struct hnae3_queue *queue;
	u16 i;

	for (i = 0; i < kinfo->num_tqps; i++) {
		queue = kinfo->tqp[i];
		tqp = container_of(queue, struct hclge_comm_tqp, q);
		memset(&tqp->tqp_stats, 0, sizeof(tqp->tqp_stats));
	}
}
EXPORT_SYMBOL_GPL(hclge_comm_reset_tqp_stats);

Annotation

Implementation Notes