netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
	davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, netdev@vger.kernel.org,
	Piotr Raczynski <piotr.raczynski@intel.com>,
	jiri@nvidia.com, shayd@nvidia.com, wojciech.drewek@intel.com,
	horms@kernel.org, sridhar.samudrala@intel.com,
	mateusz.polchlopek@intel.com,
	kalesh-anakkur.purayil@broadcom.com, michal.kubiak@intel.com,
	pio.raczynski@gmail.com, przemyslaw.kitszel@intel.com,
	jacob.e.keller@intel.com, maciej.fijalkowski@intel.com,
	Rafal Romanowski <rafal.romanowski@intel.com>
Subject: Re: [PATCH net-next v3 03/15] ice: add basic devlink subfunctions support
Date: Mon, 12 Aug 2024 06:24:12 +0200	[thread overview]
Message-ID: <ZrmObGTwIw4cDJ7v@mev-dev.igk.intel.com> (raw)
In-Reply-To: <ZrcNvu6cXqQ-ybZu@nanopsycho.orion>

On Sat, Aug 10, 2024 at 08:50:38AM +0200, Jiri Pirko wrote:
> Fri, Aug 09, 2024 at 01:47:38PM CEST, michal.swiatkowski@linux.intel.com wrote:
> >On Fri, Aug 09, 2024 at 01:16:28PM +0200, Jiri Pirko wrote:
> >> Thu, Aug 08, 2024 at 07:30:49PM CEST, anthony.l.nguyen@intel.com wrote:
> >> >From: Piotr Raczynski <piotr.raczynski@intel.com>
> >> >
> >> 
> >> [...]
> >> 
> >> >+static int
> >> >+ice_devlink_port_new_check_attr(struct ice_pf *pf,
> >> >+				const struct devlink_port_new_attrs *new_attr,
> >> >+				struct netlink_ext_ack *extack)
> >> >+{
> >> >+	if (new_attr->flavour != DEVLINK_PORT_FLAVOUR_PCI_SF) {
> >> >+		NL_SET_ERR_MSG_MOD(extack, "Flavour other than pcisf is not supported");
> >> >+		return -EOPNOTSUPP;
> >> >+	}
> >> >+
> >> >+	if (new_attr->controller_valid) {
> >> >+		NL_SET_ERR_MSG_MOD(extack, "Setting controller is not supported");
> >> >+		return -EOPNOTSUPP;
> >> >+	}
> >> >+
> >> >+	if (new_attr->port_index_valid) {
> >> >+		NL_SET_ERR_MSG_MOD(extack, "Port index is invalid");
> >> 
> >> Nope, it is actually valid, but your driver does not support that.
> >> Please fix the message.
> >>
> >
> >Ok
> >
> >> 
> >> >+		return -EOPNOTSUPP;
> >> >+	}
> >> >+
> >> >+	if (new_attr->pfnum != pf->hw.bus.func) {
> >> 
> >> hw.bus.func, hmm. How about if you pass-through the PF to VM, can't the
> >> func be anything? Will this still make sense? I don't think so. If you
> >> get the PF number like this in the rest of the driver, you need to fix
> >> this.
> >>
> >
> >I can change it to our internal value. I wonder if it will be better. If
> >I understand correctly, now:
> >PF0 - xx.xx.0; PF1 - xx.xx.1
> >
> >I am doing pass-through PF1
> >PF0 (on host) - xx.xx.0
> >
> >PF1 (on VM) - xx.xx.0 (there is one PF on VM, so for me it is more
> >intuitive to have func 0)
> >
> >after I change:
> >PF0 - xx.xx.0; PF1 - xx.xx.1
> >
> >pass-through PF1
> >PF0 (on host) - xx.xx.0
> >
> >PF1 (on VM) - xx.xx.0, but user will have to use 1 as pf num
> >
> >Correct me if I am wrong.
> 
> Did you try this? I mean, you can check that easily with vng:
> vng --qemu-opts="-device vfio-pci,host=5e:01.0,addr=01.04"
> 
> Then in the VM you see:
> 0000:00:01.4
> 
> Then, by your code, the pf number is 4, isn't it?
> 
> What am I missing?

I didn't know about addr parameter. I will change it to always have the
same number so.

> 
> 
> 
> >
> >> 
> >> 
> >> >+		NL_SET_ERR_MSG_MOD(extack, "Incorrect pfnum supplied");
> >> >+		return -EINVAL;
> >> >+	}
> >> >+
> >> >+	if (!pci_msix_can_alloc_dyn(pf->pdev)) {
> >> >+		NL_SET_ERR_MSG_MOD(extack, "Dynamic MSIX-X interrupt allocation is not supported");
> >> >+		return -EOPNOTSUPP;
> >> >+	}
> >> >+
> >> >+	return 0;
> >> >+}
> >> 
> >> [...]
> >> 
> >> 
> >> >+int ice_devlink_create_sf_port(struct ice_dynamic_port *dyn_port)
> >> >+{
> >> >+	struct devlink_port_attrs attrs = {};
> >> >+	struct devlink_port *devlink_port;
> >> >+	struct devlink *devlink;
> >> >+	struct ice_vsi *vsi;
> >> >+	struct ice_pf *pf;
> >> >+
> >> >+	vsi = dyn_port->vsi;
> >> >+	pf = dyn_port->pf;
> >> >+
> >> >+	devlink_port = &dyn_port->devlink_port;
> >> >+
> >> >+	attrs.flavour = DEVLINK_PORT_FLAVOUR_PCI_SF;
> >> >+	attrs.pci_sf.pf = pf->hw.bus.func;
> >> 
> >> Same here.
> >> 
> >> 
> >> >+	attrs.pci_sf.sf = dyn_port->sfnum;
> >> >+
> >> >+	devlink_port_attrs_set(devlink_port, &attrs);
> >> >+	devlink = priv_to_devlink(pf);
> >> >+
> >> >+	return devl_port_register_with_ops(devlink, devlink_port, vsi->idx,
> >> >+					   &ice_devlink_port_sf_ops);
> >> >+}
> >> >+
> >> 
> >> [...]

  reply	other threads:[~2024-08-12  4:26 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-08 17:30 [PATCH net-next v3 00/15][pull request] ice: support devlink subfunction Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 01/15] ice: add new VSI type for subfunctions Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 02/15] ice: export ice ndo_ops functions Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 03/15] ice: add basic devlink subfunctions support Tony Nguyen
