回复:[PATCH v5 net-next 05/11] net/nebula-matrix: add channel layer

From: Illusion Wang

Date: Tue Mar 03 2026 - 21:04:42 EST


> > +#define NBL_CHAN_TX_RING_TO_DESC(tx_ring, i) \
> > + (&(((struct nbl_chan_tx_desc *)((tx_ring)-> >desc))[i]))
> > +#define NBL_CHAN_RX_RING_TO_DESC(rx_ring, i) \
> > + (&(((struct nbl_chan_rx_desc *)((rx_ring)-> >desc))[i]))

>Are the casts needed here?

> > +struct nbl_chan_tx_desc {
> > + u16 flags;
> > + u16 srcid;
> > + u16 dstid;
> > + u16 data_len;

> > + u16 buf_len;

> > + u64 buf_addr;
> > + u16 msg_type;
> > + u8 data[16];
> > + u16 msgid;
> > + u8 rsv[26];
> > +} __packed;

>This is a hardware descriptor? It is actually in memory like this,
>with the u64 buf_addr badly aligned? What was the hardware engineer
>thinking? Just swapping buf_addr and buf_len would of made it a lot
>better.

> > +struct nbl_chan_rx_desc {
> > + u16 flags;
> > + u32 buf_len;
> > + u16 buf_id;
> > + u64 buf_addr;
> > +} __packed;

>Similarly badly designed.

Thank you for your feedback.
Since nbl_chan_ring->desc is a void *, casting is required for different scenarios.
The design of nbl_chan_tx_desc/nbl_chan_rx_desc is indeed poor, but the chip has
already been taped out (i.e., manufactured). We have recognized this issue and
have corrected it in the next-generation chip.

--illusion.wang