DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Unable to transmit custom built packet in dpdk
@ 2016-10-16 15:19 Upendra Pathrikar
  2016-10-17 10:48 ` Andriy Berestovskyy
  0 siblings, 1 reply; 2+ messages in thread
From: Upendra Pathrikar @ 2016-10-16 15:19 UTC (permalink / raw)
  To: users

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.*

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-users] Unable to transmit custom built packet in dpdk
  2016-10-16 15:19 [dpdk-users] Unable to transmit custom built packet in dpdk Upendra Pathrikar
@ 2016-10-17 10:48 ` Andriy Berestovskyy
  0 siblings, 0 replies; 2+ messages in thread
From: Andriy Berestovskyy @ 2016-10-17 10:48 UTC (permalink / raw)
  To: Upendra Pathrikar; +Cc: users

Hey,
In rte_eth_rx_burst() you are passing just a pointer to rte_mbuf,
while the functions expects a pointer to an array.

Andriy


On Sun, Oct 16, 2016 at 5:19 PM, Upendra Pathrikar
<uspathrikar@gmail.com> wrote:
> 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.*



-- 
Andriy Berestovskyy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-17 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-16 15:19 [dpdk-users] Unable to transmit custom built packet in dpdk Upendra Pathrikar
2016-10-17 10:48 ` Andriy Berestovskyy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).