From: John Fastabend <john.fastabend@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: netdev@vger.kernel.org, john.fastabend@intel.com,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [RFC PATCH 1/2] net: Add layer 2 hardware acceleration operations for macvlan devices
Date: Wed, 02 Oct 2013 00:08:11 -0700 [thread overview]
Message-ID: <524BC65B.4080803@gmail.com> (raw)
In-Reply-To: <1380140209-24587-2-git-send-email-nhorman@tuxdriver.com>
On 09/25/2013 01:16 PM, Neil Horman wrote:
> Add a operations structure that allows a network interface to export the fact
> that it supports package forwarding in hardware between physical interfaces and
> other mac layer devices assigned to it (such as macvlans). this operaions
> structure can be used by virtual mac devices to bypass software switching so
> that forwarding can be done in hardware more efficiently.
Some additional nits below which maybe you have already thought of.
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> CC: john.fastabend@intel.com
> CC: "David S. Miller" <davem@davemloft.net>
> ---
> drivers/net/macvlan.c | 37 +++++++++++++++++++++++++++++++++++++
> include/linux/if_macvlan.h | 1 +
> include/linux/netdevice.h | 10 ++++++++++
> net/core/dev.c | 3 +++
> 4 files changed, 51 insertions(+)
>
> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> index 9bf46bd..0c37b30 100644
> --- a/drivers/net/macvlan.c
> +++ b/drivers/net/macvlan.c
> @@ -296,8 +296,16 @@ netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
> unsigned int len = skb->len;
> int ret;
> const struct macvlan_dev *vlan = netdev_priv(dev);
> + const struct l2_forwarding_accel_ops *l2a_ops = vlan->lowerdev->l2a_ops;
> +
> + if (l2a_ops->l2_accel_xmit) {
> + ret = l2a_ops->l2_accel_xmit(skb, vlan->l2a_priv);
> + if (likely(ret == NETDEV_TX_OK))
maybe dev_xmit_complete() would be more appropriate?
> + goto update_stats;
> + }
>
> ret = macvlan_queue_xmit(skb, dev);
> +update_stats:
> if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
> struct macvlan_pcpu_stats *pcpu_stats;
>
> @@ -336,6 +344,7 @@ static int macvlan_open(struct net_device *dev)
> {
> struct macvlan_dev *vlan = netdev_priv(dev);
> struct net_device *lowerdev = vlan->lowerdev;
> + const struct l2_forwarding_accel_ops *l2a_ops = lowerdev->l2a_ops;
> int err;
>
> if (vlan->port->passthru) {
> @@ -347,6 +356,19 @@ static int macvlan_open(struct net_device *dev)
> goto hash_add;
Looks like this might break in the passthru case? If you don't call
l2_accel_add_dev here but still use the l2_accel_xmit.
> }
>
> + if (l2a_ops->l2_accel_add_dev) {
In the error cases it might be preferred to fallback to the
non-offloaded software path. For example hardware may have a limit
to the number of VSIs that can be created but we wouldn't want to
push that up the stack.
> + /* The lowerdev supports l2 switching
> + * try to add this macvlan to it
> + */
> + vlan->l2a_priv = kzalloc(l2a_ops->priv_size, GFP_KERNEL);
> + if (!vlan->l2a_priv)
> + return -ENOMEM;
> + err = l2a_ops->l2_accel_add_dev(vlan->lowerdev,
> + dev, vlan->l2a_priv);
> + if (err < 0)
> + return err;
> + }
> +
> err = -EBUSY;
> if (macvlan_addr_busy(vlan->port, dev->dev_addr))
> goto out;
> @@ -367,6 +389,13 @@ hash_add:
> del_unicast:
> dev_uc_del(lowerdev, dev->dev_addr);
> out:
> + if (vlan->l2a_priv) {
Add a feature flag here so it can be disabled.
> + if (l2a_ops->l2_accel_del_dev)
> + l2a_ops->l2_accel_del_dev(vlan->lowerdev,
> + vlan->l2a_priv);
> + kfree(vlan->l2a_priv);
> + vlan->l2a_priv = NULL;
> + }
> return err;
> }
[...]
Thanks,
John
--
John Fastabend Intel Corporation
next prev parent reply other threads:[~2013-10-02 7:08 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-11 18:45 [RFC PATCH 0/4] Series short description John Fastabend
2013-09-11 18:46 ` [RFC PATCH 1/4] net: rtnetlink: make priv_size a function for devs with dynamic size John Fastabend
2013-09-11 18:46 ` [RFC PATCH 2/4] net: Add lower dev list helpers John Fastabend
2013-09-14 12:27 ` Veaceslav Falico
2013-09-14 20:43 ` John Fastabend
2013-09-14 21:14 ` Veaceslav Falico
2013-09-11 18:47 ` [RFC PATCH 3/4] net: VSI: Add virtual station interface support John Fastabend
2013-09-20 23:12 ` Neil Horman
2013-09-21 17:30 ` John Fastabend
2013-09-22 16:44 ` Neil Horman
2013-09-11 18:47 ` [RFC PATCH 4/4] ixgbe: Adding VSI support to ixgbe John Fastabend
2013-09-25 20:16 ` [RFC PATCH 0/2] net: alternate proposal for using macvlans with forwarding acceleration Neil Horman
2013-09-25 20:16 ` [RFC PATCH 1/2] net: Add layer 2 hardware acceleration operations for macvlan devices Neil Horman
2013-10-02 7:08 ` John Fastabend [this message]
2013-10-02 12:53 ` Neil Horman
2013-09-25 20:16 ` [RFC PATCH 2/2] ixgbe: enable l2 forwarding acceleration for macvlans Neil Horman
2013-10-02 6:31 ` [RFC PATCH 0/2] net: alternate proposal for using macvlans with forwarding acceleration John Fastabend
2013-10-02 13:28 ` Neil Horman
2013-10-04 20:10 ` [RFC PATCH 0/2 v2] " Neil Horman
2013-10-04 20:10 ` [PATCH 1/2] net: Add layer 2 hardware acceleration operations for macvlan devices Neil Horman
2013-10-07 19:52 ` David Miller
2013-10-07 21:20 ` Neil Horman
2013-10-07 21:34 ` David Miller
2013-10-07 22:39 ` John Fastabend
2013-10-08 0:52 ` Neil Horman
2013-10-04 20:10 ` [PATCH 2/2] ixgbe: enable l2 forwarding acceleration for macvlans Neil Horman
2013-10-07 22:09 ` [RFC PATCH 0/2 v2] net: alternate proposal for using macvlans with forwarding acceleration John Fastabend
2013-10-08 1:08 ` Neil Horman
2013-10-11 18:43 ` [RFC PATCH 0/2 v3] " Neil Horman
2013-10-11 18:43 ` [PATCH 1/2] net: Add layer 2 hardware acceleration operations for macvlan devices Neil Horman
2013-10-13 20:46 ` John Fastabend
2013-10-14 10:48 ` Neil Horman
2013-10-11 18:43 ` [PATCH 2/2] ixgbe: enable l2 forwarding acceleration for macvlans Neil Horman
2013-10-13 20:48 ` John Fastabend
2013-10-14 10:50 ` Neil Horman
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=524BC65B.4080803@gmail.com \
--to=john.fastabend@gmail.com \
--cc=davem@davemloft.net \
--cc=john.fastabend@intel.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.