[Intel-wired-lan] [iwl-next v2 4/7] ice, irdma: move interrupts code to irdma

Michal Swiatkowski michal.swiatkowski at linux.intel.com
Mon Aug 5 04:55:45 UTC 2024


On Fri, Aug 02, 2024 at 02:49:08PM +0200, Przemek Kitszel wrote:
> On 8/1/24 11:31, Michal Swiatkowski wrote:
> > Move responsibility of MSI-X requesting for RDMA feature from ice driver
> > to irdma driver. It is done to allow simple fallback when there is not
> > enough MSI-X available.
> > 
> > Signed-off-by: Michal Swiatkowski <michal.swiatkowski at linux.intel.com>
> > ---
> >   drivers/infiniband/hw/irdma/hw.c         |  2 -
> >   drivers/infiniband/hw/irdma/main.c       | 46 ++++++++++++++++-
> >   drivers/infiniband/hw/irdma/main.h       |  3 ++
> >   drivers/net/ethernet/intel/ice/ice.h     |  2 -
> >   drivers/net/ethernet/intel/ice/ice_idc.c | 64 ++++++------------------
> >   include/linux/net/intel/iidc.h           |  2 +
> >   6 files changed, 63 insertions(+), 56 deletions(-)
> > 
> > diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c
> > index ad50b77282f8..69ce1862eabe 100644
> > --- a/drivers/infiniband/hw/irdma/hw.c
> > +++ b/drivers/infiniband/hw/irdma/hw.c
> > @@ -498,8 +498,6 @@ static int irdma_save_msix_info(struct irdma_pci_f *rf)
> >   	iw_qvlist->num_vectors = rf->msix_count;
> >   	if (rf->msix_count <= num_online_cpus())
> >   		rf->msix_shared = true;
> > -	else if (rf->msix_count > num_online_cpus() + 1)
> > -		rf->msix_count = num_online_cpus() + 1;
> >   	pmsix = rf->msix_entries;
> >   	for (i = 0, ceq_idx = 0; i < rf->msix_count; i++, iw_qvinfo++) {
> > diff --git a/drivers/infiniband/hw/irdma/main.c b/drivers/infiniband/hw/irdma/main.c
> > index 3f13200ff71b..69ad137be7aa 100644
> > --- a/drivers/infiniband/hw/irdma/main.c
> > +++ b/drivers/infiniband/hw/irdma/main.c
> > @@ -206,6 +206,43 @@ static void irdma_lan_unregister_qset(struct irdma_sc_vsi *vsi,
> >   		ibdev_dbg(&iwdev->ibdev, "WS: LAN free_res for rdma qset failed.\n");
> >   }
> > +static int irdma_init_interrupts(struct irdma_pci_f *rf, struct ice_pf *pf)
> > +{
> > +	int i;
> > +
> > +	rf->msix_count = num_online_cpus() + IRDMA_NUM_AEQ_MSIX;
> > +	rf->msix_entries = kcalloc(rf->msix_count, sizeof(*rf->msix_entries),
> > +				   GFP_KERNEL);
> > +	if (!rf->msix_entries)
> > +		return -ENOMEM;
> > +
> > +	for (i = 0; i < rf->msix_count; i++)
> > +		if (ice_alloc_rdma_qvector(pf, &rf->msix_entries[i]))
> > +			break;
> > +
> > +	if (i < IRDMA_MIN_MSIX) {
> > +		for (; i >= 0; i--)
> > +			ice_free_rdma_qvector(pf, &rf->msix_entries[i]);
> 
> you call ice_free_rdma_qvector() for i=0 even if the very first alloc
> attempt has failed
> 

Good point, I will fix it, thanks

> > +
> > +		kfree(rf->msix_entries);
> > +		return -ENOMEM;
> > +	}
> > +
> > +	rf->msix_count = i;
> > +
> > +	return 0;
> > +}
> 
> [...]
> 
> > --- a/drivers/infiniband/hw/irdma/main.h
> > +++ b/drivers/infiniband/hw/irdma/main.h
> > @@ -117,6 +117,9 @@ extern struct auxiliary_driver i40iw_auxiliary_drv;
> >   #define IRDMA_IRQ_NAME_STR_LEN (64)
> > +#define IRDMA_NUM_AEQ_MSIX	1
> > +#define IRDMA_MIN_MSIX		2
> > +
> >   enum init_completion_state {
> >   	INVALID_STATE = 0,
> >   	INITIAL_STATE,
> > diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
> > index 8247d27541b0..1311be1d2c30 100644
> > --- a/drivers/net/ethernet/intel/ice/ice.h
> > +++ b/drivers/net/ethernet/intel/ice/ice.h
> > @@ -97,8 +97,6 @@
> >   #define ICE_MIN_MSIX		(ICE_MIN_LAN_TXRX_MSIX + ICE_MIN_LAN_OICR_MSIX)
> >   #define ICE_MAX_MSIX		256
> >   #define ICE_FDIR_MSIX		2
> > -#define ICE_RDMA_NUM_AEQ_MSIX	4
> 
> you have to extend commit message to tell why there is a 4 -> 1 change
>

Ok, I will

> > -#define ICE_MIN_RDMA_MSIX	2
> >   #define ICE_ESWITCH_MSIX	1
> >   #define ICE_NO_VSI		0xffff
> >   #define ICE_VSI_MAP_CONTIG	0
> 
> 


More information about the Intel-wired-lan mailing list