[ovs-dev] [PATCH] lib: Rename ofp to buf.

Pravin Shelar pshelar at nicira.com
Wed Jun 25 16:31:02 UTC 2014


On Tue, Jun 24, 2014 at 2:20 PM, Daniele Di Proietto
<ddiproietto at vmware.com> wrote:
> On Jun 8, 2014, at 1:18 PM, Pravin B Shelar <pshelar at nicira.com> wrote:
>
>> dpif-packet contains ofpbuf which points to packet data.  Here buf
>> is better name rather than ofp.
>> Following patch renames all remaining instances of ofp variable.
>>
>> Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
>> ---
>> lib/netdev-dpdk.c |  4 ++--
>> lib/odp-execute.c | 20 ++++++++++----------
>> lib/packet-dpif.h |  4 ++--
>> 3 files changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> index 6d92969..18049b2 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -206,8 +206,8 @@ dpdk_rte_mzalloc(size_t sz)
>> void
>> free_dpdk_buf(struct dpif_packet *p)
>> {
>> -    struct ofpbuf *ofp = &p->ofpbuf;
>> -    struct rte_mbuf *pkt = (struct rte_mbuf *) ofp->dpdk_buf;
>> +    struct ofpbuf *buf = &p->ofpbuf;
>> +    struct rte_mbuf *pkt = (struct rte_mbuf *) buf->dpdk_buf;
>>
>>     rte_mempool_put(pkt->pool, pkt);
>> }
>> diff --git a/lib/odp-execute.c b/lib/odp-execute.c
>> index 7de0c94..cb89e72 100644
>> --- a/lib/odp-execute.c
>> +++ b/lib/odp-execute.c
>> @@ -240,9 +240,9 @@ odp_execute_actions__(void *dp, struct dpif_packet **packets, int cnt,
>>                 uint32_t hash;
>>
>>                 for (i = 0; i < cnt; i++) {
>> -                    struct ofpbuf *ofp = &packets[i]->ofpbuf;
>> +                    struct ofpbuf *buf = &packets[i]->ofpbuf;
>>
>> -                    flow_extract(ofp, md, &flow);
>> +                    flow_extract(buf, md, &flow);
>>                     hash = flow_hash_5tuple(&flow, hash_act->hash_basis);
>>
>>                     /* The hash of the first packet is in shared metadata */
>> @@ -264,18 +264,18 @@ odp_execute_actions__(void *dp, struct dpif_packet **packets, int cnt,
>>             const struct ovs_action_push_vlan *vlan = nl_attr_get(a);
>>
>>             for (i = 0; i < cnt; i++) {
>> -                struct ofpbuf *ofp = &packets[i]->ofpbuf;
>> +                struct ofpbuf *buf = &packets[i]->ofpbuf;
>>
>> -                eth_push_vlan(ofp, htons(ETH_TYPE_VLAN), vlan->vlan_tci);
>> +                eth_push_vlan(buf, htons(ETH_TYPE_VLAN), vlan->vlan_tci);
>>             }
>>             break;
>>         }
>>
>>         case OVS_ACTION_ATTR_POP_VLAN:
>>             for (i = 0; i < cnt; i++) {
>> -                struct ofpbuf *ofp = &packets[i]->ofpbuf;
>> +                struct ofpbuf *buf = &packets[i]->ofpbuf;
>>
>> -                eth_pop_vlan(ofp);
>> +                eth_pop_vlan(buf);
>>             }
>>             break;
>>
>> @@ -283,18 +283,18 @@ odp_execute_actions__(void *dp, struct dpif_packet **packets, int cnt,
>>             const struct ovs_action_push_mpls *mpls = nl_attr_get(a);
>>
>>             for (i = 0; i < cnt; i++) {
>> -                struct ofpbuf *ofp = &packets[i]->ofpbuf;
>> +                struct ofpbuf *buf = &packets[i]->ofpbuf;
>>
>> -                push_mpls(ofp, mpls->mpls_ethertype, mpls->mpls_lse);
>> +                push_mpls(buf, mpls->mpls_ethertype, mpls->mpls_lse);
>>             }
>>             break;
>>          }
>>
>>         case OVS_ACTION_ATTR_POP_MPLS:
>>             for (i = 0; i < cnt; i++) {
>> -                struct ofpbuf *ofp = &packets[i]->ofpbuf;
>> +                struct ofpbuf *buf = &packets[i]->ofpbuf;
>>
>> -                pop_mpls(ofp, nl_attr_get_be16(a));
>> +                pop_mpls(buf, nl_attr_get_be16(a));
>>             }
>>             break;
>>
>> diff --git a/lib/packet-dpif.h b/lib/packet-dpif.h
>> index 48da67b..f11ecd8 100644
>> --- a/lib/packet-dpif.h
>> +++ b/lib/packet-dpif.h
>> @@ -39,9 +39,9 @@ struct dpif_packet *dpif_packet_clone(struct dpif_packet *p);
>>
>> static inline void dpif_packet_delete(struct dpif_packet *p)
>> {
>> -    struct ofpbuf *ofp = &p->ofpbuf;
>> +    struct ofpbuf *buf = &p->ofpbuf;
>>
>> -    ofpbuf_delete(ofp);
>> +    ofpbuf_delete(buf);
>> }
>>
>> #ifdef  __cplusplus
>> --
>> 1.9.3
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=MV9BdLjtFIdhBDBaw5z%2BU6SSA2gAfY4L%2F1HCy3VjlKU%3D%0A&m=G2hHUJ5%2FuQonj%2Bj0UIP0Me31vT2X3wIZxmjTluiWBNE%3D%0A&s=160465d95ba93d38e0d745156524a3067a61fc4e4eb42d717e49c0cedb0dabd4
>
>
> I should have done this, thanks.
>
> Acked-by: Daniele Di Proietto <ddiproietto at vmware.com>

I pushed it to master.

Thanks.



More information about the dev mailing list