netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Wei Huang <wei.huang2@amd.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, netdev@vger.kernel.org
Cc: Jonathan.Cameron@Huawei.com, helgaas@kernel.org, corbet@lwn.net,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, alex.williamson@redhat.com,
	gospo@broadcom.com, michael.chan@broadcom.com,
	ajit.khaparde@broadcom.com, somnath.kotur@broadcom.com,
	andrew.gospodarek@broadcom.com, manoj.panicker2@amd.com,
	Eric.VanTassell@amd.com, vadim.fedorenko@linux.dev,
	horms@kernel.org, bagasdotme@gmail.com, bhelgaas@google.com,
	lukas@wunner.de, paul.e.luse@intel.com, jing2.liu@intel.com
Subject: Re: [PATCH V7 2/5] PCI/TPH: Add Steering Tag support
Date: Tue, 4 Feb 2025 18:33:19 +0000	[thread overview]
Message-ID: <a373416b-bf00-4cf7-9b46-bd95599d114c@arm.com> (raw)
In-Reply-To: <20241002165954.128085-3-wei.huang2@amd.com>

On 2024-10-02 5:59 pm, Wei Huang wrote:
[...]
> +/**
> + * pcie_tph_set_st_entry() - Set Steering Tag in the ST table entry
> + * @pdev: PCI device
> + * @index: ST table entry index
> + * @tag: Steering Tag to be written
> + *
> + * This function will figure out the proper location of ST table, either in the
> + * MSI-X table or in the TPH Extended Capability space, and write the Steering
> + * Tag into the ST entry pointed by index.
> + *
> + * Returns: 0 if success, otherwise negative value (-errno)
> + */
> +int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag)
> +{
> +	u32 loc;
> +	int err = 0;
> +
> +	if (!pdev->tph_cap)
> +		return -EINVAL;
> +
> +	if (!pdev->tph_enabled)
> +		return -EINVAL;
> +
> +	/* No need to write tag if device is in "No ST Mode" */
> +	if (pdev->tph_mode == PCI_TPH_ST_NS_MODE)
> +		return 0;
> +
> +	/* Disable TPH before updating ST to avoid potential instability as
> +	 * cautioned in PCIe r6.2, sec 6.17.3, "ST Modes of Operation"
> +	 */
> +	set_ctrl_reg_req_en(pdev, PCI_TPH_REQ_DISABLE);
> +
> +	loc = get_st_table_loc(pdev);
> +	/* Convert loc to match with PCI_TPH_LOC_* defined in pci_regs.h */
> +	loc = FIELD_PREP(PCI_TPH_CAP_LOC_MASK, loc);
> +
> +	switch (loc) {
> +	case PCI_TPH_LOC_MSIX:
> +		err = write_tag_to_msix(pdev, index, tag);
> +		break;
> +	case PCI_TPH_LOC_CAP:
> +		err = write_tag_to_st_table(pdev, index, tag);
> +		break;
> +	default:
> +		err = -EINVAL;
> +	}
> +
> +	if (err) {
> +		pcie_disable_tph(pdev);
> +		return err;
> +	}
> +
> +	set_ctrl_reg_req_en(pdev, pdev->tph_mode);

Just looking at this code in mainline, and I don't trust my 
understanding quite enough to send a patch myself, but doesn't this want 
to be pdev->tph_req_type, rather than tph_mode?

Thanks,
Robin.

> +
> +	pci_dbg(pdev, "set steering tag: %s table, index=%d, tag=%#04x\n",
> +		(loc == PCI_TPH_LOC_MSIX) ? "MSI-X" : "ST", index, tag);
> +
> +	return 0;
> +}

  reply	other threads:[~2025-02-04 18:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 16:59 [PATCH V7 0/5] TPH and cache direct injection support Wei Huang
2024-10-02 16:59 ` [PATCH V7 1/5] PCI: Add TLP Processing Hints (TPH) support Wei Huang
2024-10-02 16:59 ` [PATCH V7 2/5] PCI/TPH: Add Steering Tag support Wei Huang
2025-02-04 18:33   ` Robin Murphy [this message]
2025-02-04 20:18     ` Wei Huang
2025-02-05 12:57       ` Robin Murphy
2024-10-02 16:59 ` [PATCH V7 3/5] PCI/TPH: Add TPH documentation Wei Huang
2024-10-02 16:59 ` [PATCH V7 4/5] bnxt_en: Add TPH support in BNXT driver Wei Huang
2024-10-08 13:39   ` Jakub Kicinski
2024-10-11 18:35     ` Panicker, Manoj
2024-10-15 19:50       ` Wei Huang
2024-10-15 23:45         ` Jakub Kicinski
2024-10-02 16:59 ` [PATCH V7 5/5] bnxt_en: Pass NQ ID to the FW when allocating RX/RX AGG rings Wei Huang
2024-10-02 21:35 ` [PATCH V7 0/5] TPH and cache direct injection support Bjorn Helgaas
2024-10-02 22:08   ` Michael Chan
2024-10-08  7:32     ` Paolo Abeni
2024-10-16 21:31   ` Bjorn Helgaas

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=a373416b-bf00-4cf7-9b46-bd95599d114c@arm.com \
    --to=robin.murphy@arm.com \
    --cc=Eric.VanTassell@amd.com \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=alex.williamson@redhat.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=bagasdotme@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gospo@broadcom.com \
    --cc=helgaas@kernel.org \
    --cc=horms@kernel.org \
    --cc=jing2.liu@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=manoj.panicker2@amd.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paul.e.luse@intel.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=wei.huang2@amd.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).