On 3/7/2016 12:20 PM, Stephen Hemminger wrote:
> On Thu, 18 Feb 2016 21:49:09 +0800
> Yuanhan Liu <yuanhan.liu at linux.intel.com> wrote:
>
>> +static inline void
>> +copy_virtio_net_hdr(struct vhost_virtqueue *vq, uint64_t desc_addr,
>> +                struct virtio_net_hdr_mrg_rxbuf hdr)
>> +{
>> +    if (vq->vhost_hlen == sizeof(struct virtio_net_hdr_mrg_rxbuf)) {
>> +            *(struct virtio_net_hdr_mrg_rxbuf *)(uintptr_t)desc_addr = hdr;
>> +    } else {
>> +            *(struct virtio_net_hdr *)(uintptr_t)desc_addr = hdr.hdr;
>> +    }
>> +}
>> +
> Don't use {} around single statements.
There are other cs issues, like
     used_idx = vq->last_used_idx & (vq->size -1);
                                               ^ space needed
Please run checkpatch against your patch.
> Since you are doing all this casting, why not just use regular old memcpy
> which will be inlined by Gcc  into same instructions anyway.
> And since are always casting the desc_addr, why not pass a type that
> doesn't need the additional cast (like void *)
>

Reply via email to