Message ID | 20230307113621.64153-14-gautam.dawar@amd.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | sfc: add vDPA support for EF100 devices | expand |
Context | Check | Description |
---|---|---|
netdev/series_format | success | Posting correctly formatted |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 20 this patch: 20 |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/build_clang | success | Errors and warnings before: 23 this patch: 23 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/deprecated_api | success | None detected |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 20 this patch: 20 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 18 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <gautam.dawar@amd.com> wrote: > > As the VF MAC address can now be updated using `devlink port function set` What happens if we run this while the vpda is being used by a VM? > interface, fetch the vdpa device MAC address from the underlying VF during > vdpa device creation. > > Signed-off-by: Gautam Dawar <gautam.dawar@amd.com> > --- > drivers/net/ethernet/sfc/ef100_vdpa.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c > index 30ca4ab00175..32182a01f6a5 100644 > --- a/drivers/net/ethernet/sfc/ef100_vdpa.c > +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c > @@ -272,6 +272,18 @@ static int get_net_config(struct ef100_vdpa_nic *vdpa_nic) > vdpa_nic->net_config.max_virtqueue_pairs = > cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs); > > + rc = ef100_get_mac_address(efx, vdpa_nic->mac_address, > + efx->client_id, true); > + if (rc) { > + dev_err(&vdpa_nic->vdpa_dev.dev, > + "%s: Get MAC for vf:%u failed:%d\n", __func__, > + vdpa_nic->vf_index, rc); > + return rc; > + } Can this override what is provisioned by the userspace? Thanks > + > + if (is_valid_ether_addr(vdpa_nic->mac_address)) > + vdpa_nic->mac_configured = true; > + > rc = efx_vdpa_get_mtu(efx, &mtu); > if (rc) { > dev_err(&vdpa_nic->vdpa_dev.dev, > -- > 2.30.1 >
On 3/10/23 10:35, Jason Wang wrote: > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. > > > On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <gautam.dawar@amd.com> wrote: >> As the VF MAC address can now be updated using `devlink port function set` > What happens if we run this while the vpda is being used by a VM? IIUC, updating the MAC address using devlink interface requires unbinding the device from driver and hence updating the MAC while vdpa device is in-use won't be possible. It can only be done via control vq VIRTIO_NET_CTRL_MAC_ADDR_SET command, when available. > >> interface, fetch the vdpa device MAC address from the underlying VF during >> vdpa device creation. >> >> Signed-off-by: Gautam Dawar <gautam.dawar@amd.com> >> --- >> drivers/net/ethernet/sfc/ef100_vdpa.c | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c >> index 30ca4ab00175..32182a01f6a5 100644 >> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c >> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c >> @@ -272,6 +272,18 @@ static int get_net_config(struct ef100_vdpa_nic *vdpa_nic) >> vdpa_nic->net_config.max_virtqueue_pairs = >> cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs); >> >> + rc = ef100_get_mac_address(efx, vdpa_nic->mac_address, >> + efx->client_id, true); >> + if (rc) { >> + dev_err(&vdpa_nic->vdpa_dev.dev, >> + "%s: Get MAC for vf:%u failed:%d\n", __func__, >> + vdpa_nic->vf_index, rc); >> + return rc; >> + } > Can this override what is provisioned by the userspace? No, this was carefully avoided by overwriting the userspace provisioned MAC in ef100_vdpa_create(): rc = get_net_config(vdpa_nic); if (rc) goto err_put_device; if (mac) { ether_addr_copy(vdpa_nic->mac_address, mac); vdpa_nic->mac_configured = true; } > > Thanks > > >> + >> + if (is_valid_ether_addr(vdpa_nic->mac_address)) >> + vdpa_nic->mac_configured = true; >> + >> rc = efx_vdpa_get_mtu(efx, &mtu); >> if (rc) { >> dev_err(&vdpa_nic->vdpa_dev.dev, >> -- >> 2.30.1 >>
在 2023/3/13 14:37, Gautam Dawar 写道: > On 3/10/23 10:35, Jason Wang wrote: >> Caution: This message originated from an External Source. Use proper >> caution when opening attachments, clicking links, or responding. >> >> >> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <gautam.dawar@amd.com> >> wrote: >>> As the VF MAC address can now be updated using `devlink port >>> function set` >> What happens if we run this while the vpda is being used by a VM? > IIUC, updating the MAC address using devlink interface requires > unbinding the device from driver and hence updating the MAC while vdpa > device is in-use won't be possible. It can only be done via control vq > VIRTIO_NET_CTRL_MAC_ADDR_SET command, when available. Good to know that. >> >>> interface, fetch the vdpa device MAC address from the underlying VF >>> during >>> vdpa device creation. >>> >>> Signed-off-by: Gautam Dawar <gautam.dawar@amd.com> >>> --- >>> drivers/net/ethernet/sfc/ef100_vdpa.c | 12 ++++++++++++ >>> 1 file changed, 12 insertions(+) >>> >>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c >>> b/drivers/net/ethernet/sfc/ef100_vdpa.c >>> index 30ca4ab00175..32182a01f6a5 100644 >>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c >>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c >>> @@ -272,6 +272,18 @@ static int get_net_config(struct ef100_vdpa_nic >>> *vdpa_nic) >>> vdpa_nic->net_config.max_virtqueue_pairs = >>> cpu_to_efx_vdpa16(vdpa_nic, >>> vdpa_nic->max_queue_pairs); >>> >>> + rc = ef100_get_mac_address(efx, vdpa_nic->mac_address, >>> + efx->client_id, true); >>> + if (rc) { >>> + dev_err(&vdpa_nic->vdpa_dev.dev, >>> + "%s: Get MAC for vf:%u failed:%d\n", __func__, >>> + vdpa_nic->vf_index, rc); >>> + return rc; >>> + } >> Can this override what is provisioned by the userspace? > > No, this was carefully avoided by overwriting the userspace > provisioned MAC in ef100_vdpa_create(): > > rc = get_net_config(vdpa_nic); > if (rc) > goto err_put_device; > > if (mac) { > ether_addr_copy(vdpa_nic->mac_address, mac); > vdpa_nic->mac_configured = true; > } Ah, I see. Thanks > >> >> Thanks >> >> >>> + >>> + if (is_valid_ether_addr(vdpa_nic->mac_address)) >>> + vdpa_nic->mac_configured = true; >>> + >>> rc = efx_vdpa_get_mtu(efx, &mtu); >>> if (rc) { >>> dev_err(&vdpa_nic->vdpa_dev.dev, >>> -- >>> 2.30.1 >>> >
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c index 30ca4ab00175..32182a01f6a5 100644 --- a/drivers/net/ethernet/sfc/ef100_vdpa.c +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c @@ -272,6 +272,18 @@ static int get_net_config(struct ef100_vdpa_nic *vdpa_nic) vdpa_nic->net_config.max_virtqueue_pairs = cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs); + rc = ef100_get_mac_address(efx, vdpa_nic->mac_address, + efx->client_id, true); + if (rc) { + dev_err(&vdpa_nic->vdpa_dev.dev, + "%s: Get MAC for vf:%u failed:%d\n", __func__, + vdpa_nic->vf_index, rc); + return rc; + } + + if (is_valid_ether_addr(vdpa_nic->mac_address)) + vdpa_nic->mac_configured = true; + rc = efx_vdpa_get_mtu(efx, &mtu); if (rc) { dev_err(&vdpa_nic->vdpa_dev.dev,
As the VF MAC address can now be updated using `devlink port function set` interface, fetch the vdpa device MAC address from the underlying VF during vdpa device creation. Signed-off-by: Gautam Dawar <gautam.dawar@amd.com> --- drivers/net/ethernet/sfc/ef100_vdpa.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)