Re: [PATCH v9 1/1] mctp pcc: Implement MCTP over PCC Transport

Adam Young
2024-12-18T16:23:11Z

On 12/17/24 14:04, Joe Damato wrote:
>> +static void mctp_pcc_client_rx_callback(struct mbox_client *c, void *buffer)
>> +{
>> + struct mctp_pcc_ndev *mctp_pcc_ndev;
>> + struct mctp_pcc_hdr mctp_pcc_hdr;
>> + struct pcpu_dstats *dstats;
>> + struct mctp_skb_cb *cb;
>> + struct sk_buff *skb;
>> + void *skb_buf;
>> + u32 data_len;
>> +
>> + mctp_pcc_ndev = container_of(c, struct mctp_pcc_ndev, inbox.client);
>> + memcpy_fromio(&mctp_pcc_hdr, mctp_pcc_ndev->inbox.chan->shmem,
>> + sizeof(struct mctp_pcc_hdr));
>> + data_len = mctp_pcc_hdr.length + MCTP_HEADER_LENGTH;
>> + skb = netdev_alloc_skb(mctp_pcc_ndev->mdev.dev, data_len);
>> +
>> + dstats = this_cpu_ptr(mctp_pcc_ndev->mdev.dev->dstats);
>> + u64_stats_update_begin(&dstats->syncp);
>> + if (data_len > mctp_pcc_ndev->mdev.dev->mtu) {
>> + u64_stats_inc(&dstats->rx_drops);
>> + u64_stats_inc(&dstats->rx_drops);
> Double counting rx_drops ?

Oops.  Yes I was.  Thanks.

>
>> + u64_stats_update_end(&dstats->syncp);
>> + return;
>> + }
>> + if (!skb) {
>> + u64_stats_inc(&dstats->rx_drops);
>> + u64_stats_update_end(&dstats->syncp);
>> + return;
>> + }
>> + u64_stats_inc(&dstats->rx_packets);
>> + u64_stats_add(&dstats->rx_bytes, data_len);
>> + u64_stats_update_end(&dstats->syncp);
> I suspect what Jeremy meant (but please feel free to correct me if
> I'm mistaken, Jeremy) was that you may want to use the helpers in:
>
> include/linux/netdevice.h
>
> e.g.
>
> dev_dstats_rx_add(mctp_pcc_ndev->mdev.dev, data_len);
> dev_dstats_rx_dropped(mctp_pcc_ndev->mdev.dev);
>
> etc.

I don't see those function calls in the 6.13-rc3 tree I am working
with.  Are they coming later?