netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next 0/4] use reset to set header pointers
@ 2016-03-01  9:27 Zhang Shengju
  2016-03-01  9:27 ` [net-next 1/4] vxlan: " Zhang Shengju
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Zhang Shengju @ 2016-03-01  9:27 UTC (permalink / raw)
  To: davem, kvalo, johannes, netdev

This patch series replace set function with reset when offset is zero.

Zhang Shengju (4):
  vxlan: use reset to set header pointers
  mac80211_hwsim: use reset to set mac header
  mac80211: use reset to set header pointer
  wireless: use reset to set mac header

 drivers/net/vxlan.c                   | 6 +++---
 drivers/net/wireless/mac80211_hwsim.c | 4 ++--
 net/mac80211/mesh_hwmp.c              | 6 +++---
 net/mac80211/rx.c                     | 2 +-
 net/mac80211/status.c                 | 2 +-
 net/mac80211/tx.c                     | 8 ++++----
 net/wireless/util.c                   | 2 +-
 7 files changed, 15 insertions(+), 15 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [net-next 1/4] vxlan: use reset to set header pointers
  2016-03-01  9:27 [net-next 0/4] use reset to set header pointers Zhang Shengju
@ 2016-03-01  9:27 ` Zhang Shengju
  2016-03-01 14:39   ` Sergei Shtylyov
  2016-03-01  9:27 ` [net-next 2/4] mac80211_hwsim: use reset to set mac header Zhang Shengju
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Zhang Shengju @ 2016-03-01  9:27 UTC (permalink / raw)
  To: davem, kvalo, johannes, netdev

Since offset is zeor, it's not necessary to use set function. Reset
function is straightforward, and will remove the unnecessary add operation
in set function.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 drivers/net/vxlan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 775ddb4..8ca243d 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1460,7 +1460,7 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request,
 	reply->dev = dev;
 	skb_reserve(reply, LL_RESERVED_SPACE(request->dev));
 	skb_push(reply, sizeof(struct ethhdr));
-	skb_set_mac_header(reply, 0);
+	skb_reset_mac_header(reply);
 
 	ns = (struct nd_msg *)skb_transport_header(request);
 
@@ -1480,7 +1480,7 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request,
 	reply->protocol = htons(ETH_P_IPV6);
 
 	skb_pull(reply, sizeof(struct ethhdr));
-	skb_set_network_header(reply, 0);
+	skb_reset_network_header(reply);
 	skb_put(reply, sizeof(struct ipv6hdr));
 
 	/* IPv6 header */
@@ -1495,7 +1495,7 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request,
 	pip6->saddr = *(struct in6_addr *)n->primary_key;
 
 	skb_pull(reply, sizeof(struct ipv6hdr));
-	skb_set_transport_header(reply, 0);
+	skb_reset_transport_header(reply);
 
 	na = (struct nd_msg *)skb_put(reply, sizeof(*na) + na_olen);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [net-next 2/4] mac80211_hwsim: use reset to set mac header
  2016-03-01  9:27 [net-next 0/4] use reset to set header pointers Zhang Shengju
  2016-03-01  9:27 ` [net-next 1/4] vxlan: " Zhang Shengju
@ 2016-03-01  9:27 ` Zhang Shengju
  2016-03-01  9:27 ` [net-next 3/4] mac80211: use reset to set header pointer Zhang Shengju
  2016-03-01  9:27 ` [net-next 4/4] wireless: use reset to set mac header Zhang Shengju
  3 siblings, 0 replies; 6+ messages in thread
From: Zhang Shengju @ 2016-03-01  9:27 UTC (permalink / raw)
  To: davem, kvalo, johannes, netdev

Since offset is zeor, it's not necessary to use set function. Reset
function is straightforward, and will remove the unnecessary add
operation in set function.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 drivers/net/wireless/mac80211_hwsim.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index a28414c..7b570bf 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -844,7 +844,7 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,
 	hdr->rt_chbitmask = cpu_to_le16(flags);
 
 	skb->dev = hwsim_mon;
-	skb_set_mac_header(skb, 0);
+	skb_reset_mac_header(skb);
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 	skb->pkt_type = PACKET_OTHERHOST;
 	skb->protocol = htons(ETH_P_802_2);
@@ -887,7 +887,7 @@ static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan,
 	memcpy(hdr11->addr1, addr, ETH_ALEN);
 
 	skb->dev = hwsim_mon;
-	skb_set_mac_header(skb, 0);
+	skb_reset_mac_header(skb);
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 	skb->pkt_type = PACKET_OTHERHOST;
 	skb->protocol = htons(ETH_P_802_2);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [net-next 3/4] mac80211: use reset to set header pointer
  2016-03-01  9:27 [net-next 0/4] use reset to set header pointers Zhang Shengju
  2016-03-01  9:27 ` [net-next 1/4] vxlan: " Zhang Shengju
  2016-03-01  9:27 ` [net-next 2/4] mac80211_hwsim: use reset to set mac header Zhang Shengju
