diff mbox series

[12/14] qtnfmac: fix debugfs entries for multiple cards on the same host

Message ID 20190320100340.14168-13-sergey.matyukevich.os@quantenna.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series qtnfmac: regulatory rework and misc fixes | expand

Commit Message

Sergey Matyukevich March 20, 2019, 10:04 a.m. UTC
Fix creation of debugfs entries for qtnfmac wireless card: use separate
directories for different wireless cards. This commit enables support
for multiple qtnfmac wireless cards on the same PCIe host.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
---
 drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Kalle Valo March 20, 2019, 2:05 p.m. UTC | #1
Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> writes:

> Fix creation of debugfs entries for qtnfmac wireless card: use separate
> directories for different wireless cards. This commit enables support
> for multiple qtnfmac wireless cards on the same PCIe host.
>
> Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
> ---
>  drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> index b561b75e4433..56fc6d49c121 100644
> --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
>  
>  int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>  {
> +	struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
> +	char card_id[64];
>  	int ret;
>  
>  	bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
> @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>  	if (ret) {
>  		pr_err("failed to attach core\n");
>  	} else {
> -		qtnf_debugfs_init(bus, DRV_NAME);
> +		snprintf(card_id, sizeof(card_id), "%s:%s",
> +			 DRV_NAME, pci_name(priv->pdev));

Can you give an example for the path?
Sergey Matyukevich March 20, 2019, 3:16 p.m. UTC | #2
> > Fix creation of debugfs entries for qtnfmac wireless card: use separate
> > directories for different wireless cards. This commit enables support
> > for multiple qtnfmac wireless cards on the same PCIe host.
> >
> > Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
> > ---
> >  drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> > index b561b75e4433..56fc6d49c121 100644
> > --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> > +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> > @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
> >
> >  int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
> >  {
> > +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
> > +     char card_id[64];
> >       int ret;
> >
> >       bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
> > @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
> >       if (ret) {
> >               pr_err("failed to attach core\n");
> >       } else {
> > -             qtnf_debugfs_init(bus, DRV_NAME);
> > +             snprintf(card_id, sizeof(card_id), "%s:%s",
> > +                      DRV_NAME, pci_name(priv->pdev));
> 
> Can you give an example for the path?
> 

For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0

Regards,
Sergey
Kalle Valo March 21, 2019, 7:35 a.m. UTC | #3
Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> writes:

>> > Fix creation of debugfs entries for qtnfmac wireless card: use separate
>> > directories for different wireless cards. This commit enables support
>> > for multiple qtnfmac wireless cards on the same PCIe host.
>> >
>> > Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
>> > ---
>> >  drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
>> >  1 file changed, 5 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>> > index b561b75e4433..56fc6d49c121 100644
>> > --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>> > +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>> > @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
>> >
>> >  int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>> >  {
>> > +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
>> > +     char card_id[64];
>> >       int ret;
>> >
>> >       bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
>> > @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>> >       if (ret) {
>> >               pr_err("failed to attach core\n");
>> >       } else {
>> > -             qtnf_debugfs_init(bus, DRV_NAME);
>> > +             snprintf(card_id, sizeof(card_id), "%s:%s",
>> > +                      DRV_NAME, pci_name(priv->pdev));
>> 
>> Can you give an example for the path?
>> 
>
> For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0

TBH not really fond of that. What about
"/sys/kernel/debug/qtnfmac/pcie:0000:01:00.0"? IIRC iwlwifi used
something like that.

And please add an example path to the commit log.
Sergey Matyukevich March 21, 2019, 8:26 a.m. UTC | #4
Hello Kalle,

> >> > Fix creation of debugfs entries for qtnfmac wireless card: use separate
> >> > directories for different wireless cards. This commit enables support
> >> > for multiple qtnfmac wireless cards on the same PCIe host.
> >> >
> >> > Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
> >> > ---
> >> >  drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
> >> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> >> > index b561b75e4433..56fc6d49c121 100644
> >> > --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> >> > +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> >> > @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
> >> >
> >> >  int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
> >> >  {
> >> > +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
> >> > +     char card_id[64];
> >> >       int ret;
> >> >
> >> >       bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
> >> > @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
> >> >       if (ret) {
> >> >               pr_err("failed to attach core\n");
> >> >       } else {
> >> > -             qtnf_debugfs_init(bus, DRV_NAME);
> >> > +             snprintf(card_id, sizeof(card_id), "%s:%s",
> >> > +                      DRV_NAME, pci_name(priv->pdev));
> >>
> >> Can you give an example for the path?
> >>
> >
> > For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0
> 
> TBH not really fond of that. What about
> "/sys/kernel/debug/qtnfmac/pcie:0000:01:00.0"? IIRC iwlwifi used
> something like that.
> 
> And please add an example path to the commit log.

Ok, will be fixed and resubmitted in v2.

Or, alternatively, if the other patches are ok for you,
feel free to drop the questionable ones and apply all
the others. I will rework the rejected pieces and
resubmit them, adding more pending fixes.

Regards,
Sergey
Arend van Spriel March 21, 2019, 10:14 a.m. UTC | #5
On 3/21/2019 8:35 AM, Kalle Valo wrote:
> Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> writes:
> 
>>>> Fix creation of debugfs entries for qtnfmac wireless card: use separate
>>>> directories for different wireless cards. This commit enables support
>>>> for multiple qtnfmac wireless cards on the same PCIe host.
>>>>
>>>> Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
>>>> ---
>>>>   drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
>>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>>>> index b561b75e4433..56fc6d49c121 100644
>>>> --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>>>> +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>>>> @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
>>>>
>>>>   int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>>>>   {
>>>> +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
>>>> +     char card_id[64];
>>>>        int ret;
>>>>
>>>>        bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
>>>> @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>>>>        if (ret) {
>>>>                pr_err("failed to attach core\n");
>>>>        } else {
>>>> -             qtnf_debugfs_init(bus, DRV_NAME);
>>>> +             snprintf(card_id, sizeof(card_id), "%s:%s",
>>>> +                      DRV_NAME, pci_name(priv->pdev));
>>>
>>> Can you give an example for the path?
>>>
>>
>> For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0
> 
> TBH not really fond of that. What about
> "/sys/kernel/debug/qtnfmac/pcie:0000:01:00.0"? IIRC iwlwifi used
> something like that.

In brcmfmac we used to have it like that, but I changed it to use wiphy 
debugfs, ie. /sys/kernel/debug/ieee80211/phyX/.

Gr. AvS
Sergey Matyukevich March 21, 2019, 3:46 p.m. UTC | #6
> > > > > Fix creation of debugfs entries for qtnfmac wireless card: use separate
> > > > > directories for different wireless cards. This commit enables support
> > > > > for multiple qtnfmac wireless cards on the same PCIe host.
> > > > > 
> > > > > Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
> > > > > ---
> > > > >   drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
> > > > >   1 file changed, 5 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> > > > > index b561b75e4433..56fc6d49c121 100644
> > > > > --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> > > > > +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
> > > > > @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
> > > > > 
> > > > >   int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
> > > > >   {
> > > > > +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
> > > > > +     char card_id[64];
> > > > >        int ret;
> > > > > 
> > > > >        bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
> > > > > @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
> > > > >        if (ret) {
> > > > >                pr_err("failed to attach core\n");
> > > > >        } else {
> > > > > -             qtnf_debugfs_init(bus, DRV_NAME);
> > > > > +             snprintf(card_id, sizeof(card_id), "%s:%s",
> > > > > +                      DRV_NAME, pci_name(priv->pdev));
> > > > 
> > > > Can you give an example for the path?
> > > > 
> > > 
> > > For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0
> > 
> > TBH not really fond of that. What about
> > "/sys/kernel/debug/qtnfmac/pcie:0000:01:00.0"? IIRC iwlwifi used
> > something like that.


Hello Arend,

> In brcmfmac we used to have it like that, but I changed it to use wiphy
> debugfs, ie. /sys/kernel/debug/ieee80211/phyX/.

Yes, I saw the patches for brcmfmac. In fact, looking at those patches
we figured out that we have a problem before we started testing
two cards in one pcie host :)

But /sys/kernel/debug/eee80211/phyX approach does not fit well for our
use-case. We may have up to 3 phy-s for single card, but counters
exported via debugfs are for pcie device as a whole.

Thanks,
Sergey
Kalle Valo March 21, 2019, 5:06 p.m. UTC | #7
Arend Van Spriel <arend.vanspriel@broadcom.com> writes:

> On 3/21/2019 8:35 AM, Kalle Valo wrote:
>> Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> writes:
>>
>>>>> Fix creation of debugfs entries for qtnfmac wireless card: use separate
>>>>> directories for different wireless cards. This commit enables support
>>>>> for multiple qtnfmac wireless cards on the same PCIe host.
>>>>>
>>>>> Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
>>>>> ---
>>>>>   drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
>>>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>>>>> index b561b75e4433..56fc6d49c121 100644
>>>>> --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>>>>> +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>>>>> @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
>>>>>
>>>>>   int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>>>>>   {
>>>>> +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
>>>>> +     char card_id[64];
>>>>>        int ret;
>>>>>
>>>>>        bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
>>>>> @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>>>>>        if (ret) {
>>>>>                pr_err("failed to attach core\n");
>>>>>        } else {
>>>>> -             qtnf_debugfs_init(bus, DRV_NAME);
>>>>> +             snprintf(card_id, sizeof(card_id), "%s:%s",
>>>>> +                      DRV_NAME, pci_name(priv->pdev));
>>>>
>>>> Can you give an example for the path?
>>>>
>>>
>>> For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0
>>
>> TBH not really fond of that. What about
>> "/sys/kernel/debug/qtnfmac/pcie:0000:01:00.0"? IIRC iwlwifi used
>> something like that.
>
> In brcmfmac we used to have it like that, but I changed it to use
> wiphy debugfs, ie. /sys/kernel/debug/ieee80211/phyX/.

Yeah, that's much better.
Kalle Valo March 22, 2019, 8:44 a.m. UTC | #8
Sergey Matyukevich <sergey.matyukevich.os@quantenna.com> writes:

> Hello Kalle,
>
>> >> > Fix creation of debugfs entries for qtnfmac wireless card: use separate
>> >> > directories for different wireless cards. This commit enables support
>> >> > for multiple qtnfmac wireless cards on the same PCIe host.
>> >> >
>> >> > Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
>> >> > ---
>> >> >  drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 6 +++++-
>> >> >  1 file changed, 5 insertions(+), 1 deletion(-)
>> >> >
>> >> > diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>> >> > index b561b75e4433..56fc6d49c121 100644
>> >> > --- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>> >> > +++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
>> >> > @@ -130,6 +130,8 @@ static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
>> >> >
>> >> >  int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>> >> >  {
>> >> > +     struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
>> >> > +     char card_id[64];
>> >> >       int ret;
>> >> >
>> >> >       bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
>> >> > @@ -137,7 +139,9 @@ int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
>> >> >       if (ret) {
>> >> >               pr_err("failed to attach core\n");
>> >> >       } else {
>> >> > -             qtnf_debugfs_init(bus, DRV_NAME);
>> >> > +             snprintf(card_id, sizeof(card_id), "%s:%s",
>> >> > +                      DRV_NAME, pci_name(priv->pdev));
>> >>
>> >> Can you give an example for the path?
>> >>
>> >
>> > For instance:  /sys/kernel/debug/qtnfmac_pcie:0000:01:00.0
>> 
>> TBH not really fond of that. What about
>> "/sys/kernel/debug/qtnfmac/pcie:0000:01:00.0"? IIRC iwlwifi used
>> something like that.
>> 
>> And please add an example path to the commit log.
>
> Ok, will be fixed and resubmitted in v2.

Thanks.

> Or, alternatively, if the other patches are ok for you,
> feel free to drop the questionable ones and apply all
> the others. I will rework the rejected pieces and
> resubmit them, adding more pending fixes.

A good point, that's easier. So I have dropped patch 12.
diff mbox series

Patch

diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
index b561b75e4433..56fc6d49c121 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
@@ -130,6 +130,8 @@  static int qtnf_dbg_shm_stats(struct seq_file *s, void *data)
 
 int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
 {
+	struct qtnf_pcie_bus_priv *priv = get_bus_priv(bus);
+	char card_id[64];
 	int ret;
 
 	bus->fw_state = QTNF_FW_STATE_BOOT_DONE;
@@ -137,7 +139,9 @@  int qtnf_pcie_fw_boot_done(struct qtnf_bus *bus)
 	if (ret) {
 		pr_err("failed to attach core\n");
 	} else {
-		qtnf_debugfs_init(bus, DRV_NAME);
+		snprintf(card_id, sizeof(card_id), "%s:%s",
+			 DRV_NAME, pci_name(priv->pdev));
+		qtnf_debugfs_init(bus, card_id);
 		qtnf_debugfs_add_entry(bus, "mps", qtnf_dbg_mps_show);
 		qtnf_debugfs_add_entry(bus, "msi_enabled", qtnf_dbg_msi_show);
 		qtnf_debugfs_add_entry(bus, "shm_stats", qtnf_dbg_shm_stats);