From patchwork Mon Jun 15 03:58:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yeow Yeoh X-Patchwork-Id: 6605971 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 04F7B9F326 for ; Mon, 15 Jun 2015 03:59:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A3F3204AE for ; Mon, 15 Jun 2015 03:59:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A2D3204A2 for ; Mon, 15 Jun 2015 03:59:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753103AbbFOD7l (ORCPT ); Sun, 14 Jun 2015 23:59:41 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:36600 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751993AbbFOD7j (ORCPT ); Sun, 14 Jun 2015 23:59:39 -0400 Received: by pabqy3 with SMTP id qy3so56924890pab.3 for ; Sun, 14 Jun 2015 20:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=MLdmTzNO0SGAFRBCytV9lzBix8ggcXH/oAGhqgOa1VU=; b=hsfx9VTwI7RFTHQKCcnIrVhATW+I/hZlqAivW5GssussjWrVT4ftL3bnFnhoklkl0A gL3EmbWfDAE2yC7ipFHMlfqZUU6Og7w4xDWqHsofhkplMRP2VjfCFkK/ZC8vku/wIuTy bpckuiHzcjsJ+c96rsi2hYZLqt32cErC6UlCmINq/u9RRTIICI/yXK6Cl2JxLSBc01mb J5YCxI3uqs/hulL3ighpyYe/a3lyRwxy+SM5T/6I33LCqPa+/5cCyULAJEht64BSGH9g lM94YAgAs1X5tbQ7ifctUXe7+u0aXstkcYoeZEKQaMr1GRXsgARmYTMphiK0ocqVJf01 nCcw== X-Received: by 10.66.100.138 with SMTP id ey10mr44197737pab.110.1434340778558; Sun, 14 Jun 2015 20:59:38 -0700 (PDT) Received: from localhost.localdomain ([58.26.233.145]) by mx.google.com with ESMTPSA id pj4sm5089412pbb.29.2015.06.14.20.59.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Jun 2015 20:59:37 -0700 (PDT) From: Chun-Yeow Yeoh To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Chun-Yeow Yeoh Subject: [PATCH] mac80211: process the target only subfield for mesh hwmp accordingly Date: Mon, 15 Jun 2015 11:58:53 +0800 Message-Id: <1434340733-10972-1-git-send-email-yeohchunyeow@gmail.com> X-Mailer: git-send-email 2.3.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch does the following: - Remove unnecessary flags field used by PERR element. - Use the per target flags defined in ./include/linux/ieee80211.h. - Process the target only subfield based on case E2 of sec 13.10.9.3 of IEEE 802.11-2012. Signed-off-by: Chun-Yeow Yeoh --- net/mac80211/mesh_hwmp.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 085edc1..5573e21 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -19,15 +19,6 @@ #define MAX_PREQ_QUEUE_LEN 64 -/* Destination only */ -#define MP_F_DO 0x1 -/* Reply and forward */ -#define MP_F_RF 0x2 -/* Unknown Sequence Number */ -#define MP_F_USN 0x01 -/* Reason code Present */ -#define MP_F_RCODE 0x02 - static void mesh_queue_preq(struct mesh_path *, u8); static inline u32 u32_field_get(const u8 *preq_elem, int offset, bool ae) @@ -279,15 +270,10 @@ int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata, *pos++ = ttl; /* number of destinations */ *pos++ = 1; - /* - * flags bit, bit 1 is unset if we know the sequence number and - * bit 2 is set if we have a reason code + /* Flags field has AE bit only as defined in + * sec 8.4.2.117 IEEE802.11-2012 */ *pos = 0; - if (!target_sn) - *pos |= MP_F_USN; - if (target_rcode) - *pos |= MP_F_RCODE; pos++; memcpy(pos, target, ETH_ALEN); pos += ETH_ALEN; @@ -570,15 +556,13 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, SN_LT(mpath->sn, target_sn)) { mpath->sn = target_sn; mpath->flags |= MESH_PATH_SN_VALID; - } else if ((!(target_flags & MP_F_DO)) && + } else if ((!(target_flags & IEEE80211_PREQ_TO_FLAG)) && (mpath->flags & MESH_PATH_ACTIVE)) { reply = true; target_metric = mpath->metric; target_sn = mpath->sn; - if (target_flags & MP_F_RF) - target_flags |= MP_F_DO; - else - forward = false; + /* Case E2 of sec 13.10.9.3 IEEE 802.11-2012*/ + target_flags |= IEEE80211_PREQ_TO_FLAG; } } rcu_read_unlock(); @@ -974,7 +958,7 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; struct mesh_preq_queue *preq_node; struct mesh_path *mpath; - u8 ttl, target_flags; + u8 ttl, target_flags = 0; const u8 *da; u32 lifetime; @@ -1033,9 +1017,9 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) } if (preq_node->flags & PREQ_Q_F_REFRESH) - target_flags = MP_F_DO; + target_flags |= IEEE80211_PREQ_TO_FLAG; else - target_flags = MP_F_RF; + target_flags &= ~IEEE80211_PREQ_TO_FLAG; spin_unlock_bh(&mpath->state_lock); da = (mpath->is_root) ? mpath->rann_snd_addr : broadcast_addr;