@ 2016-03-01  9:27 ` Zhang Shengju
  2016-03-01  9:27 ` [net-next 4/4] wireless: use reset to set mac header Zhang Shengju
  3 siblings, 0 replies; 6+ messages in thread
From: Zhang Shengju @ 2016-03-01  9:27 UTC (permalink / raw)
  To: davem, kvalo, johannes, netdev

Since offset is zeor, it's not necessary to use set function. Reset
function is straightforward, and will remove the unnecessary add
operation in set function.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 net/mac80211/mesh_hwmp.c | 6 +++---
 net/mac80211/rx.c        | 2 +-
 net/mac80211/status.c    | 2 +-
 net/mac80211/tx.c        | 8 ++++----
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index c6be0b4..5b6aec1 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -205,9 +205,9 @@ static void prepare_frame_for_deferred_tx(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 
-	skb_set_mac_header(skb, 0);
-	skb_set_network_header(skb, 0);
-	skb_set_transport_header(skb, 0);
+	skb_reset_mac_header(skb);
+	skb_reset_network_header(skb);
+	skb_reset_transport_header(skb);
 
 	/* Send all internal mgmt frames on VO. Accordingly set TID to 7. */
 	skb_set_queue_mapping(skb, IEEE80211_AC_VO);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index bc08185..188e260 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3073,7 +3073,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
 	ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom,
 					 false);
 
-	skb_set_mac_header(skb, 0);
+	skb_reset_mac_header(skb);
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 	skb->pkt_type = PACKET_OTHERHOST;
 	skb->protocol = htons(ETH_P_802_2);
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 6101deb..8b1b2ea 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -697,7 +697,7 @@ void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
 					 rtap_len, shift);
 
 	/* XXX: is this sufficient for BPF? */
-	skb_set_mac_header(skb, 0);
+	skb_reset_mac_header(skb);
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 	skb->pkt_type = PACKET_OTHERHOST;
 	skb->protocol = htons(ETH_P_802_2);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3311ce0..5fcf025 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2380,7 +2380,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
 	/* Update skb pointers to various headers since this modified frame
 	 * is going to go through Linux networking code that may potentially
 	 * need things like pointer to IP header. */
-	skb_set_mac_header(skb, 0);
+	skb_reset_mac_header(skb);
 	skb_set_network_header(skb, nh_pos);
 	skb_set_transport_header(skb, h_pos);
 
@@ -3895,9 +3895,9 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
 {
 	int ac = ieee802_1d_to_ac[tid & 7];
 
-	skb_set_mac_header(skb, 0);
-	skb_set_network_header(skb, 0);
-	skb_set_transport_header(skb, 0);
+	skb_reset_mac_header(skb);
+	skb_reset_network_header(skb);
+	skb_reset_transport_header(skb);
 
 	skb_set_queue_mapping(skb, ac);
 	skb->priority = tid;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [net-next 4/4] wireless: use reset to set mac header
  2016-03-01  9:27 [net-next 0/4] use reset to set header pointers Zhang Shengju
                   ` (2 preceding siblings ...)
  2016-03-01  9:27 ` [net-next 3/4] mac80211: use reset to set header pointer Zhang Shengju
@ 2016-03-01  9:27 ` Zhang Shengju
  3 siblings, 0 replies; 6+ messages in thread
From: Zhang Shengju @ 2016-03-01  9:27 UTC (permalink / raw)
  To: davem, kvalo, johannes, netdev

Since offset is zeor, it's not necessary to use set function. Reset
function is straightforward, and will remove the unnecessary add
operation in set function.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 net/wireless/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/util.c b/net/wireless/util.c
index 9277042..7d26eac 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -636,7 +636,7 @@ int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
 	/* Update skb pointers to various headers since this modified frame
 	 * is going to go through Linux networking code that may potentially
 	 * need things like pointer to IP header. */
-	skb_set_mac_header(skb, 0);
+	skb_reset_mac_header(skb);
 	skb_set_network_header(skb, nh_pos);
 	skb_set_transport_header(skb, h_pos);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [net-next 1/4] vxlan: use reset to set header pointers
  2016-03-01  9:27 ` [net-next 1/4] vxlan: " Zhang Shengju
@ 2016-03-01 14:39   ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2016-03-01 14:39 UTC (permalink / raw)
  To: Zhang Shengju, davem, kvalo, johannes, netdev

Hello.

On 3/1/2016 12:27 PM, Zhang Shengju wrote:

> Since offset is zeor, it's not necessary to use set function. Reset

    Zero in this and the other patches.

> function is straightforward, and will remove the unnecessary add operation
> in set function.
>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-01 14:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01  9:27 [net-next 0/4] use reset to set header pointers Zhang Shengju
2016-03-01  9:27 ` [net-next 1/4] vxlan: " Zhang Shengju
2016-03-01 14:39   ` Sergei Shtylyov
2016-03-01  9:27 ` [net-next 2/4] mac80211_hwsim: use reset to set mac header Zhang Shengju
2016-03-01  9:27 ` [net-next 3/4] mac80211: use reset to set header pointer Zhang Shengju
2016-03-01  9:27 ` [net-next 4/4] wireless: use reset to set mac header Zhang Shengju

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).