{"id":969,"url":"http://patchwork.ozlabs.org/api/1.0/patches/969/?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":"<200809222150.m8MLocjD031863@imap1.linux-foundation.org>","date":"2008-09-22T21:50:37","name":"[3/8] net: em_cmp.c use unaligned access helpers","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"8ad6daf87557bf3f36114de5e7b4b68ad2e33588","submitter":{"id":107,"url":"http://patchwork.ozlabs.org/api/1.0/people/107/?format=json","name":"Andrew Morton","email":"akpm@linux-foundation.org"},"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/200809222150.m8MLocjD031863@imap1.linux-foundation.org/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/969/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 3F360DDE9F\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 23 Sep 2008 07:57:50 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753932AbYIVV5l (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 17:57:41 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1753929AbYIVV5k\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 17:57:40 -0400","from smtp1.linux-foundation.org ([140.211.169.13]:60098 \"EHLO\n\tsmtp1.linux-foundation.org\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1753884AbYIVV5j (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 22 Sep 2008 17:57:39 -0400","from imap1.linux-foundation.org (imap1.linux-foundation.org\n\t[140.211.169.55])\n\tby smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with\n\tESMTP id m8MLrDO1018507\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\n\tMon, 22 Sep 2008 14:57:32 -0700","from localhost.localdomain (localhost [127.0.0.1])\n\tby imap1.linux-foundation.org\n\t(8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id\n\tm8MLocjD031863; Mon, 22 Sep 2008 14:50:38 -0700"],"Message-Id":"<200809222150.m8MLocjD031863@imap1.linux-foundation.org>","Subject":"[patch 3/8] net: em_cmp.c use unaligned access helpers","To":"davem@davemloft.net","Cc":"netdev@vger.kernel.org, akpm@linux-foundation.org,\n\tharvey.harrison@gmail.com, tgraf@suug.ch","From":"akpm@linux-foundation.org","Date":"Mon, 22 Sep 2008 14:50:37 -0700","X-Spam-Status":"No, hits=-3.359 required=5 tests=AWL, BAYES_00,\n\tOSDL_HEADER_SUBJECT_BRACKETED","X-Spam-Checker-Version":"SpamAssassin 3.2.4-osdl_revision__1.47__","X-MIMEDefang-Filter":"lf$Revision: 1.188 $","X-Scanned-By":"MIMEDefang 2.63 on 140.211.169.13","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"From: Harvey Harrison <harvey.harrison@gmail.com>\n\nSigned-off-by: Harvey Harrison <harvey.harrison@gmail.com>\nCc: Thomas Graf <tgraf@suug.ch>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\n---\n\n net/sched/em_cmp.c |    9 +++------\n 1 file changed, 3 insertions(+), 6 deletions(-)","diff":"diff -puN net/sched/em_cmp.c~net-em_cmpc-use-unaligned-access-helpers net/sched/em_cmp.c\n--- a/net/sched/em_cmp.c~net-em_cmpc-use-unaligned-access-helpers\n+++ a/net/sched/em_cmp.c\n@@ -14,6 +14,7 @@\n #include <linux/kernel.h>\n #include <linux/skbuff.h>\n #include <linux/tc_ematch/tc_em_cmp.h>\n+#include <asm/unaligned.h>\n #include <net/pkt_cls.h>\n \n static inline int cmp_needs_transformation(struct tcf_em_cmp *cmp)\n@@ -37,8 +38,7 @@ static int em_cmp_match(struct sk_buff *\n \t\t\tbreak;\n \n \t\tcase TCF_EM_ALIGN_U16:\n-\t\t\tval = *ptr << 8;\n-\t\t\tval |= *(ptr+1);\n+\t\t\tval = get_unaligned_be16(ptr);\n \n \t\t\tif (cmp_needs_transformation(cmp))\n \t\t\t\tval = be16_to_cpu(val);\n@@ -47,10 +47,7 @@ static int em_cmp_match(struct sk_buff *\n \t\tcase TCF_EM_ALIGN_U32:\n \t\t\t/* Worth checking boundries? The branching seems\n \t\t\t * to get worse. Visit again. */\n-\t\t\tval = *ptr << 24;\n-\t\t\tval |= *(ptr+1) << 16;\n-\t\t\tval |= *(ptr+2) << 8;\n-\t\t\tval |= *(ptr+3);\n+\t\t\tval = get_unaligned_be32(ptr);\n \n \t\t\tif (cmp_needs_transformation(cmp))\n \t\t\t\tval = be32_to_cpu(val);\n","prefixes":["3/8"]}