{"id":883,"url":"http://patchwork.ozlabs.org/api/1.0/patches/883/?format=json","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.0/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<1222098445-26175-8-git-send-email-remi.denis-courmont@nokia.com>","date":"2008-09-22T15:47:22","name":"[08/11] Phonet: provide MAC header operations","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"6cc341401b06fe19349ca68c1c49f64cd8bf76bf","submitter":{"id":204,"url":"http://patchwork.ozlabs.org/api/1.0/people/204/?format=json","name":"Rémi Denis-Courmont","email":"remi.denis-courmont@nokia.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.0/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1222098445-26175-8-git-send-email-remi.denis-courmont@nokia.com/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/883/checks/","tags":{},"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Received":["from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id 8E2F4DDF2F\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 23 Sep 2008 01:47:50 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753561AbYIVPrs (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 11:47:48 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1753562AbYIVPrr\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 11:47:47 -0400","from smtp.nokia.com ([192.100.105.134]:34627 \"EHLO\n\tmgw-mx09.nokia.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1753497AbYIVPrp (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 22 Sep 2008 11:47:45 -0400","from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com\n\t[10.160.244.31])\n\tby mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id\n\tm8MFlIhb008928\n\tfor <netdev@vger.kernel.org>; Mon, 22 Sep 2008 10:47:43 -0500","from vaebh102.NOE.Nokia.com ([10.160.244.23]) by\n\tvaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); \n\tMon, 22 Sep 2008 18:47:35 +0300","from localhost.localdomain ([172.21.41.115]) by\n\tvaebh102.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); \n\tMon, 22 Sep 2008 18:47:26 +0300"],"From":"=?utf-8?q?R=C3=A9mi=20Denis-Courmont?= <remi.denis-courmont@nokia.com>","To":"netdev@vger.kernel.org","Subject":"[PATCH 08/11] Phonet: provide MAC header operations","Date":"Mon, 22 Sep 2008 18:47:22 +0300","Message-Id":"<1222098445-26175-8-git-send-email-remi.denis-courmont@nokia.com>","X-Mailer":"git-send-email 1.5.4.3","In-Reply-To":"<200809221845.54736.remi.denis-courmont@nokia.com>","References":"<200809221845.54736.remi.denis-courmont@nokia.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"8bit","X-OriginalArrivalTime":"22 Sep 2008 15:47:26.0725 (UTC)\n\tFILETIME=[83385B50:01C91CCA]","X-Nokia-AV":"Clean","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>\n---\n include/linux/if_phonet.h |    4 ++++\n net/phonet/af_phonet.c    |   29 +++++++++++++++++++++++++++++\n 2 files changed, 33 insertions(+), 0 deletions(-)","diff":"diff --git a/include/linux/if_phonet.h b/include/linux/if_phonet.h\nindex 22df25f..7e98921 100644\n--- a/include/linux/if_phonet.h\n+++ b/include/linux/if_phonet.h\n@@ -12,3 +12,7 @@\n /* 6 bytes header + 65535 bytes payload */\n #define PHONET_MAX_MTU\t\t65541\n #define PHONET_DEV_MTU\t\tPHONET_MAX_MTU\n+\n+#ifdef __KERNEL__\n+extern struct header_ops phonet_header_ops;\n+#endif\ndiff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c\nindex e6771d3..51397ff 100644\n--- a/net/phonet/af_phonet.c\n+++ b/net/phonet/af_phonet.c\n@@ -99,6 +99,35 @@ static struct net_proto_family phonet_proto_family = {\n \t.owner = THIS_MODULE,\n };\n \n+/* Phonet device header operations */\n+static int pn_header_create(struct sk_buff *skb, struct net_device *dev,\n+\t\t\t\tunsigned short type, const void *daddr,\n+\t\t\t\tconst void *saddr, unsigned len)\n+{\n+\tu8 *media = skb_push(skb, 1);\n+\n+\tif (type != ETH_P_PHONET)\n+\t\treturn -1;\n+\n+\tif (!saddr)\n+\t\tsaddr = dev->dev_addr;\n+\t*media = *(const u8 *)saddr;\n+\treturn 1;\n+}\n+\n+static int pn_header_parse(const struct sk_buff *skb, unsigned char *haddr)\n+{\n+\tconst u8 *media = skb_mac_header(skb);\n+\t*haddr = *media;\n+\treturn 1;\n+}\n+\n+struct header_ops phonet_header_ops = {\n+\t.create = pn_header_create,\n+\t.parse = pn_header_parse,\n+};\n+EXPORT_SYMBOL(phonet_header_ops);\n+\n /*\n  * Prepends an ISI header and sends a datagram.\n  */\n","prefixes":["08/11"]}