2024-08-09 11:16   ` Jiri Pirko
2024-08-09 11:47     ` Michal Swiatkowski
2024-08-10  6:50       ` Jiri Pirko
2024-08-12  4:24         ` Michal Swiatkowski [this message]
2024-08-12  9:53           ` Jiri Pirko
2024-08-08 17:30 ` [PATCH net-next v3 04/15] ice: treat subfunction VSI the same as PF VSI Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 05/15] ice: allocate devlink for subfunction Tony Nguyen
2024-08-09 11:17   ` Jiri Pirko
2024-08-08 17:30 ` [PATCH net-next v3 06/15] ice: base subfunction aux driver Tony Nguyen
2024-08-09 11:23   ` Jiri Pirko
2024-08-09 11:49     ` Michal Swiatkowski
2024-08-08 17:30 ` [PATCH net-next v3 07/15] ice: implement netdev for subfunction Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 08/15] ice: make representor code generic Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 09/15] ice: create port representor for SF Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 10/15] ice: don't set target VSI for subfunction Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 11/15] ice: check if SF is ready in ethtool ops Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 12/15] ice: implement netdevice ops for SF representor Tony Nguyen
2024-08-08 17:30 ` [PATCH net-next v3 13/15] ice: support subfunction devlink Tx topology Tony Nguyen
2024-08-08 17:31 ` [PATCH net-next v3 14/15] ice: basic support for VLAN in subfunctions Tony Nguyen
2024-08-08 17:31 ` [PATCH net-next v3 15/15] ice: allow to activate and deactivate subfunction Tony Nguyen
2024-08-09 11:26   ` Jiri Pirko
2024-08-09 11:49     ` Michal Swiatkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZrmObGTwIw4cDJ7v@mev-dev.igk.intel.com \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jiri@nvidia.com \
    --cc=jiri@resnulli.us \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=mateusz.polchlopek@intel.com \
    --cc=michal.kubiak@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pio.raczynski@gmail.com \
    --cc=piotr.raczynski@intel.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=rafal.romanowski@intel.com \
    --cc=shayd@nvidia.com \
    --cc=sridhar.samudrala@intel.com \
    --cc=wojciech.drewek@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).