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: <88d261d1-b1fe-447f-a928-02dec6141b0b@linux.ibm.com>
Date: Fri, 15 Aug 2025 13:59:49 +0200
From: Alexandra Winter <wintera@...ux.ibm.com>
To: dust.li@...ux.alibaba.com, David Miller <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Andrew Lunn <andrew+netdev@...n.ch>,
        "D. Wythe" <alibuda@...ux.alibaba.com>,
        Sidraya Jayagond <sidraya@...ux.ibm.com>,
        Wenjia Zhang
 <wenjia@...ux.ibm.com>,
        Julian Ruess <julianr@...ux.ibm.com>
Cc: netdev@...r.kernel.org, linux-s390@...r.kernel.org,
        Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ux.ibm.com>,
        Sven Schnelle <svens@...ux.ibm.com>,
        Thorsten Winkler <twinkler@...ux.ibm.com>,
        Simon Horman <horms@...nel.org>,
        Mahanta Jambigi <mjambigi@...ux.ibm.com>,
        Tony Lu
 <tonylu@...ux.alibaba.com>, Wen Gu <guwen@...ux.alibaba.com>,
        Halil Pasic <pasic@...ux.ibm.com>, linux-rdma@...r.kernel.org
Subject: Re: [RFC net-next 11/17] net/dibs: Move struct device to dibs_dev



On 15.08.25 03:56, Dust Li wrote:
> On 2025-08-14 10:51:27, Alexandra Winter wrote:
>>
>> On 06.08.25 17:41, Alexandra Winter wrote:
>> [...]
>>> Replace smcd->ops->get_dev(smcd) by dibs_get_dev().
>>>
>> Looking at the resulting code, I don't really like this concept of a *_get_dev() function,
>> that does not call get_device().
>> I plan to replace that by using dibs->dev directly in the next version.
> May I ask why? Because of the function name ? If so, maybe we can change the name.

Yes the name. Especially, as it is often used as argument for get_device() or put_device().
Eventually I would like to provide dibs_get_dev()/dibs_put_dev() that actually
do refcounting.
And then I thought defining dibs_read_dev() is not helping readability.

> 
> While I don't have a strong preference either way, I personally favor
> hiding the members of the dibs_dev structure from the upper layer. In my
> opinion, it would be better to avoid direct access to dibs members from
> upper layers and instead provide dedicated interface functions.
> 
> For example, I even think we should not expose dibs->ops->xxx directly
> to the SMC layer. Encapsulating such details would improve modularity
> and maintainability. Just like what IB subsystem has done before :)
> 
> For example:
> # git grep dibs net/smc
> [...]
> net/smc/smc_ism.c:      return dibs->ops->query_remote_gid(dibs, &ism_rgid, vlan_id ? 1 : 0,
> net/smc/smc_ism.c:      return smcd->dibs->ops->get_fabric_id(smcd->dibs);
> net/smc/smc_ism.c:      if (!smcd->dibs->ops->add_vlan_id)
> net/smc/smc_ism.c:      if (smcd->dibs->ops->add_vlan_id(smcd->dibs, vlanid)) {
> net/smc/smc_ism.c:      if (!smcd->dibs->ops->del_vlan_id)
> net/smc/smc_ism.c:      if (smcd->dibs->ops->del_vlan_id(smcd->dibs, vlanid))
> [...]
> 
> Best regards,
> Dust


I see your point and I remember you brought that up in your review of
[RFC net-next 0/7] Provide an ism layer
already.

I tried to keep this series to a meaningful minimum, which is a tradeoff.
If possible, I just wanted to move code around and add the dibs layer
in-between. There are several areas where I would like to see even more
de-coupling. eg.:
- handle_irq(): Clients should not run in interrupt context,
  a receive_data() callback function would be better.
- The device drivers should not loop through the client array
- dibs_dev_op.*_dmb() functions reveal unnecessary details of the
  internal dmb struct to the clients
- ...

So instead of adding a set of 1:1 caller functions / interface functions
for dibs_dev_ops and dibs_client_ops now, I would like to propose to work
on further decoupling devices and clients by adding more abstractions that
bring benefit. And then replace the remaining calls to ops by 1:1 caller
functions. Does that make sense? Or does anybody feel strongly that I need
to provide interface functions now?

BTW, there are some client-only functions and some device-driver-only functions
in dibs.h already. So that is the direction.






Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