convertor cannot be register

Is there no way to register both a down producer and converter in a single
…so file? I have no problem registering my down producer but not the
converter. I had do a printf and it always report " cannot register
convertor." The following is part of my code snippet. Someone help please
… thank you…

// functions in pktgen.so that io-net can call
io_net_registrant_funcs_t pktgen_P_funcs =
{
_IO_NET_REG_NFUNCS, // no of funcs listed here
pktgenP_rxup_pkts, // rx_up()
NULL, // rx_down()
pktgenP_tx_done, // tx_done()
pktgenP_shutdown1, // shutdown1()
pktgenP_shutdown2, // shutdown2()
NULL, // dl_advert()
NULL, // devctl()
NULL, // flush()
NULL, // raw_open()
NULL // raw_umount_ok()
};

// functions in pktgen.so that io-net can call
io_net_registrant_funcs_t pktgen_C_funcs =
{
_IO_NET_REG_NFUNCS, // no of funcs listed here
pktgenC_rxup_pkts, // rx_up()
NULL, // rx_down()
pktgenC_tx_done, // tx_done()
pktgenC_shutdown1, // shutdown1()
pktgenC_shutdown2, // shutdown2()
NULL, // dl_advert()
NULL, // devctl()
NULL, // flush()
NULL, // raw_open()
NULL // raw_umount_ok()
};
// a description of our pktgen producer
io_net_registrant_t pktgen_Pen =
{
_REG_PRODUCER_DOWN, // down producer
“pktgen.so”, // our name
NULL, // top type
“pkt”, // bottom type
NULL, // function handle
&pktgen_P_funcs, // our functions
0 // number of dependency
};

// a description of our pktgen convertor
io_net_registrant_t pktgen_Cen =
{
_REG_CONVERTOR, // dummy converter
“pktgen.so”, // our name
“pkt”, // top type
“en”, // bottom type
NULL, // function handle
&pktgen_C_funcs, // our functions
0 // number of dependency
};


/* function call to register producer and converter
static int pktgen_register_device()
{
if ( (*pktgen_ion → reg)(pktgen_dll_hdl,
&pktgen_Pen,
&pktgen_P_reg_hdl,
&pktgen_P_cell,
&pktgen_P_endpt) < 0) {

printf(“failed to register producer\n”);
return (0); //failed
}
if (pktgen_ion->reg_byte_pat(pktgen_P_reg_hdl,NULL,NULL,NULL,_BYTE_PAT_ALL)
< 0) {
printf(“failed to register the subtype to receive for producer\n”);
return(0);
}


if ( (*pktgen_ion → reg)(pktgen_dll_hdl,
&pktgen_Cen,
&pktgen_C_reg_hdl,
&pktgen_C_cell,
&pktgen_C_endpt) < 0) {

printf(“failed to register convertor\n”);
return (0); //failed
}
if (pktgen_ion->reg_byte_pat(pktgen_C_reg_hdl,NULL,NULL,NULL,_BYTE_PAT_ALL)
< 0) {
printf(“failed to register the subtype to receive for convertor\n”);
return(0);
}

return (1); // success

} /* end of function pktgen_register_device() */

tkk <mailbox_cw-any@yahoo.com.sg> wrote:

Is there no way to register both a down producer and converter in a single
.so file? I have no problem registering my down producer but not the
converter. I had do a printf and it always report " cannot register
convertor." The following is part of my code snippet. Someone help please
… thank you…

Yes it’s possible. Whats the errno when the reg fails?

-seanb

// functions in pktgen.so that io-net can call
io_net_registrant_funcs_t pktgen_P_funcs =
{
_IO_NET_REG_NFUNCS, // no of funcs listed here
pktgenP_rxup_pkts, // rx_up()
NULL, // rx_down()
pktgenP_tx_done, // tx_done()
pktgenP_shutdown1, // shutdown1()
pktgenP_shutdown2, // shutdown2()
NULL, // dl_advert()
NULL, // devctl()
NULL, // flush()
NULL, // raw_open()
NULL // raw_umount_ok()
};

// functions in pktgen.so that io-net can call
io_net_registrant_funcs_t pktgen_C_funcs =
{
_IO_NET_REG_NFUNCS, // no of funcs listed here
pktgenC_rxup_pkts, // rx_up()
NULL, // rx_down()
pktgenC_tx_done, // tx_done()
pktgenC_shutdown1, // shutdown1()
pktgenC_shutdown2, // shutdown2()
NULL, // dl_advert()
NULL, // devctl()
NULL, // flush()
NULL, // raw_open()
NULL // raw_umount_ok()
};
// a description of our pktgen producer
io_net_registrant_t pktgen_Pen =
{
_REG_PRODUCER_DOWN, // down producer
“pktgen.so”, // our name
NULL, // top type
“pkt”, // bottom type
NULL, // function handle
&pktgen_P_funcs, // our functions
0 // number of dependency
};

