[PATCH v4 06/15] net/zxdh: dev start/stop ops implementations

Stephen Hemminger stephen at networkplumber.org
Sat Dec 21 01:51:24 CET 2024


On Wed, 18 Dec 2024 17:25:53 +0800
Junlong Wang <wang.junlong1 at zte.com.cn> wrote:

> +static void
> +zxdh_notify_queue(struct zxdh_hw *hw, struct zxdh_virtqueue *vq)
> +{
> +	uint32_t notify_data = 0;
> +
> +	if (!zxdh_pci_with_feature(hw, ZXDH_F_NOTIFICATION_DATA)) {
> +		rte_write16(vq->vq_queue_index, vq->notify_addr);
> +		return;
> +	}
> +
> +	if (zxdh_pci_with_feature(hw, ZXDH_F_RING_PACKED)) {
> +		notify_data = ((uint32_t)(!!(vq->vq_packed.cached_flags &
> +						ZXDH_VRING_PACKED_DESC_F_AVAIL)) << 31) |
> +						((uint32_t)vq->vq_avail_idx << 16) |
> +						vq->vq_queue_index;
> +	} else {
> +		notify_data = ((uint32_t)vq->vq_avail_idx << 16) | vq->vq_queue_index;
> +	}
> +	PMD_DRV_LOG(DEBUG, "queue:%d notify_data 0x%x notify_addr 0x%p",
> +				 vq->vq_queue_index, notify_data, vq->notify_addr);
> +	rte_write32(notify_data, vq->notify_addr);
> +}

Looks like the notify_data part could be simplified to:
	notify_data = ((uint32_t)vq->vq_avail_idx << 16) | vq->vq_queue_index;
	if (zxdh_pci_with_feature(hw, ZXDH_F_RING_PACKED) && (vq->vq_packed.cached_flags & ZXDH_VRING_PACKED_DESC_F_AVAIL)
		notify_data |= RTE_BIT32(31);


More information about the dev mailing list