[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ed6305f-e505-439a-8372-190fc10f4777@amd.com>
Date: Mon, 10 Nov 2025 14:54:00 +0000
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
Subject: Re: [PATCH v19 22/22] sfc: support pio mapping based on cxl
On 10/7/25 15:48, Jonathan Cameron wrote:
> On Mon, 6 Oct 2025 11:01:30 +0100
> <alejandro.lucero-palau@....com> wrote:
>
>> From: Alejandro Lucero <alucerop@....com>
>>
>> A PIO buffer is a region of device memory to which the driver can write a
>> packet for TX, with the device handling the transmit doorbell without
>> requiring a DMA for getting the packet data, which helps reducing latency
>> in certain exchanges. With CXL mem protocol this latency can be lowered
>> further.
>>
>> With a device supporting CXL and successfully initialised, use the cxl
>> region to map the memory range and use this mapping for PIO buffers.
>>
>> Add the disabling of those CXL-based PIO buffers if the callback for
>> potential cxl endpoint removal by the CXL code happens.
>>
>> Signed-off-by: Alejandro Lucero <alucerop@....com>
> A few minor things inline. The ifdef complexity in here is moderately
> nasty though. Might be worth seeing if any of that can be moved
> to stubs or IS_ENABLED() checks.
>
I'm afraid that would imply main refactoring in main efx/sfc code and I
prefer to avoid so. The sfc maintainer has the last word though.
>> diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
>> index 45e191686625..057d30090894 100644
>> --- a/drivers/net/ethernet/sfc/efx.h
>> +++ b/drivers/net/ethernet/sfc/efx.h
>> @@ -236,5 +236,4 @@ static inline bool efx_rwsem_assert_write_locked(struct rw_semaphore *sem)
>>
>> int efx_xdp_tx_buffers(struct efx_nic *efx, int n, struct xdp_frame **xdpfs,
>> bool flush);
>> -
> stray change that you should clean out.
Oh, yes. I'll remove it.
>> #endif /* EFX_EFX_H */
>> diff --git a/drivers/net/ethernet/sfc/efx_cxl.c b/drivers/net/ethernet/sfc/efx_cxl.c
>> index 79fe99d83f9f..a84ce45398c1 100644
>> --- a/drivers/net/ethernet/sfc/efx_cxl.c
>> +++ b/drivers/net/ethernet/sfc/efx_cxl.c
>> @@ -11,6 +11,7 @@
>> #include <cxl/pci.h>
>> #include "net_driver.h"
>> #include "efx_cxl.h"
>> +#include "efx.h"
>>
>> #define EFX_CTPIO_BUFFER_SIZE SZ_256M
>>
>> @@ -20,6 +21,7 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
>> struct pci_dev *pci_dev = efx->pci_dev;
>> resource_size_t max_size;
>> struct efx_cxl *cxl;
>> + struct range range;
>> u16 dvsec;
>> int rc;
>>
>> @@ -119,19 +121,40 @@ int efx_cxl_init(struct efx_probe_data *probe_data)
>> cxl->efx_region = cxl_create_region(cxl->cxlrd, &cxl->cxled, 1);
>> if (IS_ERR(cxl->efx_region)) {
>> pci_err(pci_dev, "CXL accel create region failed");
>> - cxl_put_root_decoder(cxl->cxlrd);
>> - cxl_dpa_free(cxl->cxled);
>> - return PTR_ERR(cxl->efx_region);
>> + rc = PTR_ERR(cxl->efx_region);
>> + goto err_dpa;
> It's a somewhat trivial thing but you could reduce churn by
> moving the err_dpa block introduction back to where this lot
> was first added.
>
The error path now has the minimum lines possible using the gotos when
that saves at least one code line.
Thanks!
Powered by blists - more mailing lists