* [PATCH mlx5-next 0/2] Add support for direct steering tag mode for RDMA mlx5_ib driver
@ 2025-10-27 9:34 Leon Romanovsky
2025-10-27 9:34 ` [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc() Leon Romanovsky
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Leon Romanovsky @ 2025-10-27 9:34 UTC (permalink / raw)
To: Bjorn Helgaas, Saeed Mahameed, Leon Romanovsky, Tariq Toukan,
Mark Bloch, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: linux-pci, linux-kernel, netdev, linux-rdma, Yishai Hadas,
Edward Srouji
From Yishai:
Add support for direct steering mode where ST table location equals
PCI_TPH_LOC_NONE.
In that case, no steering table exists, the steering tag itself will be
used directly by the SW, FW, HW from the mkey.
In that mode of work, the driver is not limited any more to the 64 max
entries of the capability config space table.
The first patch in the series exposes the pcie_tph_get_st_table_loc()
API to let drivers detect the ST table location.
The second patch uses the direct mode in case the location equals
PCI_TPH_LOC_NONE.
This enables RDMA users working in that direct mode.
Thanks
---
Yishai Hadas (2):
PCI/TPH: Expose pcie_tph_get_st_table_loc()
net/mlx5: Add direct ST mode support for RDMA
drivers/net/ethernet/mellanox/mlx5/core/lib/st.c | 29 ++++++++++++++++++++----
drivers/pci/tph.c | 7 +++---
include/linux/pci-tph.h | 1 +
3 files changed, 30 insertions(+), 7 deletions(-)
---
base-commit: eea31f21dce10814e34dc7ef7ed5136269c7bb59
change-id: 20251027-st-direct-mode-8d7d874a7d36
Best regards,
--
Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc()
2025-10-27 9:34 [PATCH mlx5-next 0/2] Add support for direct steering tag mode for RDMA mlx5_ib driver Leon Romanovsky
@ 2025-10-27 9:34 ` Leon Romanovsky
2025-11-02 10:17 ` Leon Romanovsky
2025-11-03 15:43 ` Bjorn Helgaas
2025-10-27 9:34 ` [PATCH mlx5-next 2/2] net/mlx5: Add direct ST mode support for RDMA Leon Romanovsky
2025-11-11 10:04 ` [PATCH mlx5-next 0/2] Add support for direct steering tag mode for RDMA mlx5_ib driver Leon Romanovsky
2 siblings, 2 replies; 9+ messages in thread
From: Leon Romanovsky @ 2025-10-27 9:34 UTC (permalink / raw)
To: Bjorn Helgaas, Saeed Mahameed, Leon Romanovsky, Tariq Toukan,
Mark Bloch, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: linux-pci, linux-kernel, netdev, linux-rdma, Yishai Hadas,
Edward Srouji
From: Yishai Hadas <yishaih@nvidia.com>
Expose pcie_tph_get_st_table_loc() to be used by drivers as will be done
in the next patch from the series.
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/pci/tph.c | 7 ++++---
include/linux/pci-tph.h | 1 +
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
index cc64f93709a4..8f8457ec9adb 100644
--- a/drivers/pci/tph.c
+++ b/drivers/pci/tph.c
@@ -155,7 +155,7 @@ static u8 get_st_modes(struct pci_dev *pdev)
return reg;
}
-static u32 get_st_table_loc(struct pci_dev *pdev)
+u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
{
u32 reg;
@@ -163,6 +163,7 @@ static u32 get_st_table_loc(struct pci_dev *pdev)
return FIELD_GET(PCI_TPH_CAP_LOC_MASK, reg);
}
+EXPORT_SYMBOL(pcie_tph_get_st_table_loc);
/*
* Return the size of ST table. If ST table is not in TPH Requester Extended
@@ -174,7 +175,7 @@ u16 pcie_tph_get_st_table_size(struct pci_dev *pdev)
u32 loc;
/* Check ST table location first */
- loc = get_st_table_loc(pdev);
+ loc = pcie_tph_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);
@@ -299,7 +300,7 @@ int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag)
*/
set_ctrl_reg_req_en(pdev, PCI_TPH_REQ_DISABLE);
- loc = get_st_table_loc(pdev);
+ loc = pcie_tph_get_st_table_loc(pdev);
/* Convert loc to match with PCI_TPH_LOC_* */
loc = FIELD_PREP(PCI_TPH_CAP_LOC_MASK, loc);
diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h
index 9e4e331b1603..ba28140ce670 100644
--- a/include/linux/pci-tph.h
+++ b/include/linux/pci-tph.h
@@ -29,6 +29,7 @@ int pcie_tph_get_cpu_st(struct pci_dev *dev,
void pcie_disable_tph(struct pci_dev *pdev);
int pcie_enable_tph(struct pci_dev *pdev, int mode);
u16 pcie_tph_get_st_table_size(struct pci_dev *pdev);
+u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev);
#else
static inline int pcie_tph_set_st_entry(struct pci_dev *pdev,
unsigned int index, u16 tag)
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH mlx5-next 2/2] net/mlx5: Add direct ST mode support for RDMA
2025-10-27 9:34 [PATCH mlx5-next 0/2] Add support for direct steering tag mode for RDMA mlx5_ib driver Leon Romanovsky
2025-10-27 9:34 ` [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc() Leon Romanovsky
@ 2025-10-27 9:34 ` Leon Romanovsky
2025-11-11 10:04 ` [PATCH mlx5-next 0/2] Add support for direct steering tag mode for RDMA mlx5_ib driver Leon Romanovsky
2 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2025-10-27 9:34 UTC (permalink / raw)
To: Bjorn Helgaas, Saeed Mahameed, Leon Romanovsky, Tariq Toukan,
Mark Bloch, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: linux-pci, linux-kernel, netdev, linux-rdma, Yishai Hadas,
Edward Srouji
From: Yishai Hadas <yishaih@nvidia.com>
Add support for direct ST mode where ST Table Location equals
PCI_TPH_LOC_NONE.
In that case, no steering table exists, the steering tag itself will be
used directly by the SW, FW, HW from the mkey.
This enables RDMA users to use the current exposed APIs to work in
direct mode.
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/lib/st.c | 29 ++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/st.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/st.c
index 47fe215f66bf..ef06fe6cbb51 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/st.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/st.c
@@ -19,13 +19,16 @@ struct mlx5_st {
struct mutex lock;
struct xa_limit index_limit;
struct xarray idx_xa; /* key == index, value == struct mlx5_st_idx_data */
+ u8 direct_mode : 1;
};
struct mlx5_st *mlx5_st_create(struct mlx5_core_dev *dev)
{
struct pci_dev *pdev = dev->pdev;
struct mlx5_st *st;
+ u8 direct_mode = 0;
u16 num_entries;
+ u32 tbl_loc;
int ret;
if (!MLX5_CAP_GEN(dev, mkey_pcie_tph))
@@ -40,10 +43,16 @@ struct mlx5_st *mlx5_st_create(struct mlx5_core_dev *dev)
if (!pdev->tph_cap)
return NULL;
- num_entries = pcie_tph_get_st_table_size(pdev);
- /* We need a reserved entry for non TPH cases */
- if (num_entries < 2)
- return NULL;
+ tbl_loc = pcie_tph_get_st_table_loc(pdev);
+ if (tbl_loc == PCI_TPH_LOC_NONE)
+ direct_mode = 1;
+
+ if (!direct_mode) {
+ num_entries = pcie_tph_get_st_table_size(pdev);
+ /* We need a reserved entry for non TPH cases */
+ if (num_entries < 2)
+ return NULL;
+ }
/* The OS doesn't support ST */
ret = pcie_enable_tph(pdev, PCI_TPH_ST_DS_MODE);
@@ -56,6 +65,10 @@ struct mlx5_st *mlx5_st_create(struct mlx5_core_dev *dev)
mutex_init(&st->lock);
xa_init_flags(&st->idx_xa, XA_FLAGS_ALLOC);
+ st->direct_mode = direct_mode;
+ if (st->direct_mode)
+ return st;
+
/* entry 0 is reserved for non TPH cases */
st->index_limit.min = MLX5_MKC_PCIE_TPH_NO_STEERING_TAG_INDEX + 1;
st->index_limit.max = num_entries - 1;
@@ -96,6 +109,11 @@ int mlx5_st_alloc_index(struct mlx5_core_dev *dev, enum tph_mem_type mem_type,
if (ret)
return ret;
+ if (st->direct_mode) {
+ *st_index = tag;
+ return 0;
+ }
+
mutex_lock(&st->lock);
xa_for_each(&st->idx_xa, index, idx_data) {
@@ -145,6 +163,9 @@ int mlx5_st_dealloc_index(struct mlx5_core_dev *dev, u16 st_index)
if (!st)
return -EOPNOTSUPP;
+ if (st->direct_mode)
+ return 0;
+
mutex_lock(&st->lock);
idx_data = xa_load(&st->idx_xa, st_index);
if (WARN_ON_ONCE(!idx_data)) {
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc()
2025-10-27 9:34 ` [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc() Leon Romanovsky
@ 2025-11-02 10:17 ` Leon Romanovsky
2025-11-03 15:43 ` Bjorn Helgaas
1 sibling, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2025-11-02 10:17 UTC (permalink / raw)
To: Bjorn Helgaas, Saeed Mahameed, Tariq Toukan, Mark Bloch,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: linux-pci, linux-kernel, netdev, linux-rdma, Yishai Hadas,
Edward Srouji
On Mon, Oct 27, 2025 at 11:34:01AM +0200, Leon Romanovsky wrote:
> From: Yishai Hadas <yishaih@nvidia.com>
>
> Expose pcie_tph_get_st_table_loc() to be used by drivers as will be done
> in the next patch from the series.
>
> Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
> Signed-off-by: Edward Srouji <edwards@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> drivers/pci/tph.c | 7 ++++---
> include/linux/pci-tph.h | 1 +
> 2 files changed, 5 insertions(+), 3 deletions(-)
<...>
> -static u32 get_st_table_loc(struct pci_dev *pdev)
> +u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
> {
> u32 reg;
>
> @@ -163,6 +163,7 @@ static u32 get_st_table_loc(struct pci_dev *pdev)
>
> return FIELD_GET(PCI_TPH_CAP_LOC_MASK, reg);
> }
> +EXPORT_SYMBOL(pcie_tph_get_st_table_loc);
Bjorn,
Are you ok with this change?
Thanks
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc()
2025-10-27 9:34 ` [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc() Leon Romanovsky
2025-11-02 10:17 ` Leon Romanovsky
@ 2025-11-03 15:43 ` Bjorn Helgaas
2025-11-03 16:23 ` Yishai Hadas
1 sibling, 1 reply; 9+ messages in thread
From: Bjorn Helgaas @ 2025-11-03 15:43 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Bjorn Helgaas, Saeed Mahameed, Tariq Toukan, Mark Bloch,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-pci, linux-kernel, netdev, linux-rdma,
Yishai Hadas, Edward Srouji
On Mon, Oct 27, 2025 at 11:34:01AM +0200, Leon Romanovsky wrote:
> From: Yishai Hadas <yishaih@nvidia.com>
>
> Expose pcie_tph_get_st_table_loc() to be used by drivers as will be done
> in the next patch from the series.
>
> Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
> Signed-off-by: Edward Srouji <edwards@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> drivers/pci/tph.c | 7 ++++---
> include/linux/pci-tph.h | 1 +
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
> index cc64f93709a4..8f8457ec9adb 100644
> --- a/drivers/pci/tph.c
> +++ b/drivers/pci/tph.c
> @@ -155,7 +155,7 @@ static u8 get_st_modes(struct pci_dev *pdev)
> return reg;
> }
>
> -static u32 get_st_table_loc(struct pci_dev *pdev)
> +u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
> {
> u32 reg;
>
> @@ -163,6 +163,7 @@ static u32 get_st_table_loc(struct pci_dev *pdev)
>
> return FIELD_GET(PCI_TPH_CAP_LOC_MASK, reg);
> }
> +EXPORT_SYMBOL(pcie_tph_get_st_table_loc);
OK by me, but I think we should add kernel-doc for the return value.
With that doc added:
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> /*
> * Return the size of ST table. If ST table is not in TPH Requester Extended
> @@ -174,7 +175,7 @@ u16 pcie_tph_get_st_table_size(struct pci_dev *pdev)
> u32 loc;
>
> /* Check ST table location first */
> - loc = get_st_table_loc(pdev);
> + loc = pcie_tph_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);
> @@ -299,7 +300,7 @@ int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag)
> */
> set_ctrl_reg_req_en(pdev, PCI_TPH_REQ_DISABLE);
>
> - loc = get_st_table_loc(pdev);
> + loc = pcie_tph_get_st_table_loc(pdev);
> /* Convert loc to match with PCI_TPH_LOC_* */
> loc = FIELD_PREP(PCI_TPH_CAP_LOC_MASK, loc);
>
> diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h
> index 9e4e331b1603..ba28140ce670 100644
> --- a/include/linux/pci-tph.h
> +++ b/include/linux/pci-tph.h
> @@ -29,6 +29,7 @@ int pcie_tph_get_cpu_st(struct pci_dev *dev,
> void pcie_disable_tph(struct pci_dev *pdev);
> int pcie_enable_tph(struct pci_dev *pdev, int mode);
> u16 pcie_tph_get_st_table_size(struct pci_dev *pdev);
> +u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev);
> #else
> static inline int pcie_tph_set_st_entry(struct pci_dev *pdev,
> unsigned int index, u16 tag)
>
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc()
2025-11-03 15:43 ` Bjorn Helgaas
@ 2025-11-03 16:23 ` Yishai Hadas
2025-11-03 17:28 ` Bjorn Helgaas
0 siblings, 1 reply; 9+ messages in thread
From: Yishai Hadas @ 2025-11-03 16:23 UTC (permalink / raw)
To: Bjorn Helgaas, Leon Romanovsky
Cc: Bjorn Helgaas, Saeed Mahameed, Tariq Toukan, Mark Bloch,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-pci, linux-kernel, netdev, linux-rdma,
Edward Srouji
On 03/11/2025 17:43, Bjorn Helgaas wrote:
> On Mon, Oct 27, 2025 at 11:34:01AM +0200, Leon Romanovsky wrote:
>> From: Yishai Hadas <yishaih@nvidia.com>
>>
>> Expose pcie_tph_get_st_table_loc() to be used by drivers as will be done
>> in the next patch from the series.
>>
>> Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
>> Signed-off-by: Edward Srouji <edwards@nvidia.com>
>> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
>> ---
>> drivers/pci/tph.c | 7 ++++---
>> include/linux/pci-tph.h | 1 +
>> 2 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
>> index cc64f93709a4..8f8457ec9adb 100644
>> --- a/drivers/pci/tph.c
>> +++ b/drivers/pci/tph.c
>> @@ -155,7 +155,7 @@ static u8 get_st_modes(struct pci_dev *pdev)
>> return reg;
>> }
>>
>> -static u32 get_st_table_loc(struct pci_dev *pdev)
>> +u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
>> {
>> u32 reg;
>>
>> @@ -163,6 +163,7 @@ static u32 get_st_table_loc(struct pci_dev *pdev)
>>
>> return FIELD_GET(PCI_TPH_CAP_LOC_MASK, reg);
>> }
>> +EXPORT_SYMBOL(pcie_tph_get_st_table_loc);
>
> OK by me, but I think we should add kernel-doc for the return value.
>
> With that doc added:
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Thanks Bjorn.
We may add the below hunk.
Can that work for you ?
diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
index 8f8457ec9adb..385307a9a328 100644
--- a/drivers/pci/tph.c
+++ b/drivers/pci/tph.c
@@ -155,6 +155,12 @@ static u8 get_st_modes(struct pci_dev *pdev)
return reg;
}
+/**
+ * pcie_tph_get_st_table_loc - query the device for its ST table location
+ * @pdev: PCI device to query
+ *
+ * Return the location of the ST table
+ */
u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
{
u32 reg;
Yishai
>
>
>> /*
>> * Return the size of ST table. If ST table is not in TPH Requester Extended
>> @@ -174,7 +175,7 @@ u16 pcie_tph_get_st_table_size(struct pci_dev *pdev)
>> u32 loc;
>>
>> /* Check ST table location first */
>> - loc = get_st_table_loc(pdev);
>> + loc = pcie_tph_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);
>> @@ -299,7 +300,7 @@ int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag)
>> */
>> set_ctrl_reg_req_en(pdev, PCI_TPH_REQ_DISABLE);
>>
>> - loc = get_st_table_loc(pdev);
>> + loc = pcie_tph_get_st_table_loc(pdev);
>> /* Convert loc to match with PCI_TPH_LOC_* */
>> loc = FIELD_PREP(PCI_TPH_CAP_LOC_MASK, loc);
>>
>> diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h
>> index 9e4e331b1603..ba28140ce670 100644
>> --- a/include/linux/pci-tph.h
>> +++ b/include/linux/pci-tph.h
>> @@ -29,6 +29,7 @@ int pcie_tph_get_cpu_st(struct pci_dev *dev,
>> void pcie_disable_tph(struct pci_dev *pdev);
>> int pcie_enable_tph(struct pci_dev *pdev, int mode);
>> u16 pcie_tph_get_st_table_size(struct pci_dev *pdev);
>> +u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev);
>> #else
>> static inline int pcie_tph_set_st_entry(struct pci_dev *pdev,
>> unsigned int index, u16 tag)
>>
>> --
>> 2.51.0
>>
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc()
2025-11-03 16:23 ` Yishai Hadas
@ 2025-11-03 17:28 ` Bjorn Helgaas
2025-11-04 8:26 ` Yishai Hadas
0 siblings, 1 reply; 9+ messages in thread
From: Bjorn Helgaas @ 2025-11-03 17:28 UTC (permalink / raw)
To: Yishai Hadas
Cc: Leon Romanovsky, Bjorn Helgaas, Saeed Mahameed, Tariq Toukan,
Mark Bloch, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-pci, linux-kernel, netdev,
linux-rdma, Edward Srouji
On Mon, Nov 03, 2025 at 06:23:26PM +0200, Yishai Hadas wrote:
> On 03/11/2025 17:43, Bjorn Helgaas wrote:
> > On Mon, Oct 27, 2025 at 11:34:01AM +0200, Leon Romanovsky wrote:
> > > From: Yishai Hadas <yishaih@nvidia.com>
> > >
> > > Expose pcie_tph_get_st_table_loc() to be used by drivers as will be done
> > > in the next patch from the series.
> > >
> > > Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
> > > Signed-off-by: Edward Srouji <edwards@nvidia.com>
> > > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > > ---
> > > drivers/pci/tph.c | 7 ++++---
> > > include/linux/pci-tph.h | 1 +
> > > 2 files changed, 5 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
> > > index cc64f93709a4..8f8457ec9adb 100644
> > > --- a/drivers/pci/tph.c
> > > +++ b/drivers/pci/tph.c
> > > @@ -155,7 +155,7 @@ static u8 get_st_modes(struct pci_dev *pdev)
> > > return reg;
> > > }
> > > -static u32 get_st_table_loc(struct pci_dev *pdev)
> > > +u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
> > > {
> > > u32 reg;
> > > @@ -163,6 +163,7 @@ static u32 get_st_table_loc(struct pci_dev *pdev)
> > > return FIELD_GET(PCI_TPH_CAP_LOC_MASK, reg);
> > > }
> > > +EXPORT_SYMBOL(pcie_tph_get_st_table_loc);
> >
> > OK by me, but I think we should add kernel-doc for the return value.
> >
> > With that doc added:
> >
> > Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>
> Thanks Bjorn.
>
> We may add the below hunk.
>
> Can that work for you ?
No, because (a) it just restates the function name and doesn't say how
to interpret the return value (you would need a PCIe spec to look it
up) and (b) kernel-doc syntax would be "Return: " (see
Documentation/doc-guide/kernel-doc.rst for examples).
> diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
> index 8f8457ec9adb..385307a9a328 100644
> --- a/drivers/pci/tph.c
> +++ b/drivers/pci/tph.c
> @@ -155,6 +155,12 @@ static u8 get_st_modes(struct pci_dev *pdev)
> return reg;
> }
>
> +/**
> + * pcie_tph_get_st_table_loc - query the device for its ST table location
> + * @pdev: PCI device to query
> + *
> + * Return the location of the ST table
> + */
> u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
> {
> u32 reg;
>
> Yishai
>
> >
> >
> > > /*
> > > * Return the size of ST table. If ST table is not in TPH Requester Extended
> > > @@ -174,7 +175,7 @@ u16 pcie_tph_get_st_table_size(struct pci_dev *pdev)
> > > u32 loc;
> > > /* Check ST table location first */
> > > - loc = get_st_table_loc(pdev);
> > > + loc = pcie_tph_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);
> > > @@ -299,7 +300,7 @@ int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag)
> > > */
> > > set_ctrl_reg_req_en(pdev, PCI_TPH_REQ_DISABLE);
> > > - loc = get_st_table_loc(pdev);
> > > + loc = pcie_tph_get_st_table_loc(pdev);
> > > /* Convert loc to match with PCI_TPH_LOC_* */
> > > loc = FIELD_PREP(PCI_TPH_CAP_LOC_MASK, loc);
> > > diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h
> > > index 9e4e331b1603..ba28140ce670 100644
> > > --- a/include/linux/pci-tph.h
> > > +++ b/include/linux/pci-tph.h
> > > @@ -29,6 +29,7 @@ int pcie_tph_get_cpu_st(struct pci_dev *dev,
> > > void pcie_disable_tph(struct pci_dev *pdev);
> > > int pcie_enable_tph(struct pci_dev *pdev, int mode);
> > > u16 pcie_tph_get_st_table_size(struct pci_dev *pdev);
> > > +u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev);
> > > #else
> > > static inline int pcie_tph_set_st_entry(struct pci_dev *pdev,
> > > unsigned int index, u16 tag)
> > >
> > > --
> > > 2.51.0
> > >
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc()
2025-11-03 17:28 ` Bjorn Helgaas
@ 2025-11-04 8:26 ` Yishai Hadas
0 siblings, 0 replies; 9+ messages in thread
From: Yishai Hadas @ 2025-11-04 8:26 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Leon Romanovsky, Bjorn Helgaas, Saeed Mahameed, Tariq Toukan,
Mark Bloch, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-pci, linux-kernel, netdev,
linux-rdma, Edward Srouji
On 03/11/2025 19:28, Bjorn Helgaas wrote:
> On Mon, Nov 03, 2025 at 06:23:26PM +0200, Yishai Hadas wrote:
>> On 03/11/2025 17:43, Bjorn Helgaas wrote:
>>> On Mon, Oct 27, 2025 at 11:34:01AM +0200, Leon Romanovsky wrote:
>>>> From: Yishai Hadas <yishaih@nvidia.com>
>>>>
>>>> Expose pcie_tph_get_st_table_loc() to be used by drivers as will be done
>>>> in the next patch from the series.
>>>>
>>>> Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
>>>> Signed-off-by: Edward Srouji <edwards@nvidia.com>
>>>> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
>>>> ---
>>>> drivers/pci/tph.c | 7 ++++---
>>>> include/linux/pci-tph.h | 1 +
>>>> 2 files changed, 5 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
>>>> index cc64f93709a4..8f8457ec9adb 100644
>>>> --- a/drivers/pci/tph.c
>>>> +++ b/drivers/pci/tph.c
>>>> @@ -155,7 +155,7 @@ static u8 get_st_modes(struct pci_dev *pdev)
>>>> return reg;
>>>> }
>>>> -static u32 get_st_table_loc(struct pci_dev *pdev)
>>>> +u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
>>>> {
>>>> u32 reg;
>>>> @@ -163,6 +163,7 @@ static u32 get_st_table_loc(struct pci_dev *pdev)
>>>> return FIELD_GET(PCI_TPH_CAP_LOC_MASK, reg);
>>>> }
>>>> +EXPORT_SYMBOL(pcie_tph_get_st_table_loc);
>>>
>>> OK by me, but I think we should add kernel-doc for the return value.
>>>
>>> With that doc added:
>>>
>>> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>>
>> Thanks Bjorn.
>>
>> We may add the below hunk.
>>
>> Can that work for you ?
>
> No, because (a) it just restates the function name and doesn't say how
> to interpret the return value (you would need a PCIe spec to look it
> up) and (b) kernel-doc syntax would be "Return: " (see
> Documentation/doc-guide/kernel-doc.rst for examples).
>
I see.
How about adding the below as part of V1 with your Acked-by: ?
diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
index 8f8457ec9adb..510173cc8b63 100644
--- a/drivers/pci/tph.c
+++ b/drivers/pci/tph.c
@@ -155,6 +155,15 @@ static u8 get_st_modes(struct pci_dev *pdev)
return reg;
}
+/**
+ * pcie_tph_get_st_table_loc - Return the device's ST table location
+ * @pdev: PCI device to query
+ *
+ * Return:
+ * * PCI_TPH_LOC_NONE - Not present
+ * * PCI_TPH_LOC_CAP - Located in the TPH Requester Extended Capability
+ * * PCI_TPH_LOC_MSIX - Located in the MSI-X Table
+ */
Yishai
>> diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c
>> index 8f8457ec9adb..385307a9a328 100644
>> --- a/drivers/pci/tph.c
>> +++ b/drivers/pci/tph.c
>> @@ -155,6 +155,12 @@ static u8 get_st_modes(struct pci_dev *pdev)
>> return reg;
>> }
>>
>> +/**
>> + * pcie_tph_get_st_table_loc - query the device for its ST table location
>> + * @pdev: PCI device to query
>> + *
>> + * Return the location of the ST table
>> + */
>> u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev)
>> {
>> u32 reg;
>>
>> Yishai
>>
>>>
>>>
>>>> /*
>>>> * Return the size of ST table. If ST table is not in TPH Requester Extended
>>>> @@ -174,7 +175,7 @@ u16 pcie_tph_get_st_table_size(struct pci_dev *pdev)
>>>> u32 loc;
>>>> /* Check ST table location first */
>>>> - loc = get_st_table_loc(pdev);
>>>> + loc = pcie_tph_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);
>>>> @@ -299,7 +300,7 @@ int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag)
>>>> */
>>>> set_ctrl_reg_req_en(pdev, PCI_TPH_REQ_DISABLE);
>>>> - loc = get_st_table_loc(pdev);
>>>> + loc = pcie_tph_get_st_table_loc(pdev);
>>>> /* Convert loc to match with PCI_TPH_LOC_* */
>>>> loc = FIELD_PREP(PCI_TPH_CAP_LOC_MASK, loc);
>>>> diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h
>>>> index 9e4e331b1603..ba28140ce670 100644
>>>> --- a/include/linux/pci-tph.h
>>>> +++ b/include/linux/pci-tph.h
>>>> @@ -29,6 +29,7 @@ int pcie_tph_get_cpu_st(struct pci_dev *dev,
>>>> void pcie_disable_tph(struct pci_dev *pdev);
>>>> int pcie_enable_tph(struct pci_dev *pdev, int mode);
>>>> u16 pcie_tph_get_st_table_size(struct pci_dev *pdev);
>>>> +u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev);
>>>> #else
>>>> static inline int pcie_tph_set_st_entry(struct pci_dev *pdev,
>>>> unsigned int index, u16 tag)
>>>>
>>>> --
>>>> 2.51.0
>>>>
>>
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH mlx5-next 0/2] Add support for direct steering tag mode for RDMA mlx5_ib driver
2025-10-27 9:34 [PATCH mlx5-next 0/2] Add support for direct steering tag mode for RDMA mlx5_ib driver Leon Romanovsky
2025-10-27 9:34 ` [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc() Leon Romanovsky
2025-10-27 9:34 ` [PATCH mlx5-next 2/2] net/mlx5: Add direct ST mode support for RDMA Leon Romanovsky
@ 2025-11-11 10:04 ` Leon Romanovsky
2 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2025-11-11 10:04 UTC (permalink / raw)
To: Bjorn Helgaas, Saeed Mahameed, Tariq Toukan, Mark Bloch,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: linux-pci, linux-kernel, netdev, linux-rdma, Yishai Hadas,
Edward Srouji
On Mon, Oct 27, 2025 at 11:34:00AM +0200, Leon Romanovsky wrote:
> >From Yishai:
>
> Add support for direct steering mode where ST table location equals
> PCI_TPH_LOC_NONE.
>
> In that case, no steering table exists, the steering tag itself will be
> used directly by the SW, FW, HW from the mkey.
>
> In that mode of work, the driver is not limited any more to the 64 max
> entries of the capability config space table.
>
> The first patch in the series exposes the pcie_tph_get_st_table_loc()
> API to let drivers detect the ST table location.
>
> The second patch uses the direct mode in case the location equals
> PCI_TPH_LOC_NONE.
>
> This enables RDMA users working in that direct mode.
>
> Thanks
>
> ---
> Yishai Hadas (2):
> PCI/TPH: Expose pcie_tph_get_st_table_loc()
> net/mlx5: Add direct ST mode support for RDMA
Thanks, applied to mlx5-next.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-11-11 10:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-27 9:34 [PATCH mlx5-next 0/2] Add support for direct steering tag mode for RDMA mlx5_ib driver Leon Romanovsky
2025-10-27 9:34 ` [PATCH mlx5-next 1/2] PCI/TPH: Expose pcie_tph_get_st_table_loc() Leon Romanovsky
2025-11-02 10:17 ` Leon Romanovsky
2025-11-03 15:43 ` Bjorn Helgaas
2025-11-03 16:23 ` Yishai Hadas
2025-11-03 17:28 ` Bjorn Helgaas
2025-11-04 8:26 ` Yishai Hadas
2025-10-27 9:34 ` [PATCH mlx5-next 2/2] net/mlx5: Add direct ST mode support for RDMA Leon Romanovsky
2025-11-11 10:04 ` [PATCH mlx5-next 0/2] Add support for direct steering tag mode for RDMA mlx5_ib driver Leon Romanovsky
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).