// a description of our pktgen convertor
io_net_registrant_t pktgen_Cen =
{
_REG_CONVERTOR, // dummy converter
“pktgen.so”, // our name
“pkt”, // top type
“en”, // bottom type
NULL, // function handle
&pktgen_C_funcs, // our functions
0 // number of dependency
};



/* function call to register producer and converter
static int pktgen_register_device()
{
if ( (*pktgen_ion → reg)(pktgen_dll_hdl,
&pktgen_Pen,
&pktgen_P_reg_hdl,
&pktgen_P_cell,
&pktgen_P_endpt) < 0) {

printf(“failed to register producer\n”);
return (0); //failed
}
if (pktgen_ion->reg_byte_pat(pktgen_P_reg_hdl,NULL,NULL,NULL,_BYTE_PAT_ALL)
0) {
printf(“failed to register the subtype to receive for producer\n”);
return(0);
}



if ( (*pktgen_ion → reg)(pktgen_dll_hdl,
&pktgen_Cen,
&pktgen_C_reg_hdl,
&pktgen_C_cell,
&pktgen_C_endpt) < 0) {

printf(“failed to register convertor\n”);
return (0); //failed
}
if (pktgen_ion->reg_byte_pat(pktgen_C_reg_hdl,NULL,NULL,NULL,_BYTE_PAT_ALL)
0) {
printf(“failed to register the subtype to receive for convertor\n”);
return(0);
}

return (1); // success

} /* end of function pktgen_register_device() */

Sean Boudreau <seanb@qnx.com> wrote:

tkk <> mailbox_cw-any@yahoo.com.sg> > wrote:
Is there no way to register both a down producer and converter in a single
.so file? I have no problem registering my down producer but not the
converter. I had do a printf and it always report " cannot register
convertor." The following is part of my code snippet. Someone help please
… thank you…

Yes it’s possible. Whats the errno when the reg fails?

It’s probably EINVAL: a converter needs both
rx_up() and rx_down() specified.

-seanb


// functions in pktgen.so that io-net can call
io_net_registrant_funcs_t pktgen_P_funcs =
{
_IO_NET_REG_NFUNCS, // no of funcs listed here
pktgenP_rxup_pkts, // rx_up()
NULL, // rx_down()
pktgenP_tx_done, // tx_done()
pktgenP_shutdown1, // shutdown1()
pktgenP_shutdown2, // shutdown2()
NULL, // dl_advert()
NULL, // devctl()
NULL, // flush()
NULL, // raw_open()
NULL // raw_umount_ok()
};

// functions in pktgen.so that io-net can call
io_net_registrant_funcs_t pktgen_C_funcs =
{
_IO_NET_REG_NFUNCS, // no of funcs listed here
pktgenC_rxup_pkts, // rx_up()
NULL, // rx_down()
pktgenC_tx_done, // tx_done()
pktgenC_shutdown1, // shutdown1()
pktgenC_shutdown2, // shutdown2()
NULL, // dl_advert()
NULL, // devctl()
NULL, // flush()
NULL, // raw_open()
NULL // raw_umount_ok()
};
// a description of our pktgen producer
io_net_registrant_t pktgen_Pen =
{
_REG_PRODUCER_DOWN, // down producer
“pktgen.so”, // our name
NULL, // top type
“pkt”, // bottom type
NULL, // function handle
&pktgen_P_funcs, // our functions
0 // number of dependency
};

// a description of our pktgen convertor
io_net_registrant_t pktgen_Cen =
{
_REG_CONVERTOR, // dummy converter
“pktgen.so”, // our name
“pkt”, // top type
“en”, // bottom type
NULL, // function handle
&pktgen_C_funcs, // our functions
0 // number of dependency
};



