lkml.org 
[lkml]   [2021]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Circular dependency between DSA switch driver and tagging protocol driver
From


On 9/8/2021 5:26 PM, Vladimir Oltean wrote:
> On Wed, Sep 08, 2021 at 03:14:51PM -0700, Florian Fainelli wrote:
>>> Where is the problem?
>>
>> I'd say with 994d2cbb08ca, since the tagger now requires visibility into
>> sja1105_switch_ops which is not great, to say the least. You could solve
>> this by:
>>
>> - splitting up the sja1150 between a library that contains
>> sja1105_switch_ops and does not contain the driver registration code
>
> I've posted patches which more or less cheat the dependency by creating
> a third module, as you suggest. The tagging protocol still depends on
> the main module, now sans the call to dsa_register_switch, that is
> provided by the third driver, sja1105_probe.ko, which as the name
> suggests probes the hardware. The sja1105_probe.ko also depends on
> sja1105.ko, so the insmod order needs to be:
>
> insmod sja1105.ko
> insmod tag_sja1105.ko
> insmod sja1105_probe.ko
>
> I am not really convinced that this change contributes to the overall
> code organization and structure.

Yes, I don't really like it either, maybe we do need to resolve the
other dependency created with 566b18c8b752 with a function
pointer/indirect call that gets resolved at run-time, assuming the
overhead is acceptable.

>
>> - finding a different way to do a dsa_switch_ops pointer comparison, by
>> e.g.: maintaining a boolean in dsa_port that tracks whether a particular
>> driver is backing that port
>
> Maybe I just don't see how this would scale. So to clarify, are you
> suggesting to add a struct dsa_port :: bool is_sja1105, which the
> sja1105 driver would set to true in sja1105_setup?

Not necessarily something that is sja1105 specific, but something that
indicates whether the tagger is operating with its intended switch
driver, or with a "foreign" switch driver (say: dsa_loop for instance).

>
> If this was not a driver I would be maintaining, just watching as a
> reviewer, I believe "no" is what I would say to that.
>

--
Florian

\
 
 \ /
  Last update: 2021-09-09 02:49    [W:0.113 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site