[dpdk-users] Unable to transmit custom built packet in dpdk

Upendra Pathrikar uspathrikar at gmail.com
Sun Oct 16 17:19:06 CEST 2016


hi,

I am trying to build packet generator like application in dpdk. I have
custom built packet as unsigned char array(used to store hex values) I have
allocated mbuf and extract unsigned char pointer for data field from mbuf
and now I am filling the mbuf with unsigned char array packet. Then  trying
to transmit the  packet using rte_eth_tx_burst function. It reteurns as the
packet is sent but I don't receive the same packet or any garbage packet
either on wireshark or using custom application with rte_eth_rx_burst.

I am working on ubuntu 14.04 with kernel 3.13
I am using Intel Gigabit ET dual port server adapter (82576) with igb_uio
driver binding
one port to transmit packet and other to receive packet

the custom packet defined is arp packet without crc i.e 60bytes
application should not exit unless it receives packet.
But it is exiting at first execution of rte_eth_rx_burst() without
indicating any error or executing further. I am clueless now.

Your help will be appreciated

static int txmt_pkts(void)
{
    uint8_t port_id;
    struct rte_mbuf *mpkt, *rxpkt;
    unsigned char
packet[]="ffffffffffff3417ebc76473080600010800060400013417ebc764730ad042700000000000000ad04201000000000000000000000000000000000000\0";
    unsigned char pkt[strlen(packet)/2];
    int ret,i;
    int nb_tx, nb_rx;
    unsigned char *ptr;

    /* Function convert char array into cooresponding actual hex values*/
    ret = hexstring2hexchar(packet,pkt,strlen(packet));
    if(ret < 0)
        return -3;
    /* Allocate mbuf to add packet data */
    mpkt = rte_pktmbuf_alloc(mbuf_pool);
    if(mpkt == NULL)
        return -2;
    rte_mbuf_sanity_check(mpkt,1);
    ptr = rte_pktmbuf_mtod(mpkt,unsigned char *);
    for(i = 0; i< (strlen(packet)/2); i++){
        *(ptr+i) = *(pkt+i);
        mpkt->data_len++;
        mpkt->pkt_len++;
    }
    rte_mbuf_sanity_check(mpkt,1);
    nb_tx = rte_eth_tx_burst(1, 0, &mpkt, 1);
    printf("\npackets sent till this time - %d",nb_tx);

    while(1){
        nb_rx = rte_eth_rx_burst(0,0,rxpkt,1);
        if(nb_rx != 0){
            printf("\nFinally recived a packet - %d\n",nb_rx);
            break;
        }
    }
    printf("\nEnd of transmission\n");
    return 0;
}



Thanks...

-- 






*Regards,Upendra Sunil PathrikarResearch ScholarBharti School of Telecom
Technology and Management,Indian Institute of Technology, Delhi.*


More information about the users mailing list