lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3540c6da-edbd-48e8-8bcb-effe64470ca0@redhat.com>
Date: Thu, 21 Mar 2024 10:33:21 +0100
From: Ivan Vecera <ivecera@...hat.com>
To: Paolo Abeni <pabeni@...hat.com>, intel-wired-lan@...ts.osuosl.org
Cc: Jesse Brandeburg <jesse.brandeburg@...el.com>,
 Tony Nguyen <anthony.l.nguyen@...el.com>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>,
 "open list:NETWORKING DRIVERS" <netdev@...r.kernel.org>,
 open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH iwl-next 5/7] i40e: Consolidate checks whether given VSI
 is main



On 19. 03. 24 11:17, Paolo Abeni wrote:
> On Mon, 2024-03-18 at 15:30 +0100, Ivan Vecera wrote:
>> In the driver code there are 3 types of checks whether given
>> VSI is main or not:
>> 1. vsi->type ==/!= I40E_VSI_MAIN
>> 2. vsi ==/!= pf->vsi[pf->lan_vsi]
>> 3. vsi->seid ==/!= pf->vsi[pf->lan_vsi]->seid
>>
>> All of them are equivalent and can be consolidated. Convert cases
>> 2 and 3 to case 1.
> 
> Minor nit: while at it, what about introducing an helper for such
> check?
> Reordering the patches you could use it also in i40e_pf_get_main_vsi()

No, I couldn't, that helper does not check vsi->type value:

/**
  * i40e_pf_get_main_vsi - get pointer to main VSI
  * @pf: pointer to a PF
  *
  * Return pointer to main VSI or NULL if it does not exist
  **/
static inline struct i40e_vsi *i40e_pf_get_main_vsi(struct i40e_pf *pf)
{
	return (pf->lan_vsi != I40E_NO_VSI) ? pf->vsi[pf->lan_vsi] : NULL;
}

I had an idea with helper like:
static inline bool i40e_is_main_vsi(struct i40e_vsi *vsi)
{
	struct i40e_pf *pf = vsi->back;
	return (pf->vsi[pf->lan_vsi] == vsi);
}

but I think that `vsi->type == I40E_VSI_MAIN` is simple enough.

Thanks,
Ivan


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