Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/534735/?format=api
{ "id": 534735, "url": "http://patchwork.ozlabs.org/api/patches/534735/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1445572173-15402-4-git-send-email-makita.toshiaki@lab.ntt.co.jp/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1445572173-15402-4-git-send-email-makita.toshiaki@lab.ntt.co.jp>", "list_archive_url": null, "date": "2015-10-23T03:49:32", "name": "[net-next,3/4] vlan: Notify real device of encap header length", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "94421935eda999882fca6b070490f2b56175ce8f", "submitter": { "id": 22461, "url": "http://patchwork.ozlabs.org/api/people/22461/?format=api", "name": "Toshiaki Makita", "email": "makita.toshiaki@lab.ntt.co.jp" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1445572173-15402-4-git-send-email-makita.toshiaki@lab.ntt.co.jp/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/534735/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/534735/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ozlabs.org (Postfix) with ESMTP id 326DD141321\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 23 Oct 2015 15:28:56 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 7EAFB8BE1A;\n\tFri, 23 Oct 2015 04:28:55 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id MCl8M8zQe39I; Fri, 23 Oct 2015 04:28:55 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id AD7688BE34;\n\tFri, 23 Oct 2015 04:28:54 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 03BCD1C105D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 23 Oct 2015 04:28:54 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 004E98BDDE\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 23 Oct 2015 04:28:54 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id fdfTyBNmuqlu for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 23 Oct 2015 04:28:53 +0000 (UTC)", "from tama500.ecl.ntt.co.jp (tama500.ecl.ntt.co.jp [129.60.39.148])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 4669C8BE1A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 23 Oct 2015 04:28:53 +0000 (UTC)", "from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154])\n\tby tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id t9N3nip2012461;\n\tFri, 23 Oct 2015 12:49:44 +0900", "from vc2.ecl.ntt.co.jp (localhost [127.0.0.1])\n\tby vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 6D2C65F631;\n\tFri, 23 Oct 2015 12:49:44 +0900 (JST)", "from imail3.m.ecl.ntt.co.jp (imail3.m.ecl.ntt.co.jp [129.60.5.248])\n\tby vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 5F25C5F611;\n\tFri, 23 Oct 2015 12:49:44 +0900 (JST)", "from ubuntu-vm-makita ([129.60.241.200])\n\tby imail3.m.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id\n\tt9N3nhnA026708; Fri, 23 Oct 2015 12:49:44 +0900", "by ubuntu-vm-makita (Postfix, from userid 1000)\n\tid BBAFB1E6EFB; Fri, 23 Oct 2015 12:49:37 +0900 (JST)" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "from auto-whitelisted by SQLgrey-1.7.6", "From": "Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>", "To": "\"David S . Miller\" <davem@davemloft.net>", "Date": "Fri, 23 Oct 2015 12:49:32 +0900", "Message-Id": "<1445572173-15402-4-git-send-email-makita.toshiaki@lab.ntt.co.jp>", "X-Mailer": "git-send-email 1.8.1.2", "In-Reply-To": "<1445572173-15402-1-git-send-email-makita.toshiaki@lab.ntt.co.jp>", "References": "<1445572173-15402-1-git-send-email-makita.toshiaki@lab.ntt.co.jp>", "X-TM-AS-MML": "disable", "Cc": "netdev@vger.kernel.org, Vlad Yasevich <vyasevich@gmail.com>,\n\tStephen Hemminger <stephen@networkplumber.org>,\n\tintel-wired-lan@lists.osuosl.org,\n\tToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>,\n\tPatrick McHardy <kaber@trash.net>", "Subject": "[Intel-wired-lan] [PATCH net-next 3/4] vlan: Notify real device of\n\tencap header length", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "Reserve extra 4 bytes on real_dev in addition to the length notified\nfrom upper device.\nIn 802.1ad mode, set enc_hdr_len to 4 bytes by default, since it is\nlikely to send already tagged frame.\n\nSigned-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>\n---\n net/8021q/vlan.c | 16 ++++++++++++++--\n net/8021q/vlan_dev.c | 47 ++++++++++++++++++++++++++++++++++++++++++-----\n 2 files changed, 56 insertions(+), 7 deletions(-)", "diff": "diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c\nindex d2cd9de..bbafc5c 100644\n--- a/net/8021q/vlan.c\n+++ b/net/8021q/vlan.c\n@@ -355,6 +355,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,\n \tstruct net_device *vlandev;\n \tstruct vlan_dev_priv *vlan;\n \tbool last = false;\n+\tint dev_max_frame;\n \tLIST_HEAD(list);\n \n \tif (is_vlan_dev(dev)) {\n@@ -399,11 +400,22 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,\n \t\tbreak;\n \n \tcase NETDEV_CHANGEMTU:\n+\t\tdev_max_frame = dev->mtu + dev->enc_hdr_len;\n \t\tvlan_group_for_each_dev(grp, i, vlandev) {\n-\t\t\tif (vlandev->mtu <= dev->mtu)\n+\t\t\tint enc_hdr_len = vlandev->enc_hdr_len + VLAN_HLEN;\n+\n+\t\t\tif (vlandev->mtu <= dev->mtu &&\n+\t\t\t vlandev->mtu + enc_hdr_len <= dev_max_frame)\n \t\t\t\tcontinue;\n \n-\t\t\tdev_set_mtu(vlandev, dev->mtu);\n+\t\t\tif (vlandev->mtu > dev->mtu) {\n+\t\t\t\tdev_set_mtu(vlandev, dev->mtu);\n+\t\t\t} else {\n+\t\t\t\tint mtu_room = dev->mtu - vlandev->mtu;\n+\n+\t\t\t\tdev_set_enc_hdr_len(dev,\n+\t\t\t\t\t\t enc_hdr_len - mtu_room);\n+\t\t\t}\n \t\t}\n \t\tbreak;\n \ndiff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c\nindex fded865..f803ce4 100644\n--- a/net/8021q/vlan_dev.c\n+++ b/net/8021q/vlan_dev.c\n@@ -143,17 +143,35 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,\n \treturn ret;\n }\n \n+static int vlan_dev_enc_hdr_len(struct net_device *dev, int new_len)\n+{\n+\tstruct net_device *real_dev = vlan_dev_priv(dev)->real_dev;\n+\tint mtu_room = real_dev->mtu - dev->mtu;\n+\n+\tnew_len += VLAN_HLEN;\n+\tif (new_len > mtu_room)\n+\t\treturn dev_set_enc_hdr_len(real_dev, new_len - mtu_room);\n+\n+\treturn 0;\n+}\n+\n static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu)\n {\n-\t/* TODO: gotta make sure the underlying layer can handle it,\n-\t * maybe an IFF_VLAN_CAPABLE flag for devices?\n-\t */\n-\tif (vlan_dev_priv(dev)->real_dev->mtu < new_mtu)\n+\tstruct net_device *real_dev = vlan_dev_priv(dev)->real_dev;\n+\tint orig_mtu;\n+\tint err;\n+\n+\tif (real_dev->mtu < new_mtu)\n \t\treturn -ERANGE;\n \n+\torig_mtu = dev->mtu;\n \tdev->mtu = new_mtu;\n \n-\treturn 0;\n+\terr = vlan_dev_enc_hdr_len(dev, dev->enc_hdr_len);\n+\tif (err)\n+\t\tdev->mtu = orig_mtu;\n+\n+\treturn err;\n }\n \n void vlan_dev_set_ingress_priority(const struct net_device *dev,\n@@ -532,6 +550,8 @@ static const struct net_device_ops vlan_netdev_ops;\n static int vlan_dev_init(struct net_device *dev)\n {\n \tstruct net_device *real_dev = vlan_dev_priv(dev)->real_dev;\n+\tint enc_hdr_len;\n+\tint err;\n \n \tnetif_carrier_off(dev);\n \n@@ -583,6 +603,22 @@ static int vlan_dev_init(struct net_device *dev)\n \n \tvlan_dev_set_lockdep_class(dev, vlan_dev_get_lock_subclass(dev));\n \n+\tif (vlan_dev_priv(dev)->vlan_proto == htons(ETH_P_8021AD))\n+\t\tdev->enc_hdr_len = VLAN_HLEN;\n+\n+\tenc_hdr_len = dev->enc_hdr_len + VLAN_HLEN;\n+\terr = dev_set_enc_hdr_len(real_dev, enc_hdr_len);\n+\tif (err) {\n+\t\tint new_mtu = real_dev->mtu + real_dev->enc_hdr_len - enc_hdr_len;\n+\n+\t\tif (new_mtu < 0)\n+\t\t\treturn -ENOSPC;\n+\n+\t\tnetdev_warn(dev, \"Failed to expand encap header room to %d on real device. Decrease MTU to %d on vlan device.\\n\",\n+\t\t\t enc_hdr_len, new_mtu);\n+\t\tdev->mtu = new_mtu;\n+\t}\n+\n \tvlan_dev_priv(dev)->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);\n \tif (!vlan_dev_priv(dev)->vlan_pcpu_stats)\n \t\treturn -ENOMEM;\n@@ -776,6 +812,7 @@ static const struct net_device_ops vlan_netdev_ops = {\n \t.ndo_fix_features\t= vlan_dev_fix_features,\n \t.ndo_get_lock_subclass = vlan_dev_get_lock_subclass,\n \t.ndo_get_iflink\t\t= vlan_dev_get_iflink,\n+\t.ndo_enc_hdr_len\t= vlan_dev_enc_hdr_len,\n };\n \n static void vlan_dev_free(struct net_device *dev)\n", "prefixes": [ "net-next", "3/4" ] }