Hi Jason, > From: Jason Wang <jasowang@xxxxxxxxxx> > Sent: Wednesday, June 30, 2021 10:02 AM > >> It looks to we don't need the rest of fields in the virtio_net_config > >> to build the config since they are all hardware attributes. > > Today it is only mac and max queues. Later on we may need to define rss > hashing as hw/device advances. > > And structure size will change. > > Hence, I propose to have each as individual attribute that doesn’t need to > cast in struct. > > > Ok, that should work. If Michael are fine with this, I'm also fine. > > Just to clarify, if I understand this correctly, with the individual attribute, > there's no need for the bit like xxx_is_valid? xxx_is_valid is not present in the get calls. It is also not present in UAPI set calls. It is not a UAPI. It is an internal between vdpa.c and vendor driver to tell which fields to use as there are optional. If we want to get rid of those valid flags below code will move to vendor driver where we pass nl_attr, during device add callback. + if (nl_attrs[VDPA_ATTR_DEV_NET_CFG_MACADDR]) { + macaddr = nla_data(nl_attrs[VDPA_ATTR_DEV_NET_CFG_MACADDR]); + memcpy(config.net.mac, macaddr, sizeof(config.net.mac)); + config.net_mask.mac_valid = true; + } + if (nl_attrs[VDPA_ATTR_DEV_NET_CFG_MTU]) { + config.net.mtu = + nla_get_u16(nl_attrs[VDPA_ATTR_DEV_NET_CFG_MTU]); + config.net_mask.mtu_valid = true; + } _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization