public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
To: Scott Feldman <sfeldma@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>, netdev <netdev@vger.kernel.org>,
	David <davem@davemloft.net>, Jiri Pirko <jiri@resnulli.us>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	kernel <kernel@savoirfairelinux.com>
Subject: Re: [PATCH v3 0/3] net: dsa: mv88e6xxx: add support for VLAN Table Unit
Date: Tue, 7 Jul 2015 12:17:57 -0400 (EDT)	[thread overview]
Message-ID: <1594179899.212564.1436285877003.JavaMail.zimbra@savoirfairelinux.com> (raw)
In-Reply-To: <CAE4R7bALqVsV7nTH0r+AqbxE8z2ScG=_FfaBkpzrfXyw0A9DJg@mail.gmail.com>

Hi Andrew, Scott,

On Jul 6, 2015, at 11:46 PM, Scott Feldman sfeldma@gmail.com wrote:

> On Mon, Jul 6, 2015 at 7:00 PM, Andrew Lunn <andrew@lunn.ch> wrote:
>> On Tue, Jul 07, 2015 at 01:38:04AM +0200, Andrew Lunn wrote:
>>> On Sun, Jul 05, 2015 at 10:14:50PM -0400, Vivien Didelot wrote:
>>> > Hi all,
>>> >
>>> > This patchset brings full support for hardware VLANs in DSA, and the Marvell
>>> > 88E6xxx compatible switch chips.
>>>
>>> Hi Vivien
>>>
>>> I just booted these patches on my board, and i'm getting WARNINGS:
>>>
>>> [   61.111302] WARNING: CPU: 0 PID: 2751 at net/switchdev/switchdev.c:265
>>> switchdev_port_obj_add+0xd4/0xdc()
>>
>> Hi Vivien
>>
>> I debugged this a bit.
>>
>> The problem comes from:
>>
>> static int dsa_slave_port_obj_add(struct net_device *dev,
>>                                   struct switchdev_obj *obj)
>> {
>>         int err;
>>
>>         /*
>>          * Skip the prepare phase, since currently the DSA drivers don't need to
>>          * allocate any memory for operations and they will not fail to HW
>>          * (unless something horrible goes wrong on the MDIO bus, in which case
>>          * the prepare phase wouldn't have been able to predict anyway).
>>          */
>>         if (obj->trans != SWITCHDEV_TRANS_COMMIT)
>>                 return 0;
>>
>>         switch (obj->id) {
>>         case SWITCHDEV_OBJ_PORT_VLAN:
>>                 err = dsa_slave_port_vlans_add(dev, obj);
>>                 break;
>>         default:
>>                 err = -EOPNOTSUPP;
>>                 break;
>>         }
>>
>>         return err;
>> }
>>
>> It is being called with obj->id of 2, which is
>> SWITCHDEV_OBJ_IPV4_FIB. This function is called twice. The first time
>> it is with SWITCHDEV_TRANS_PREPARE and we are allowed to return an
>> error. The second time, with SWITCHDEV_TRANS_COMMIT, errors are not
>> allowed.
>>
>> EOPNOTSUPP is considered an error, so since we don't support
>> SWITCHDEV_OBJ_IPV4_FIB we error out the COMMIT phase.
>>
>> Not sure which is cleaner. Test to see if we support the object during
>> the prepare, or allow the commit to accept EOPNOTSUPP as not being an
>> error?
> 
> I think we should return EOPNOTSUPP on PREPARE, so move the trans !=
> COMMIT test inside the case for PORT_VLAN.  That would future-proof
> the func when new objects are added to switchdev (and not supported by
> dsa_slave).

Does this fixup http://ix.io/jxq look good to you?

Thanks,
-v

  reply	other threads:[~2015-07-07 16:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06  2:14 [PATCH v3 0/3] net: dsa: mv88e6xxx: add support for VLAN Table Unit Vivien Didelot
2015-07-06  2:14 ` [PATCH v3 1/3] net: dsa: mv88e6xxx: add debugfs interface for VTU Vivien Didelot
2015-07-07  2:08   ` Andrew Lunn
2015-07-07 15:52     ` Vivien Didelot
2015-07-07 16:07       ` Andrew Lunn
2015-07-07 16:19         ` Vivien Didelot
2015-07-07 16:11       ` Guenter Roeck
2015-07-06  2:14 ` [PATCH v3 2/3] net: dsa: add support for switchdev VLAN objects Vivien Didelot
2015-07-06  2:14 ` [PATCH v3 3/3] net: dsa: mv88e6xxx: add switchdev VLAN operations Vivien Didelot
2015-07-06 23:38 ` [PATCH v3 0/3] net: dsa: mv88e6xxx: add support for VLAN Table Unit Andrew Lunn
2015-07-07  2:00   ` Andrew Lunn
2015-07-07  3:46     ` Scott Feldman
2015-07-07 16:17       ` Vivien Didelot [this message]
2015-07-07 16:22         ` Andrew Lunn
2015-07-07 20:00         ` Scott Feldman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1594179899.212564.1436285877003.JavaMail.zimbra@savoirfairelinux.com \
    --to=vivien.didelot@savoirfairelinux.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=netdev@vger.kernel.org \
    --cc=sfeldma@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox