From: Florian Fainelli <f.fainelli@gmail.com>
To: Christian Lamparter <chunkeey@gmail.com>, netdev@vger.kernel.org
Cc: "David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH 1/2] net: emac: implement 802.1Q VLAN TX tagging support
Date: Wed, 17 Oct 2018 13:09:10 -0700 [thread overview]
Message-ID: <0b0b153c-b5fa-cd7d-62ff-3dd67eb8fe97@gmail.com> (raw)
In-Reply-To: <be3f3bf7-7635-6983-b1d2-c6dcf0e81eab@gmail.com>
On 10/17/2018 01:08 PM, Florian Fainelli wrote:
> On 10/17/2018 12:53 PM, Christian Lamparter wrote:
>> As per' APM82181 Embedded Processor User Manual 26.1 EMAC Features:
>> VLAN:
>> - Support for VLAN tag ID in compliance with IEEE 802.3ac.
>> - VLAN tag insertion or replacement for transmit packets
>>
>> This patch completes the missing code for the VLAN tx tagging
>> support, as the the EMAC_MR1_VLE was already enabled.
>>
>> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
>> ---
>> drivers/net/ethernet/ibm/emac/core.c | 32 ++++++++++++++++++++++++----
>> drivers/net/ethernet/ibm/emac/core.h | 6 +++++-
>> 2 files changed, 33 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
>> index 760b2ad8e295..be560f9031f4 100644
>> --- a/drivers/net/ethernet/ibm/emac/core.c
>> +++ b/drivers/net/ethernet/ibm/emac/core.c
>> @@ -37,6 +37,7 @@
>> #include <linux/ethtool.h>
>> #include <linux/mii.h>
>> #include <linux/bitops.h>
>> +#include <linux/if_vlan.h>
>> #include <linux/workqueue.h>
>> #include <linux/of.h>
>> #include <linux/of_address.h>
>> @@ -674,7 +675,7 @@ static int emac_configure(struct emac_instance *dev)
>> ndev->dev_addr[5]);
>>
>> /* VLAN Tag Protocol ID */
>> - out_be32(&p->vtpid, 0x8100);
>> + out_be32(&p->vtpid, ETH_P_8021Q);
>>
>> /* Receive mode register */
>> r = emac_iff2rmr(ndev);
>> @@ -1435,6 +1436,22 @@ static inline netdev_tx_t emac_xmit_finish(struct emac_instance *dev, int len)
>> return NETDEV_TX_OK;
>> }
>>
>> +static inline u16 emac_tx_vlan(struct emac_instance *dev, struct sk_buff *skb)
>> +{
>> + /* Handle VLAN TPID and TCI insert if this is a VLAN skb */
>> + if (emac_has_feature(dev, EMAC_FTR_HAS_VLAN_CTAG_TX) &&
>> + skb_vlan_tag_present(skb)) {
>> + struct emac_regs __iomem *p = dev->emacp;
>> +
>> + /* update the VLAN TCI */
>> + out_be32(&p->vtci, (u32)skb_vlan_tag_get(skb));
>
> The only case where this is likely not going to be 0x8100/ETH_P_8021Q is
> if you do 802.1ad (QinQ) and you decided to somehow offload the S-Tag
> instead of the C-Tag.
Sorry, looks like I mixed up TCI and TPID here, this looks obviously
correct ;)
--
Florian
next prev parent reply other threads:[~2018-10-18 4:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-17 19:53 [PATCH 1/2] net: emac: implement 802.1Q VLAN TX tagging support Christian Lamparter
2018-10-17 19:53 ` [PATCH 2/2] net: emac: implement TCP TSO Christian Lamparter
2018-10-17 20:09 ` Florian Fainelli
2018-10-19 15:39 ` Christian Lamparter
2018-10-17 20:08 ` [PATCH 1/2] net: emac: implement 802.1Q VLAN TX tagging support Florian Fainelli
2018-10-17 20:09 ` Florian Fainelli [this message]
2018-10-19 15:56 ` Christian Lamparter
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=0b0b153c-b5fa-cd7d-62ff-3dd67eb8fe97@gmail.com \
--to=f.fainelli@gmail.com \
--cc=chunkeey@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).