From patchwork Fri May 3 02:33:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Pedersen X-Patchwork-Id: 2514811 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A0DB7DF215 for ; Fri, 3 May 2013 02:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760827Ab3ECCgO (ORCPT ); Thu, 2 May 2013 22:36:14 -0400 Received: from mail-pb0-f49.google.com ([209.85.160.49]:63642 "EHLO mail-pb0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756827Ab3ECCgN (ORCPT ); Thu, 2 May 2013 22:36:13 -0400 Received: by mail-pb0-f49.google.com with SMTP id rp8so662459pbb.36 for ; Thu, 02 May 2013 19:36:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=oPy6yotwe0mcu+IbPwW3Mrx34En1tB/w8Z0HgpQcAXs=; b=O0jZt8zoDw5bypPlnVTCc9sLjbW8mUese9c3R6H2sD2gC4r6GOj8uNWGdZC1LmollT 4CwP7KjkJDKMO/K/mQMv4SvbI28CgPIDfFYB/4odi/0oTxlTCkVCMFS3G3ItaaAFVZQu aJv9hD2Ykg8utiUPAocMpw8qmkfIw4IZcUHiEFaI87gHy/KyWKJ+pZ5/7/8Yy118lJzx auRPPpahzeFfa0HNzB88p9BGD1fHAxvhePVXJT1TDKmMjJJBnlaoDes6aqzkw1PjevJv SbLYnoXvYphzalrVyUYBWgRn/PInyok1bR1yDOObN+VJ/ZFg0HkUPvz8NVjWjBeUvnen THbg== X-Received: by 10.66.245.110 with SMTP id xn14mr12617541pac.130.1367548573147; Thu, 02 May 2013 19:36:13 -0700 (PDT) Received: from cable.lan (70-35-43-50.static.wiline.com. [70.35.43.50]) by mx.google.com with ESMTPSA id az5sm7391484pbc.18.2013.05.02.19.36.11 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 19:36:12 -0700 (PDT) From: Thomas Pedersen To: Johannes Berg Cc: linux-wirelss , me@bobcopeland.com, open80211s Subject: [RFC 02/12] mac80211: mesh: add function to tx on all other mbss ifaces Date: Thu, 2 May 2013 19:33:52 -0700 Message-Id: <1367548442-8229-3-git-send-email-thomas@cozybit.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367548442-8229-1-git-send-email-thomas@cozybit.com> References: <1367548442-8229-1-git-send-email-thomas@cozybit.com> X-Gm-Message-State: ALoCoQnAUKMoK5fJUk0vrik+3L0KVtgGsCuS9YYg+qO7kfNiSLpHPUmT8Dt53aDe8oO2glzCT9uO Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Bob Copeland Add a function to rebroadcast mcast/bcast frames on other interfaces when multiple interfaces are shared in an mbss. Signed-off-by: Bob Copeland --- net/mac80211/mesh.c | 43 +++++++++++++++++++++++++++++++++++++++++++ net/mac80211/mesh.h | 4 ++++ 2 files changed, 47 insertions(+) diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 5ea4812..eac9988 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -11,6 +11,7 @@ #include #include #include "ieee80211_i.h" +#include "wme.h" #include "mesh.h" static int mesh_allocated; @@ -202,6 +203,48 @@ bool mesh_bss_matches_addr(struct mesh_local_bss *mbss, const u8 *addr) } /** + * mesh_bss_forward_tx - send a frame on all other interfaces in a bss + * + * @sdata: interface to exclude from tx + * @skb: frame to send + * + * Forwards group-directed frames from sdata for tx on all other interfaces + * which are participating in an mbss. + */ +void mesh_bss_forward_tx(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb) +{ + struct mesh_local_bss *mbss = mbss(sdata); + struct ieee80211_hdr *fwd_hdr; + struct sk_buff *fwd_skb; + struct ieee80211_tx_info *info; + struct ieee80211_sub_if_data *tmp_sdata; + + rcu_read_lock(); + list_for_each_entry_rcu(tmp_sdata, &mbss->if_list, u.mesh.if_list) { + + if (sdata == tmp_sdata) + continue; + + fwd_skb = skb_copy(skb, GFP_ATOMIC); + if (!fwd_skb) + goto out; + + fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; + info = IEEE80211_SKB_CB(fwd_skb); + memset(info, 0, sizeof(*info)); + info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; + info->control.vif = &tmp_sdata->vif; + + memcpy(fwd_hdr->addr2, tmp_sdata->vif.addr, ETH_ALEN); + ieee80211_set_qos_hdr(tmp_sdata, fwd_skb); + ieee80211_add_pending_skb(tmp_sdata->local, fwd_skb); + } +out: + rcu_read_unlock(); +} + +/** * mesh_matches_local - check if the config of a mesh point matches ours * * @sdata: local mesh subif diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index f23b58f..4a1a15e 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h @@ -361,6 +361,8 @@ void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local); void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata); void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata); void ieee80211s_stop(void); +void mesh_bss_forward_tx(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb); struct ieee80211_sub_if_data * mesh_bss_find_if(struct mesh_local_bss *mbss, const u8 *addr); bool mesh_bss_matches_addr(struct mesh_local_bss *mbss, const u8 *addr); @@ -373,6 +375,8 @@ static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata) static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata) {} static inline void ieee80211s_stop(void) {} +static inline void mesh_bss_forward_tx(struct ieee80211_sub_if_data *sdata, + struct sk_buff *skb) {} #endif #endif /* IEEE80211S_H */