aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
authorThomas Pedersen <thomas@cozybit.com>2011-11-24 20:15:26 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-11-28 14:44:08 -0500
commit30789eb6cbfcead5d90d27dc4e7d7389cacc528c (patch)
treeed85ea5bdcfcdbaf1f84f54d38995c24cc9b962c /net/mac80211/rx.c
parent0cfda8519c85eb279166fb55a8553ee66eac9b35 (diff)
mac80211: clean up rx_h_mesh_fwding
Lose about two levels of unnecessary indentation. Signed-off-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c88
1 files changed, 39 insertions, 49 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index f842f901d179..1e231e95f466 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1892,15 +1892,16 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1892static ieee80211_rx_result 1892static ieee80211_rx_result
1893ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) 1893ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1894{ 1894{
1895 struct ieee80211_hdr *hdr; 1895 struct ieee80211_hdr *fwd_hdr, *hdr;
1896 struct ieee80211_tx_info *info;
1896 struct ieee80211s_hdr *mesh_hdr; 1897 struct ieee80211s_hdr *mesh_hdr;
1897 unsigned int hdrlen;
1898 struct sk_buff *skb = rx->skb, *fwd_skb; 1898 struct sk_buff *skb = rx->skb, *fwd_skb;
1899 struct ieee80211_local *local = rx->local; 1899 struct ieee80211_local *local = rx->local;
1900 struct ieee80211_sub_if_data *sdata = rx->sdata; 1900 struct ieee80211_sub_if_data *sdata = rx->sdata;
1901 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 1901 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
1902 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1902 __le16 reason = cpu_to_le16(WLAN_REASON_MESH_PATH_NOFORWARD); 1903 __le16 reason = cpu_to_le16(WLAN_REASON_MESH_PATH_NOFORWARD);
1903 u16 q; 1904 u16 q, hdrlen;
1904 1905
1905 hdr = (struct ieee80211_hdr *) skb->data; 1906 hdr = (struct ieee80211_hdr *) skb->data;
1906 hdrlen = ieee80211_hdrlen(hdr->frame_control); 1907 hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -1916,7 +1917,6 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1916 return RX_CONTINUE; 1917 return RX_CONTINUE;
1917 1918
1918 if (!mesh_hdr->ttl) 1919 if (!mesh_hdr->ttl)
1919 /* illegal frame */
1920 return RX_DROP_MONITOR; 1920 return RX_DROP_MONITOR;
1921 1921
1922 if (mesh_hdr->flags & MESH_FLAGS_AE) { 1922 if (mesh_hdr->flags & MESH_FLAGS_AE) {
@@ -1952,58 +1952,48 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1952 1952
1953 q = ieee80211_select_queue_80211(local, skb, hdr); 1953 q = ieee80211_select_queue_80211(local, skb, hdr);
1954 if (ieee80211_queue_stopped(&local->hw, q)) { 1954 if (ieee80211_queue_stopped(&local->hw, q)) {
1955 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh, 1955 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
1956 dropped_frames_congestion);
1957 return RX_DROP_MONITOR; 1956 return RX_DROP_MONITOR;
1958 } 1957 }
1959 skb_set_queue_mapping(skb, q); 1958 skb_set_queue_mapping(skb, q);
1960 mesh_hdr->ttl--;
1961 1959
1962 if (status->rx_flags & IEEE80211_RX_RA_MATCH) { 1960 if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
1963 if (!mesh_hdr->ttl) 1961 goto out;
1964 IEEE80211_IFSTA_MESH_CTR_INC(&rx->sdata->u.mesh,
1965 dropped_frames_ttl);
1966 else {
1967 struct ieee80211_hdr *fwd_hdr;
1968 struct ieee80211_tx_info *info;
1969
1970 fwd_skb = skb_copy(skb, GFP_ATOMIC);
1971
1972 if (!fwd_skb && net_ratelimit())
1973 printk(KERN_DEBUG "%s: failed to clone mesh frame\n",
1974 sdata->name);
1975 if (!fwd_skb)
1976 goto out;
1977
1978 fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data;
1979 info = IEEE80211_SKB_CB(fwd_skb);
1980 memset(info, 0, sizeof(*info));
1981 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
1982 info->control.vif = &rx->sdata->vif;
1983 info->control.jiffies = jiffies;
1984 if (is_multicast_ether_addr(fwd_hdr->addr1)) {
1985 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh,
1986 fwded_mcast);
1987 memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
1988 } else {
1989 if (mesh_nexthop_lookup(fwd_skb, sdata)) {
1990 /* can't resolve next hop, send a PERR */
1991 mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl,
1992 fwd_hdr->addr3, 0, reason,
1993 fwd_hdr->addr2, sdata);
1994 sdata->u.mesh.mshstats.dropped_frames_no_route++;
1995 return RX_DROP_MONITOR;
1996 }
1997 1962
1998 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh, 1963 if (!--mesh_hdr->ttl) {
1999 fwded_unicast); 1964 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
2000 } 1965 return RX_DROP_MONITOR;
2001 IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh, 1966 }
2002 fwded_frames); 1967
2003 ieee80211_add_pending_skb(local, fwd_skb); 1968 fwd_skb = skb_copy(skb, GFP_ATOMIC);
2004 } 1969 if (!fwd_skb) {
1970 if (net_ratelimit())
1971 printk(KERN_DEBUG "%s: failed to clone mesh frame\n",
1972 sdata->name);
1973 goto out;
1974 }
1975
1976 fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data;
1977 info = IEEE80211_SKB_CB(fwd_skb);
1978 memset(info, 0, sizeof(*info));
1979 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
1980 info->control.vif = &rx->sdata->vif;
1981 info->control.jiffies = jiffies;
1982 if (is_multicast_ether_addr(fwd_hdr->addr1)) {
1983 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast);
1984 memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
1985 } else if (!mesh_nexthop_lookup(fwd_skb, sdata)) {
1986 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast);
1987 } else {
1988 /* unable to resolve next hop */
1989 mesh_path_error_tx(ifmsh->mshcfg.element_ttl, fwd_hdr->addr3,
1990 0, reason, fwd_hdr->addr2, sdata);
1991 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route);
1992 return RX_DROP_MONITOR;
2005 } 1993 }
2006 1994
1995 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames);
1996 ieee80211_add_pending_skb(local, fwd_skb);
2007 out: 1997 out:
2008 if (is_multicast_ether_addr(hdr->addr1) || 1998 if (is_multicast_ether_addr(hdr->addr1) ||
2009 sdata->dev->flags & IFF_PROMISC) 1999 sdata->dev->flags & IFF_PROMISC)