title: How to determine if the ethernet frame is an IPv4 packet?
body: <p>I use pcap_pmd in a DPDK application, and it does not set the <code>packet_type</code> field automatically. How can I determine the correct packet type after the packet is received from the interface?</p>
  
  <p><strong>edit</strong>:
  The ethernet header structure:</p>
  
  <pre><code>/**
   * Ethernet header: Contains the destination address, source address
   * and frame type.
   */
  struct ether_hdr {
      struct ether_addr d_addr; /**&lt; Destination address. */
      struct ether_addr s_addr; /**&lt; Source address. */
      uint16_t ether_type;      /**&lt; Frame type. */
  } __attribute__((__packed__));
  </code></pre>
  
  <p>does not give a clue on where to search for the L3 protocol identifier.</p>