Re: [net-next PATCH v5 1/6] octeontx2: Set appropriate PF, VF masks and shifts based on silicon
From: Subbaraya Sundeep Bhatta <sbhatta@marvell.com>
Date: 2024-12-10 13:56:19
Also in:
lkml
Hi Jakub,
From: Jakub Kicinski <mailto:kuba@kernel.org> Sent: Tuesday, December 10, 2024 2:55 AM To: Subbaraya Sundeep Bhatta <mailto:sbhatta@marvell.com> Cc: Sai Krishna Gajula <mailto:saikrishnag@marvell.com>; mailto:davem@davemloft.net; mailto:edumazet@google.com; mailto:pabeni@redhat.com; mailto:netdev@vger.kernel.org; mailto:linux- kernel@vger.kernel.org; Sunil Kovvuri Goutham <mailto:sgoutham@marvell.com>; Geethasowjanya Akula <mailto:gakula@marvell.com>; Linu Cherian <mailto:lcherian@marvell.com>; Jerin Jacob <mailto:jerinj@marvell.com>; Hariprasad Kelam <mailto:hkelam@marvell.com>; mailto:andrew+netdev@lunn.ch; mailto:kalesh-anakkur.purayil@broadcom.com Subject: Re: [EXTERNAL] Re: [net-next PATCH v5 1/6] octeontx2: Set appropriate PF, VF masks and shifts based on siliconquoted
quoted
quoted
-#define RVU_PFVF_PF_SHIFT 10 -#define RVU_PFVF_PF_MASK 0x3F -#define RVU_PFVF_FUNC_SHIFT 0 -#define RVU_PFVF_FUNC_MASK 0x3FF +#define RVU_PFVF_PF_SHIFT rvu_pcifunc_pf_shift +#define RVU_PFVF_PF_MASK rvu_pcifunc_pf_mask +#define RVU_PFVF_FUNC_SHIFT rvu_pcifunc_func_shift +#define RVU_PFVF_FUNC_MASK rvu_pcifunc_func_maskWhy do you maintain these defines? Looks like an unnecessary indirection. Given these are simple mask and shift values they probably have trivial users. Start by adding helpers which perform the conversions using those, then you can more easily update constants.There are too many places these masks are used hence added this indirection. # grep RVU_PFVF_ drivers/* -inr | wc -l 135Yes, I have checked before making the suggestion. Add a helper first, you can use cocci to do the conversions.
Initially I thought of doing similar kind of changes by visiting each line using these masks. But patch would be much bigger and also to avoid any regression issues for existing silicons and crypto driver, I thought this would be safe and simple. Please let me know if this is still not okay for you. Thanks, Sundeep