/* function call to register producer and converter
static int pktgen_register_device()
{
if ( (*pktgen_ion → reg)(pktgen_dll_hdl,
&pktgen_Pen,
&pktgen_P_reg_hdl,
&pktgen_P_cell,
&pktgen_P_endpt) < 0) {

printf(“failed to register producer\n”);
return (0); //failed
}
if (pktgen_ion->reg_byte_pat(pktgen_P_reg_hdl,NULL,NULL,NULL,_BYTE_PAT_ALL)
0) {
printf(“failed to register the subtype to receive for producer\n”);
return(0);
}



if ( (*pktgen_ion → reg)(pktgen_dll_hdl,
&pktgen_Cen,
&pktgen_C_reg_hdl,
&pktgen_C_cell,
&pktgen_C_endpt) < 0) {

printf(“failed to register convertor\n”);
return (0); //failed
}
if (pktgen_ion->reg_byte_pat(pktgen_C_reg_hdl,NULL,NULL,NULL,_BYTE_PAT_ALL)
0) {
printf(“failed to register the subtype to receive for convertor\n”);
return(0);
}

return (1); // success

} /* end of function pktgen_register_device() */

Yes you are correct. The convertor can be registered when I specify a dummy
rx_down() function for the convertor. For your information, the error
message I got was : invalid argument
The network ddk never mention about this.
Thanks sean, you are great.


“Sean Boudreau” <seanb@qnx.com> wrote in message
news:cfqatd$djg$1@inn.qnx.com

Sean Boudreau <> seanb@qnx.com> > wrote:
tkk <> mailbox_cw-any@yahoo.com.sg> > wrote:
Is there no way to register both a down producer and converter in a
single
.so file? I have no problem registering my down producer but not the
converter. I had do a printf and it always report " cannot register
convertor." The following is part of my code snippet. Someone help
please
… thank you…

Yes it’s possible. Whats the errno when the reg fails?


It’s probably EINVAL: a converter needs both
rx_up() and rx_down() specified.

-seanb


// functions in pktgen.so that io-net can call
io_net_registrant_funcs_t pktgen_P_funcs =
{
_IO_NET_REG_NFUNCS, // no of funcs listed here
pktgenP_rxup_pkts, // rx_up()
NULL, // rx_down()
pktgenP_tx_done, // tx_done()
pktgenP_shutdown1, // shutdown1()
pktgenP_shutdown2, // shutdown2()
NULL, // dl_advert()
NULL, // devctl()
NULL, // flush()
NULL, // raw_open()
NULL // raw_umount_ok()
};

// functions in pktgen.so that io-net can call
io_net_registrant_funcs_t pktgen_C_funcs =
{
_IO_NET_REG_NFUNCS, // no of funcs listed here
pktgenC_rxup_pkts, // rx_up()
NULL, // rx_down()
pktgenC_tx_done, // tx_done()
pktgenC_shutdown1, // shutdown1()
pktgenC_shutdown2, // shutdown2()
NULL, // dl_advert()
NULL, // devctl()
NULL, // flush()
NULL, // raw_open()
NULL // raw_umount_ok()
};
// a description of our pktgen producer
io_net_registrant_t pktgen_Pen =
{
_REG_PRODUCER_DOWN, // down producer
“pktgen.so”, // our name
NULL, // top type
“pkt”, // bottom type
NULL, // function handle
&pktgen_P_funcs, // our functions
0 // number of dependency
};

// a description of our pktgen convertor
io_net_registrant_t pktgen_Cen =
{
_REG_CONVERTOR, // dummy converter
“pktgen.so”, // our name
“pkt”, // top type
“en”, // bottom type
NULL, // function handle
&pktgen_C_funcs, // our functions
0 // number of dependency
};


/* function call to register producer and converter
static int pktgen_register_device()
{
if ( (*pktgen_ion → reg)(pktgen_dll_hdl,
&pktgen_Pen,
&pktgen_P_reg_hdl,
&pktgen_P_cell,
&pktgen_P_endpt) < 0) {

printf(“failed to register producer\n”);
return (0); //failed
}
if
(pktgen_ion->reg_byte_pat(pktgen_P_reg_hdl,NULL,NULL,NULL,_BYTE_PAT_ALL)
0) {
printf(“failed to register the subtype to receive for producer\n”);
return(0);
}


if ( (*pktgen_ion → reg)(pktgen_dll_hdl,
&pktgen_Cen,
&pktgen_C_reg_hdl,
&pktgen_C_cell,
&pktgen_C_endpt) < 0) {

printf(“failed to register convertor\n”);
return (0); //failed
}
if
(pktgen_ion->reg_byte_pat(pktgen_C_reg_hdl,NULL,NULL,NULL,_BYTE_PAT_ALL)
0) {
printf(“failed to register the subtype to receive for convertor\n”);
return(0);
}

return (1); // success

} /* end of function pktgen_register_device() */