Subject: Re: [PATCH net-next v2 10/11] idpf: add Tx timestamp flows

From: Jakub Kicinski <[email-masked]>
Date: Mon, 28 Apr 2025 17:35:21 -0700

On Fri, 25 Apr 2025 14:52:24 -0700 Tony Nguyen wrote:
> +int idpf_ptp_get_tx_tstamp(struct idpf_vport *vport)
> +{
> +	struct virtchnl2_ptp_get_vport_tx_tstamp_latches *send_tx_tstamp_msg;
> +	struct idpf_ptp_vport_tx_tstamp_caps *tx_tstamp_caps;
> +	struct idpf_vc_xn_params xn_params = {
> +		.vc_op = VIRTCHNL2_OP_PTP_GET_VPORT_TX_TSTAMP,
> +		.timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
> +		.async = true,
> +		.async_handler = idpf_ptp_get_tx_tstamp_async_handler,
> +	};
> +	struct idpf_ptp_tx_tstamp *ptp_tx_tstamp;
> +	int reply_sz, size, msg_size;
> +	struct list_head *head;
> +	bool state_upd;
> +	u16 id = 0;
> +
> +	tx_tstamp_caps = vport->tx_tstamp_caps;
> +	head = &tx_tstamp_caps->latches_in_use;
> +
> +	size = struct_size(send_tx_tstamp_msg, tstamp_latches,
> +			   tx_tstamp_caps->num_entries);
> +	send_tx_tstamp_msg = kzalloc(size, GFP_KERNEL);
> +	if (!send_tx_tstamp_msg)
> +		return -ENOMEM;
> +
> +	spin_lock(&tx_tstamp_caps->latches_lock);

Looks like this function is called from a work but it takes 
the latches_lock in non-BH mode? Elsewhere the lock is taken
in BH mode. Not sure what the context for the async handler is.