[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fd492a06-5004-40ef-a0b7-c005af43f2f4@amd.com>
Date: Thu, 25 Sep 2025 10:45:14 +0100
From: Alejandro Lucero Palau <alucerop@....com>
To: Jonathan Cameron <jonathan.cameron@...wei.com>,
alejandro.lucero-palau@....com
Cc: linux-cxl@...r.kernel.org, netdev@...r.kernel.org,
dan.j.williams@...el.com, edward.cree@....com, davem@...emloft.net,
kuba@...nel.org, pabeni@...hat.com, edumazet@...gle.com,
dave.jiang@...el.com, Martin Habets <habetsm.xilinx@...il.com>,
Edward Cree <ecree.xilinx@...il.com>
Subject: Re: [PATCH v18 12/20] sfc: get endpoint decoder
On 9/18/25 15:53, Jonathan Cameron wrote:
> On Thu, 18 Sep 2025 10:17:38 +0100
> alejandro.lucero-palau@....com wrote:
>
>> From: Alejandro Lucero <alucerop@....com>
>>
>> Use cxl api for getting DPA (Device Physical Address) to use through an
>> endpoint decoder.
>>
>> Signed-off-by: Alejandro Lucero <alucerop@....com>
>> Reviewed-by: Martin Habets <habetsm.xilinx@...il.com>
>> Acked-by: Edward Cree <ecree.xilinx@...il.com>
>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
>> ---
>> drivers/net/ethernet/sfc/efx_cxl.c | 28 ++++++++++++++++++++++------
>> 1 file changed, 22 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/efx_cxl.c b/drivers/net/ethernet/sfc/efx_cxl.c
>> index d29594e71027..4461b7a4dc2c 100644
>> --- a/drivers/net/ethernet/sfc/efx_cxl.c
>> +++ b/drivers/net/ethernet/sfc/efx_cxl.c
>> @@ -99,16 +99,23 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
>>
>> if (IS_ERR(cxl->cxlrd)) {
>> pci_err(pci_dev, "cxl_get_hpa_freespace failed\n");
>> - cxl_release_endpoint(cxl->cxlmd, cxl->endpoint);
>> - return PTR_ERR(cxl->cxlrd);
>> + rc = PTR_ERR(cxl->cxlrd);
>> + goto err_release;
> Push back into patch 10. I was wondering why you didn't do this there, thn
> found it here.
Using a goto label in patch 10 does not save lines with clarity not
being improved either. With more code below doing the same type of
unwinding, it makes sense now.
Anyway, after removing patch 8, the unwinding is simpler and does not
require goto labels. Coming with v19 ...
Thanks
>
>> }
>>
>> if (max_size < EFX_CTPIO_BUFFER_SIZE) {
>> pci_err(pci_dev, "%s: not enough free HPA space %pap < %u\n",
>> __func__, &max_size, EFX_CTPIO_BUFFER_SIZE);
>> - cxl_put_root_decoder(cxl->cxlrd);
>> - cxl_release_endpoint(cxl->cxlmd, cxl->endpoint);
>> - return -ENOSPC;
>> + rc = -ENOSPC;
>> + goto err_decoder;
>> + }
>> +
>> + cxl->cxled = cxl_request_dpa(cxl->cxlmd, CXL_PARTMODE_RAM,
>> + EFX_CTPIO_BUFFER_SIZE);
>> + if (IS_ERR(cxl->cxled)) {
>> + pci_err(pci_dev, "CXL accel request DPA failed");
>> + rc = PTR_ERR(cxl->cxled);
>> + goto err_decoder;
>> }
>>
>> probe_data->cxl = cxl;
>> @@ -116,12 +123,21 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
>> cxl_release_endpoint(cxl->cxlmd, cxl->endpoint);
>>
>> return 0;
>> +
>> +err_decoder:
>> + cxl_put_root_decoder(cxl->cxlrd);
>> +err_release:
>> + cxl_release_endpoint(cxl->cxlmd, cxl->endpoint);
>> +
>> + return rc;
>> }
>>
>> void efx_cxl_exit(struct efx_probe_data *probe_data)
>> {
>> - if (probe_data->cxl)
>> + if (probe_data->cxl) {
>> + cxl_dpa_free(probe_data->cxl->cxled);
>> cxl_put_root_decoder(probe_data->cxl->cxlrd);
>> + }
>> }
>>
>> MODULE_IMPORT_NS("CXL");
Powered by blists - more mailing lists