Operating System - HP-UX
1753500 Members
3650 Online
108794 Solutions
New Discussion юеВ

Re: DLPI Programmer's Guide Question

 
Philip A. Reyniers
Occasional Advisor

DLPI Programmer's Guide Question

Hello To All,

I am working with the "DLPI Programmer's Guide HP-UX 11i v2" ioctl example program and have a few questions. Please note, that I have examined both the sys/dlpi.h and sys/dlph_ext.h for the structures mentioned below and they do not exist in my files. The link to the source documentation is listed below:

http://docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90809/B2355-90809_top.html&con=/hpux/onlinedocs/B2355-90809/00/00/25-con.html&toc=/hpux/onlinedocs/B2355-90809/00/00/25-toc.html&searchterms=duplex%7cioctl&queryid=20040130-100605

Question 1: The guide describes the DL_HP_GET_DRV_PARAM_IOCTL and DL_HP_SET_DRV_PARAM_IOCTL definitions but never defines how these IOCTL calls should be defined. What are the correct definitions for these calls?

Question 2: The guide describes the DL_HP_DRV_MTU and DL_HP_SERIALIZE definitions but never details how they should be defined. What are the correct definitions for these calls?

What I have put together so far is listed below but, note I still am not able to get this to compile correctly.

#include
#include
#include
#include
#include
#include

typedef struct dl_hp_get_drv_param_ioctl {
dl_hp_drv_param_req_type_t dl_request;
uint32_t dl_speed;
dl_hp_duplex_mode_t dl_duplex;
dl_hp_autoneg_sense_t dl_autoneg;
uint32_t dl_mtu;
uint64_t dl_value1;
uint64_t dl_value2;
uint64_t dl_value3;
uint32_t dl_reserved1[2];
uint32_t dl_reserved2[2];
} dl_hp_get_drv_param_ioctl_t;

typedef enum dl_hp_drv_param_req_type {
DL_HP_DRV_SPEED = 0x1, // dl_speed value is valid.
DL_HP_DRV_DUPLEX = 0x2, // dl_duplex value is valid.
DL_HP_DRV_AUTONEG = 0x4, // dl_autoneg value is valid.
DL_HP_DRV_MTU = 0x8, // dl_mtu value is valid.
DL_HP_DRV_RESET_MTU = 0x10, // Resets the MTU.
DL_HP_VALUE1 = 0x20, // dl_value1 is valid.
DL_HP_VALUE2 = 0x40, // dl_value2 is valid.
DL_HP_VALUE3 = 0x80, // dl_value3 is valid.
DL_HP_RESERVED1 = 0x100, // dl_reserved1[0] is valid.
DL_HP_RESERVED2 = 0x200, // dl_reserved1[1] is valid.
DL_HP_RESERVED3 = 0x400, // DL_HP_RESERVED3 is reserved by DLPI.
DL_HP_RESERVED4 = 0x800, // DL_HP_RESERVED4 is reserved by DLPI.
DL_HP_SERIALIZE = 0x40000000 // Requests DLPI to serialize the request.
} dl_hp_drv_param_req_type_t;

//////////////////////////////////////////////////////////////////////
// dl_hp_duplex_mode_t Enumeration Constant Value //
//////////////////////////////////////////////////////////////////////
typedef enum dl_hp_duplex_mode {
DL_HP_HALF_DUPLEX = 0x1,
DL_HP_FULL_DUPLEX =0x2
} dl_hp_duplex_mode_t;

//////////////////////////////////////////////////////////////////////
// dl_hp_autoneg_sense_t Enumeration Constant Value //
//////////////////////////////////////////////////////////////////////
typedef enum dl_hp_autoneg_sense {
DL_HP_AUTONEG_SENSE_ON = 0x1,
DL_HP_AUTONEG_SENSE_OFF = 0x2
} dl_hp_autoneg_sense_t;

#define AREA_SIZE 1000 /* Area size */
char buf_ctl[AREA_SIZE]; /* for control messages */

struct strbuf ctlbuf = {
AREA_SIZE, /* maxlen = AREA_SIZE */
0, /* len gets filled in for each message */
buf_ctl /* buf = control area */
};

... REST OF UNMODIFIED CODE FROM SAMPLE PROGRAM HERE ...

Question 3: Do I have this correct so far and what are the pieces that are missing?


Thanks in Advance,

Phil.
If it is not broken leave it alone, if you have time try to improve it, and if you do not care then get another job.
4 REPLIES 4
Hemanth Gurunath Basrur
Honored Contributor

Re: DLPI Programmer's Guide Question

Hello Philip,

Thanks for your using this document and giving your valuable feedback. I shall pass your query to the DLPI documentation team. You will hear from them shortly.

Thanks for your patience.

Regards,
Hemanth
Akash Dubey
Occasional Contributor

Re: DLPI Programmer's Guide Question

Hello Phil,

Thanks a lot for using the DLPI Programmer's Guide and providing valuable feedback!

I visited the link of the document you are referring to, and I found that the document includes the pertinent information.

Could you please elaborate on "What are the correct definitions for these calls?"

Please note that you should use these calls between drivers and driver-specific applications, not in any general application. It may not work if the application does not know how the driver works.

If you want to use the specified IOCTLs, make sure to use dlpi_ext.h in your program.

We'll surely provide more specific and accurate answer after we hear from you.

Thanks again for your feedback! This will definitely help us address the requirements of our users.

Best regards,
Akash
Philip A. Reyniers
Occasional Advisor

Re: DLPI Programmer's Guide Question

The first thing that I am trying to accomplish is to get the ioctl program to compile and run. If one explores the sys/dlpi.h and sys/dlpi_ext.h file the structures used in the example program DO NOT exist in the 11.11/11.00 relase of these files. I have gone back and looked an many revision of the HPUX OS and in those cases the structures also do not exist. With that said, the dlpi programmers guide does not clearly indicate how ALL the structures, typedefs, enums, and defines should/are be constructed, the source example just leaves that part out thus, leaving a developer to beleive that they are suppose to be in the include files.

Here is what I would like to accomplish. First produce a working example of the ioctl routine that is just suppose to display the MTU. Like the example indicates. Secondly, expand the example to facilitate getting the other components like DL_HP_DRV_SPEED, DL_HP_DRV_DUPLEX, and DL_HP_DRV_AUTONEG.

It sould be simple and I feel that the example should compile usinng HP's softbench (i.e. aCC) but important pieces are missing. This is why I posted what I think the document is indicating when the structs, typedefs, enums, and defines are discussed. I have no real idea because I do not have any of the mentioned data structures and defines in my dlpi.h and dlpi_ext.h.

In short, I need a real working example that allows me to obtain the information that I am seeking in this message post.

Thanks in advance for any and all assistance,

Phil.
If it is not broken leave it alone, if you have time try to improve it, and if you do not care then get another job.
Akash Dubey
Occasional Contributor

Re: DLPI Programmer's Guide Question

Hello Phil,

As we were facing network problems, we couldn't respond to your query earlier. We apologize for the delay.

I think you are referring to the 11.23 DLPI programmer's guide and trying to compile a program for 11.11/11.00 with new (11.23) IOCTLs, which are not a part of these releases.

You'll not be able to accomplish the specified task, as we do not export IOCTLs to set/get driver parameters in 11.00/11.11.

Hope this answers your question. If you need any other information, do let us know.

Best regards,
Akash