From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by dpdk.org (Postfix) with ESMTP id D407E1B157 for ; Sat, 29 Sep 2018 12:39:25 +0200 (CEST) Received: by mail-wm1-f49.google.com with SMTP id r63-v6so383082wma.4 for ; Sat, 29 Sep 2018 03:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qCN/tqJtNpuiYy2qGZE08hQsK7gUHfnX1Q54+WpZp5I=; b=YvpaRvB7L5TGx5XAx6eu8hROySo7ba6bm+aWOoFum97fMrQujLW3KWKmXdBKbFyzyT Y72YcRg/hex3I/wdnLoYWO52oYnyyBkI/TO6t7iRDQ6hTPsypXUdHmligJp66diz+PqS zoMsjmIrh9K35+aySEjrme2MfvEdfGgBoh6QTH8kGEH0NQsStZULgrE5KTHffxr7WRlr +VlPcQQQh11HWB7nLeTY+2mUwhy1pY38gb5wbHvwPpZ1xmPRnyxJE2f5WcucnrtKpUS5 47aa2rTE8cD3va7U2CDWfmUjCgqs3mYMpXa4ODrBu+XNrrTlPjCMFDccIqDejZbW7vfN Z4oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qCN/tqJtNpuiYy2qGZE08hQsK7gUHfnX1Q54+WpZp5I=; b=fhBWspBPng+imy5wakemDwmy6TkgGLuHh1VhPlI0Q2LczxRaI5qE5sbihc3nEa5p3B hNmwJ92M7A6HLdKD4XME2ICrU7G9j2OcXMvGcjb/LF8ha18IH0yAkFAY2R58l16RzyJj l5/R/PQY40H3pG/dKK3ThoJRZ+f0pfQFF8S42OgwuVflAyPV2NqEI+z3KkctAtt0T3JI 8+S0YbmCulFgftJACdBXmOyJrtESUBNfKlL0JsDx+8JcUd7bbmUS3Nk8O29Z5ekNXrRT 2XLvk1+YnGpd7ycXl2GKE8/ScX1aOWD6rF4VqSoU0Yfeml7E9TW6dOPXoT20RobHPw+D 2zTg== X-Gm-Message-State: ABuFfoh1FlVg8IvhcgaYJvFAuEAaxzDeI2vY02HlqxXzgpd2Rfo3lKpB KIQd/K0f0UMwyrnhQpyJiCjkWx+rvD2GJLclwco= X-Google-Smtp-Source: ACcGV60vfKMSjUmWGiypk7Dj3QnUWkBjXDF1WkQBvihmcaiwObMV116mZwPXPhuXgKzlqznYVV2PJSgX3Ga6MipSnvs= X-Received: by 2002:a1c:6c0a:: with SMTP id h10-v6mr4438530wmc.47.1538217565393; Sat, 29 Sep 2018 03:39:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shyam Shrivastav Date: Sat, 29 Sep 2018 16:09:13 +0530 Message-ID: To: mikeb01@gmail.com Cc: users Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-users] Calculating Packet Length X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2018 10:39:26 -0000 We have to use sizeof(struct ether_hdr) , length set is wrong and 8 bytes short struct ether_hdr { struct ether_addr d_addr; /**< Destination address. */ struct ether_addr s_addr; /**< Source address. */ uint16_t ether_type; /**< Frame type. */ } __attribute__((__packed__)); On Sat, Sep 29, 2018 at 3:49 PM Michael Barker wrote: > Hi, > > I've new to DPDK and have been started by sending ARP packets. I have a > question around how to set the mbuf data_len and pkt_size. I Initially did > the following: > > struct rte_mbuf* arp_pkt = rte_pktmbuf_alloc(mbuf_pool); > const size_t pkt_size = sizeof(struct ether_addr) + sizeof(struct > arp_hdr); > > arp_pkt->data_len = pkt_size; > arp_pkt->pkt_len = pkt_size; > > Which is based on ptpclient.c sample code. However after setting all of > the fields, the packet either doesn't get sent or has some of the data > truncated from the end of the packet when viewed in Wireshark. If I modify > the size to be the following: > > const size_t pkt_size = sizeof(struct ether_addr) + sizeof(struct > arp_hdr) + 8; > > It works as expected. I'm wondering where the extra 8 bytes come from? Is > there a better way to calculate the packet length? > > Using dpdk 18.08, Linux - kernel 4.15.0-33. > > Mike. >