[linux-yocto] [PATCH 1/1] Revert "net: Rename skb->rxhash to skb->hash"
Bruce Ashfield
bruce.ashfield at windriver.com
Wed Sep 10 07:06:52 PDT 2014
On 14-09-10 03:17 AM, He Zhe wrote:
>
> On 09/10/2014 02:41 PM, Bruce Ashfield wrote:
>> On 14-09-09 10:56 PM, zhe.he at windriver.com wrote:
>>> From: He Zhe <zhe.he at windriver.com>
>>>
>>> Revert unnecessary renaming for BPF. Build will fail if related
>>> drivers are
>>> enabled but do not get updated accordingly.
>>
>> Did you actually perform a git revert on this commit on linux-yocto-3.14
>> standard/base branch ?
>>
>> This didn't revert cleanly for me.
>>
>> So please double check, and make sure you've cloned the latest tree
>> from the
>> git servers.
>>
> I can apply the patch successfully as follow. Could you please send me
> your process?
>
> 1) Clone and pull on this repo
> git://git.yoctoproject.org/linux-yocto-3.14
>
> 2) Switch to standard/base
>
> 3) Apply the patch
> git am ~/0001-Revert-net-Rename-skb-rxhash-to-skb-hash.patch
> Applying: Revert "net: Rename skb->rxhash to skb->hash"
Right here. If a patch is a pure revert of the original, you do not
apply a patch .. you revert it.
Find the git commit and issue "git revert <hash>", if it fails, there
are other stacked patches that have changed context to adapt to the
first one.
In that case, we are not doing a clean revert, and your patch is also
implicitly fixing up those other patches. So we can't call it a
revert in the commit header, and you need to document/explain those
other fixes as well.
Bruce
>
> 4) git log --pretty=oneline -40 | grep -v ^:
> c33f98897774024687745f6d0f4a651e98031b13 Revert "net: Rename skb->rxhash
> to skb->hash" ---- the revert
> b85edae6fd61ceadfc08099608e8ac90aa4c5c33 net: e1000e calls
> skb_set_hash ---- last
> one of BPF set
> b45e6dec1972bc70ceba882da17a043b7a9b58bc net: ppp: use
> sk_unattached_filter api
> d310945fb6d8729cfd538bfcf28d348a863ff486 tracing: accelerate tracing
> filters with BPF
> 6742a0d5e218809106b107a58378811201445fd8 net: filter: x86: internal BPF JIT
> 66f2b151dd096f2e531ffa6985115b5ad850e3f5 net: filter: x86: split
> bpf_jit_compile()
> 3c82c5d1fc493f1240e689020790777351b8f9f3 net: filter: Fix redefinition
> warnings on x86-64.
> 5ad74ef546a4b453277d66bb40d0605f6a95be2b net: filter: additional BPF tests
> f097814fc3051b37918ac496dd16fc70215d836e net: filter: BPF testsuite
> 1bcefe39e229c4cd4ef81e62ee8c7016077ce709 net: filter: make BPF
> conversion more readable
> e75a3abd0c6f56c0e368e66dd1a9040edb3bed3b net: filter: misc/various cleanups
> f5cd96317979c402ba9e10ead36f6baef66bfd29 net: filter: make register
> naming more comprehensible
> 2f485870e68b5dacfb49cd36b92e8110f7eb2274 net: filter: simplify label
> names from jump-table
> d381512d96f085353e96dec245d6045c8b7cd27e bpf_dbg: fix wrong register usage
> d99d91c2c5a95a6764b30be63aa5b9cfc3936c85 sched, cls: check if we could
> overwrite actions when changing a filter
> 8a03c23319dc747b76924f43be37e7554dfffea2 net: filter: initialize A and X
> registers
> 77a8a3fb86cb81d92892f09fa7e9075a9165d7fb filter: added BPF random opcode
> a9bb9bcd5a0485ec4b95b0212b3b442e2298b581 net: filter: seccomp: fix wrong
> decoding of BPF_S_ANC_SECCOMP_LD_W
> 724096236a6836581ea4d46a9a3631ad8bf3b20c filter: prevent nla extensions
> to peek beyond the end of the message
> 41bdf9a8c75f62d49138df4aaff09553b8675a29 net: filter: be more defensive
> on div/mod by X==0
> 2f908136e31125fd28004c95c7921e693d3e3673 net: filter: minor: fix kdoc in
> __sk_run_filter
> 2c733311d285a7222823a8b342d76a2ee1c13fa2 net: filter: rework/optimize
> internal BPF interpreter's instruction set
> 40155402aff6eb09a013935e7e75d4bf5b79e96a net: filter: move filter
> accounting to filter core
> 2635af59e1b6f03f87632bdedb437b18a117b3f6 net: filter: keep original BPF
> program around
> 97147dbf46f8316e5c67b921970a5996cd930c01 net: filter: add jited flag to
> indicate jit compiled filters
> 676d895e105a4cb69461ab313ef1851493af6018 net: Rename skb->rxhash to
> skb->hash
> 1e4f73c1430777626f65834599eb6ace3998ee80 tools: bpf_dbg: various misc
> code cleanups ---- first one of BPF set
> ......
>
>
> Zhe
>
>> Bruce
>>
>>>
>>> Signed-off-by: He Zhe <zhe.he at windriver.com>
>>> ---
>>> arch/arm/net/bpf_jit_32.c | 4 ++--
>>> arch/powerpc/net/bpf_jit_comp.c | 4 ++--
>>> arch/s390/net/bpf_jit_comp.c | 8 ++++----
>>> arch/sparc/net/bpf_jit_comp.c | 2 +-
>>> include/linux/skbuff.h | 28 ++++++++++++++--------------
>>> include/net/sock.h | 4 ++--
>>> include/trace/events/net.h | 12 ++++++------
>>> net/core/dev.c | 13 ++++++-------
>>> net/core/filter.c | 4 ++--
>>> net/core/flow_dissector.c | 10 +++++-----
>>> net/packet/af_packet.c | 3 ++-
>>> 11 files changed, 46 insertions(+), 46 deletions(-)
>>>
>>> diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
>>> index 6f879c3..e72ff51 100644
>>> --- a/arch/arm/net/bpf_jit_32.c
>>> +++ b/arch/arm/net/bpf_jit_32.c
>>> @@ -825,8 +825,8 @@ b_epilogue:
>>> break;
>>> case BPF_S_ANC_RXHASH:
>>> ctx->seen |= SEEN_SKB;
>>> - BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4);
>>> - off = offsetof(struct sk_buff, hash);
>>> + BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, rxhash) != 4);
>>> + off = offsetof(struct sk_buff, rxhash);
>>> emit(ARM_LDR_I(r_A, r_skb, off), ctx);
>>> break;
>>> case BPF_S_ANC_VLAN_TAG:
>>> diff --git a/arch/powerpc/net/bpf_jit_comp.c
>>> b/arch/powerpc/net/bpf_jit_comp.c
>>> index 808ce1c..c0c5fcb 100644
>>> --- a/arch/powerpc/net/bpf_jit_comp.c
>>> +++ b/arch/powerpc/net/bpf_jit_comp.c
>>> @@ -390,9 +390,9 @@ static int bpf_jit_build_body(struct sk_filter
>>> *fp, u32 *image,
>>> mark));
>>> break;
>>> case BPF_S_ANC_RXHASH:
>>> - BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4);
>>> + BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, rxhash) != 4);
>>> PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
>>> - hash));
>>> + rxhash));
>>> break;
>>> case BPF_S_ANC_VLAN_TAG:
>>> case BPF_S_ANC_VLAN_TAG_PRESENT:
>>> diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
>>> index e9f8fa9..44f224b 100644
>>> --- a/arch/s390/net/bpf_jit_comp.c
>>> +++ b/arch/s390/net/bpf_jit_comp.c
>>> @@ -736,10 +736,10 @@ call_fn: /* lg %r1,<d(function)>(%r13) */
>>> /* icm %r5,3,<d(type)>(%r1) */
>>> EMIT4_DISP(0xbf531000, offsetof(struct net_device, type));
>>> break;
>>> - case BPF_S_ANC_RXHASH: /* A = skb->hash */
>>> - BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4);
>>> - /* l %r5,<d(hash)>(%r2) */
>>> - EMIT4_DISP(0x58502000, offsetof(struct sk_buff, hash));
>>> + case BPF_S_ANC_RXHASH: /* A = skb->rxhash */
>>> + BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, rxhash) != 4);
>>> + /* l %r5,<d(rxhash)>(%r2) */
>>> + EMIT4_DISP(0x58502000, offsetof(struct sk_buff, rxhash));
>>> break;
>>> case BPF_S_ANC_VLAN_TAG:
>>> case BPF_S_ANC_VLAN_TAG_PRESENT:
>>> diff --git a/arch/sparc/net/bpf_jit_comp.c
>>> b/arch/sparc/net/bpf_jit_comp.c
>>> index 49cee4a..b85e223 100644
>>> --- a/arch/sparc/net/bpf_jit_comp.c
>>> +++ b/arch/sparc/net/bpf_jit_comp.c
>>> @@ -618,7 +618,7 @@ void bpf_jit_compile(struct sk_filter *fp)
>>> emit_load16(r_A, struct net_device, type, r_A);
>>> break;
>>> case BPF_S_ANC_RXHASH:
>>> - emit_skb_load32(hash, r_A);
>>> + emit_skb_load32(rxhash, r_A);
>>> break;
>>> case BPF_S_ANC_VLAN_TAG:
>>> case BPF_S_ANC_VLAN_TAG_PRESENT:
>>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>>> index 69d3749..15ede6a 100644
>>> --- a/include/linux/skbuff.h
>>> +++ b/include/linux/skbuff.h
>>> @@ -392,11 +392,11 @@ typedef unsigned char *sk_buff_data_t;
>>> * @skb_iif: ifindex of device we arrived on
>>> * @tc_index: Traffic control index
>>> * @tc_verd: traffic control verdict
>>> - * @hash: the packet hash
>>> + * @rxhash: the packet hash computed on receive
>>> * @queue_mapping: Queue mapping for multiqueue devices
>>> * @ndisc_nodetype: router type (from link layer)
>>> * @ooo_okay: allow the mapping of a socket to a queue to be
>>> changed
>>> - * @l4_hash: indicate hash is a canonical 4-tuple hash over
>>> transport
>>> + * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over
>>> transport
>>> * ports.
>>> * @wifi_acked_valid: wifi_acked was set
>>> * @wifi_acked: whether frame was acked on wifi or not
>>> @@ -482,7 +482,7 @@ struct sk_buff {
>>>
>>> int skb_iif;
>>>
>>> - __u32 hash;
>>> + __u32 rxhash;
>>>
>>> __be16 vlan_proto;
>>> __u16 vlan_tci;
>>> @@ -501,7 +501,7 @@ struct sk_buff {
>>> #endif
>>> __u8 pfmemalloc:1;
>>> __u8 ooo_okay:1;
>>> - __u8 l4_hash:1;
>>> + __u8 l4_rxhash:1;
>>> __u8 wifi_acked_valid:1;
>>> __u8 wifi_acked:1;
>>> __u8 no_fcs:1;
>>> @@ -758,40 +758,40 @@ enum pkt_hash_types {
>>> static inline void
>>> skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types
>>> type)
>>> {
>>> - skb->l4_hash = (type == PKT_HASH_TYPE_L4);
>>> - skb->hash = hash;
>>> + skb->l4_rxhash = (type == PKT_HASH_TYPE_L4);
>>> + skb->rxhash = hash;
>>> }
>>>
>>> void __skb_get_hash(struct sk_buff *skb);
>>> static inline __u32 skb_get_hash(struct sk_buff *skb)
>>> {
>>> - if (!skb->l4_hash)
>>> + if (!skb->l4_rxhash)
>>> __skb_get_hash(skb);
>>>
>>> - return skb->hash;
>>> + return skb->rxhash;
>>> }
>>>
>>> static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
>>> {
>>> - return skb->hash;
>>> + return skb->rxhash;
>>> }
>>>
>>> static inline void skb_clear_hash(struct sk_buff *skb)
>>> {
>>> - skb->hash = 0;
>>> - skb->l4_hash = 0;
>>> + skb->rxhash = 0;
>>> + skb->l4_rxhash = 0;
>>> }
>>>
>>> static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb)
>>> {
>>> - if (!skb->l4_hash)
>>> + if (!skb->l4_rxhash)
>>> skb_clear_hash(skb);
>>> }
>>>
>>> static inline void skb_copy_hash(struct sk_buff *to, const struct
>>> sk_buff *from)
>>> {
>>> - to->hash = from->hash;
>>> - to->l4_hash = from->l4_hash;
>>> + to->rxhash = from->rxhash;
>>> + to->l4_rxhash = from->l4_rxhash;
>>> };
>>>
>>> #ifdef NET_SKBUFF_DATA_USES_OFFSET
>>> diff --git a/include/net/sock.h b/include/net/sock.h
>>> index 547e4e5..e2a51ab 100644
>>> --- a/include/net/sock.h
>>> +++ b/include/net/sock.h
>>> @@ -862,9 +862,9 @@ static inline void sock_rps_save_rxhash(struct
>>> sock *sk,
>>> const struct sk_buff *skb)
>>> {
>>> #ifdef CONFIG_RPS
>>> - if (unlikely(sk->sk_rxhash != skb->hash)) {
>>> + if (unlikely(sk->sk_rxhash != skb->rxhash)) {
>>> sock_rps_reset_flow(sk);
>>> - sk->sk_rxhash = skb->hash;
>>> + sk->sk_rxhash = skb->rxhash;
>>> }
>>> #endif
>>> }
>>> diff --git a/include/trace/events/net.h b/include/trace/events/net.h
>>> index 1de256b..a34f27b 100644
>>> --- a/include/trace/events/net.h
>>> +++ b/include/trace/events/net.h
>>> @@ -153,8 +153,8 @@ DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
>>> __field( u16, vlan_tci )
>>> __field( u16, protocol )
>>> __field( u8, ip_summed )
>>> - __field( u32, hash )
>>> - __field( bool, l4_hash )
>>> + __field( u32, rxhash )
>>> + __field( bool, l4_rxhash )
>>> __field( unsigned int, len )
>>> __field( unsigned int, data_len )
>>> __field( unsigned int, truesize )
>>> @@ -179,8 +179,8 @@ DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
>>> __entry->vlan_tci = vlan_tx_tag_get(skb);
>>> __entry->protocol = ntohs(skb->protocol);
>>> __entry->ip_summed = skb->ip_summed;
>>> - __entry->hash = skb->hash;
>>> - __entry->l4_hash = skb->l4_hash;
>>> + __entry->rxhash = skb->rxhash;
>>> + __entry->l4_rxhash = skb->l4_rxhash;
>>> __entry->len = skb->len;
>>> __entry->data_len = skb->data_len;
>>> __entry->truesize = skb->truesize;
>>> @@ -191,11 +191,11 @@ DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
>>> __entry->gso_type = skb_shinfo(skb)->gso_type;
>>> ),
>>>
>>> - TP_printk("dev=%s napi_id=%#x queue_mapping=%u skbaddr=%p
>>> vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x
>>> ip_summed=%d hash=0x%08x l4_hash=%d len=%u data_len=%u truesize=%u
>>> mac_header_valid=%d mac_header=%d nr_frags=%d gso_size=%d gso_type=%#x",
>>> + TP_printk("dev=%s napi_id=%#x queue_mapping=%u skbaddr=%p
>>> vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x
>>> ip_summed=%d rxhash=0x%08x l4_rxhash=%d len=%u data_len=%u
>>> truesize=%u mac_header_valid=%d mac_header=%d nr_frags=%d gso_size=%d
>>> gso_type=%#x",
>>> __get_str(name), __entry->napi_id, __entry->queue_mapping,
>>> __entry->skbaddr, __entry->vlan_tagged, __entry->vlan_proto,
>>> __entry->vlan_tci, __entry->protocol, __entry->ip_summed,
>>> - __entry->hash, __entry->l4_hash, __entry->len,
>>> + __entry->rxhash, __entry->l4_rxhash, __entry->len,
>>> __entry->data_len, __entry->truesize,
>>> __entry->mac_header_valid, __entry->mac_header,
>>> __entry->nr_frags, __entry->gso_size, __entry->gso_type)
>>> diff --git a/net/core/dev.c b/net/core/dev.c
>>> index 20247e5..37bddf7 100644
>>> --- a/net/core/dev.c
>>> +++ b/net/core/dev.c
>>> @@ -2964,7 +2964,7 @@ set_rps_cpu(struct net_device *dev, struct
>>> sk_buff *skb,
>>> flow_table = rcu_dereference(rxqueue->rps_flow_table);
>>> if (!flow_table)
>>> goto out;
>>> - flow_id = skb_get_hash(skb) & flow_table->mask;
>>> + flow_id = skb->rxhash & flow_table->mask;
>>> rc = dev->netdev_ops->ndo_rx_flow_steer(dev, skb,
>>> rxq_index, flow_id);
>>> if (rc < 0)
>>> @@ -2998,7 +2998,6 @@ static int get_rps_cpu(struct net_device *dev,
>>> struct sk_buff *skb,
>>> struct rps_sock_flow_table *sock_flow_table;
>>> int cpu = -1;
>>> u16 tcpu;
>>> - u32 hash;
>>>
>>> if (skb_rx_queue_recorded(skb)) {
>>> u16 index = skb_get_rx_queue(skb);
>>> @@ -3027,8 +3026,7 @@ static int get_rps_cpu(struct net_device *dev,
>>> struct sk_buff *skb,
>>> }
>>>
>>> skb_reset_network_header(skb);
>>> - hash = skb_get_hash(skb);
>>> - if (!hash)
>>> + if (!skb_get_hash(skb))
>>> goto done;
>>>
>>> flow_table = rcu_dereference(rxqueue->rps_flow_table);
>>> @@ -3037,10 +3035,11 @@ static int get_rps_cpu(struct net_device
>>> *dev, struct sk_buff *skb,
>>> u16 next_cpu;
>>> struct rps_dev_flow *rflow;
>>>
>>> - rflow = &flow_table->flows[hash & flow_table->mask];
>>> + rflow = &flow_table->flows[skb->rxhash & flow_table->mask];
>>> tcpu = rflow->cpu;
>>>
>>> - next_cpu = sock_flow_table->ents[hash & sock_flow_table->mask];
>>> + next_cpu = sock_flow_table->ents[skb->rxhash &
>>> + sock_flow_table->mask];
>>>
>>> /*
>>> * If the desired CPU (where last recvmsg was done) is
>>> @@ -3069,7 +3068,7 @@ static int get_rps_cpu(struct net_device *dev,
>>> struct sk_buff *skb,
>>> }
>>>
>>> if (map) {
>>> - tcpu = map->cpus[((u64) hash * map->len) >> 32];
>>> + tcpu = map->cpus[((u64) skb->rxhash * map->len) >> 32];
>>>
>>> if (cpu_online(tcpu)) {
>>> cpu = tcpu;
>>> diff --git a/net/core/filter.c b/net/core/filter.c
>>> index 32c5b44..ac88686 100644
>>> --- a/net/core/filter.c
>>> +++ b/net/core/filter.c
>>> @@ -729,10 +729,10 @@ static bool convert_bpf_extensions(struct
>>> sock_filter *fp,
>>> break;
>>>
>>> case SKF_AD_OFF + SKF_AD_RXHASH:
>>> - BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, hash) != 4);
>>> + BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, rxhash) != 4);
>>>
>>> *insn = BPF_LDX_MEM(BPF_W, BPF_REG_A, BPF_REG_CTX,
>>> - offsetof(struct sk_buff, hash));
>>> + offsetof(struct sk_buff, rxhash));
>>> break;
>>>
>>> case SKF_AD_OFF + SKF_AD_QUEUE:
>>> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
>>> index 8808dcd..e29e810 100644
>>> --- a/net/core/flow_dissector.c
>>> +++ b/net/core/flow_dissector.c
>>> @@ -203,8 +203,8 @@ static __always_inline u32 __flow_hash_1word(u32 a)
>>>
>>> /*
>>> * __skb_get_hash: calculate a flow hash based on src/dst addresses
>>> - * and src/dst port numbers. Sets hash in skb to non-zero hash value
>>> - * on success, zero indicates no valid hash. Also, sets l4_hash in skb
>>> + * and src/dst port numbers. Sets rxhash in skb to non-zero hash value
>>> + * on success, zero indicates no valid hash. Also, sets l4_rxhash
>>> in skb
>>> * if hash is a canonical 4-tuple hash over transport ports.
>>> */
>>> void __skb_get_hash(struct sk_buff *skb)
>>> @@ -216,7 +216,7 @@ void __skb_get_hash(struct sk_buff *skb)
>>> return;
>>>
>>> if (keys.ports)
>>> - skb->l4_hash = 1;
>>> + skb->l4_rxhash = 1;
>>>
>>> /* get a consistent hash (same value on both flow directions) */
>>> if (((__force u32)keys.dst < (__force u32)keys.src) ||
>>> @@ -232,7 +232,7 @@ void __skb_get_hash(struct sk_buff *skb)
>>> if (!hash)
>>> hash = 1;
>>>
>>> - skb->hash = hash;
>>> + skb->rxhash = hash;
>>> }
>>> EXPORT_SYMBOL(__skb_get_hash);
>>>
>>> @@ -344,7 +344,7 @@ static inline int get_xps_queue(struct net_device
>>> *dev, struct sk_buff *skb)
>>> hash = skb->sk->sk_hash;
>>> else
>>> hash = (__force u16) skb->protocol ^
>>> - skb->hash;
>>> + skb->rxhash;
>>> hash = __flow_hash_1word(hash);
>>> queue_index = map->queues[
>>> ((u64)hash * map->len) >> 32];
>>> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
>>> index 3a1521f..48a6a93 100644
>>> --- a/net/packet/af_packet.c
>>> +++ b/net/packet/af_packet.c
>>> @@ -1277,7 +1277,7 @@ static unsigned int fanout_demux_hash(struct
>>> packet_fanout *f,
>>> struct sk_buff *skb,
>>> unsigned int num)
>>> {
>>> - return reciprocal_scale(skb_get_hash(skb), num);
>>> + return reciprocal_scale(skb->rxhash, num);
>>> }
>>>
>>> static unsigned int fanout_demux_lb(struct packet_fanout *f,
>>> @@ -1362,6 +1362,7 @@ static int packet_rcv_fanout(struct sk_buff
>>> *skb, struct net_device *dev,
>>> if (!skb)
>>> return 0;
>>> }
>>> + skb_get_hash(skb);
>>> idx = fanout_demux_hash(f, skb, num);
>>> break;
>>> case PACKET_FANOUT_LB:
>>>
>>
>
More information about the linux-yocto
mailing list