lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Jan 2019 12:33:28 +0800
From:   fei phung <feiphung27@...il.com>
To:     netdev@...r.kernel.org, majordomo@...r.kernel.org, mst@...hat.com,
        feiphung@...mail.com
Subject: Question on ptr_ring linux header

Hi netdev mailing list and Michael,

I am having problem getting proper ptr_ring operation where one
ptr_ring entry (val1=2 for item_recv_pop) is missing from the void **
queue

Did I initialize the ring pointers (ptr_ring_init()) correctly ?

See the following for more context:

https://i.imgur.com/xWJOH1G.png
https://gist.github.com/promach/7716ee8addcaa33fda140d74d1ad94d6#file-riffa_driver-c-L663
https://gist.github.com/promach/65e9331d55a43a2815239430a28e29c6#file-circ_ring-c-L44


struct ptr_ring * init_circ_queue(int len)
{
        struct ptr_ring * q;

        q = kzalloc(sizeof(struct ptr_ring), GFP_KERNEL);
        if (q == NULL) {
                DEBUG_MSG(KERN_ERR "Not enough memory to allocate ptr_ring");
                return NULL;
        }

        // creates an array of length 'len' where each array location
can store a struct * item
        if(ptr_ring_init(q, len, GFP_KERNEL) != 0) {
                DEBUG_MSG(KERN_ERR "Not enough memory to allocate
ptr_ring array");
                return NULL;
        }

        return q;
}



                while ((nomsg = pop_circ_queue(sc->recv[chnl]->msgs,
&item_recv_pop))) {
                        prepare_to_wait(&sc->recv[chnl]->waitq, &wait,
TASK_INTERRUPTIBLE);
                        // Another check before we schedule.
                        if ((nomsg =
pop_circ_queue(sc->recv[chnl]->msgs, &item_recv_pop)))
                                tymeout = schedule_timeout(tymeout);
                        finish_wait(&sc->recv[chnl]->waitq, &wait);
                        if (signal_pending(current)) {
                                free_sg_buf(sc, sc->recv[chnl]->sg_map_0);
                                free_sg_buf(sc, sc->recv[chnl]->sg_map_1);
                                return -ERESTARTSYS;
                        }
                        if (!nomsg)
                                break;
                        if (tymeout == 0) {
                                printk(KERN_ERR "riffa: fpga:%d
chnl:%d, recv timed out\n", sc->id, chnl);
                                /*free_sg_buf(sc, sc->recv[chnl]->sg_map_0);
                                free_sg_buf(sc, sc->recv[chnl]->sg_map_1);
                                return (unsigned int)(recvd>>2);*/
                        }
                }
                tymeout = tymeouto;
                msg_type = item_recv_pop.val1;
                msg = item_recv_pop.val2;
                DEBUG_MSG(KERN_INFO "recv msg_type: %u\n", msg_type);


Regards,
Phung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