[ovs-dev] [PATCH v2 06/12] dpif-netdev: Use DP_PACKET_BATCH_FOR_EACH in fast_path_processing.

Darrell Ball dball at vmware.com
Fri Sep 22 09:44:29 UTC 2017


I applied the patch to dpdk_merge here

https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_darball_ovs_commits_dpdk-5Fmerge&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=A2_FCacqbp2moAo3HGFlTuxsjONUGhlN42OBcAuQQ6w&s=b6btPKhgvOFr2GOUYvktND6kaC6jc3fXI-mXfvNgXOU&e=


On 9/20/17, 6:27 AM, "ovs-dev-bounces at openvswitch.org on behalf of Bhanuprakash Bodireddy" <ovs-dev-bounces at openvswitch.org on behalf of bhanuprakash.bodireddy at intel.com> wrote:

    Use DP_PACKET_BATCH_FOR_EACH macro in fast_path_processing().
    
    Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy at intel.com>
    ---
     lib/dpif-netdev.c | 15 +++++++--------
     1 file changed, 7 insertions(+), 8 deletions(-)
    
    diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
    index 5000f7a..07fca44 100644
    --- a/lib/dpif-netdev.c
    +++ b/lib/dpif-netdev.c
    @@ -5001,14 +5001,14 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
                          odp_port_t in_port,
                          long long now)
     {
    -    int cnt = packets_->count;
    +    const size_t cnt = dp_packet_batch_size(packets_);
     #if !defined(__CHECKER__) && !defined(_WIN32)
         const size_t PKT_ARRAY_SIZE = cnt;
     #else
         /* Sparse or MSVC doesn't like variable length array. */
         enum { PKT_ARRAY_SIZE = NETDEV_MAX_BURST };
     #endif
    -    struct dp_packet **packets = packets_->packets;
    +    struct dp_packet *packet;
         struct dpcls *cls;
         struct dpcls_rule *rules[PKT_ARRAY_SIZE];
         struct dp_netdev *dp = pmd->dp;
    @@ -5036,7 +5036,7 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
             ofpbuf_use_stub(&actions, actions_stub, sizeof actions_stub);
             ofpbuf_use_stub(&put_actions, slow_stub, sizeof slow_stub);
     
    -        for (i = 0; i < cnt; i++) {
    +        DP_PACKET_BATCH_FOR_EACH (packet, packets_) {
                 struct dp_netdev_flow *netdev_flow;
     
                 if (OVS_LIKELY(rules[i])) {
    @@ -5055,7 +5055,7 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
                 }
     
                 miss_cnt++;
    -            handle_packet_upcall(pmd, packets[i], &keys[i], &actions,
    +            handle_packet_upcall(pmd, packet, &keys[i], &actions,
                                      &put_actions, &lost_cnt, now);
             }
     
    @@ -5063,17 +5063,16 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
             ofpbuf_uninit(&put_actions);
             fat_rwlock_unlock(&dp->upcall_rwlock);
         } else if (OVS_UNLIKELY(any_miss)) {
    -        for (i = 0; i < cnt; i++) {
    +        DP_PACKET_BATCH_FOR_EACH (packet, packets_) {
                 if (OVS_UNLIKELY(!rules[i])) {
    -                dp_packet_delete(packets[i]);
    +                dp_packet_delete(packet);
                     lost_cnt++;
                     miss_cnt++;
                 }
             }
         }
     
    -    for (i = 0; i < cnt; i++) {
    -        struct dp_packet *packet = packets[i];
    +    DP_PACKET_BATCH_FOR_EACH (packet, packets_) {
             struct dp_netdev_flow *flow;
     
             if (OVS_UNLIKELY(!rules[i])) {
    -- 
    2.4.11
    
    _______________________________________________
    dev mailing list
    dev at openvswitch.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=A0ml__l5MyGe06dBad4HmKMMag4q3dFDL_gAXaYpi-g&s=do0oVzNddG56LYP4Mu9PvZM9wtAfe9PAKvGh930VMJ0&e= 
    





More information about the dev mailing list