QNET giving "Endian not supported" between X86 and PPC?

I’ve just managed to get QNX running on an embedded PPC and
have got the network working.

So, great, I can use QNX to RUN programs on the PPC box
from the directories on the PC where the programs are
compiled.

Not quite.

Trying to “ls /net/xxx” from the PC (“qnx1”) to the PPC
(“rocket”) (or vice versa) consistently gives:

/net$ ls
qnx1 rocket
/net$ ls rocket
ls: Endian not supported (rocket)
/net$

That’s the “perror()” result for “EENDIAN”.

Is there some special trick to getting QNET running between
opposite-endian CPUs?

I can’t find anything in the Help Viewer or on QDN on this.

Tom Evans
InitialSurnameAt
tennyson.com.au

Operating System Tech Support wrote:

“Tom Evans” <> tom@nospam.invalid> > wrote in message
news:> 3BF8BECA.7B91@nospam.invalid> …
I’ve just managed to get QNX running on an embedded PPC and
have got the network working.

So, great, I can use QNX to RUN programs on the PPC box
from the directories on the PC where the programs are
compiled.

No you can’t run programs cross-endian at this time. Tools such as rcp or
telnet can be used to access cross-endian platforms.

That’s a problem. We were banking on being run QNX on hardware that
doesn’t have any local filesystem, and to run code using QNX.

Telnet, FTP and friends do not provide anything like the transparent
functionality of QNET. QNET is (was) a major useful feature of QNX.

When will this functionality be supported?

Also please DOCUMENT this unexpected limitation! Put something into the
Knowledge Base on this. Could you also make your QDN newsgroups
searchable so previous answers can be found?

Tom Evans
InitialSurnameAt
tennyson.com.au

“Tom Evans” <tom@nospam.invalid> wrote in message
news:3BF8BECA.7B91@nospam.invalid

I’ve just managed to get QNX running on an embedded PPC and
have got the network working.

So, great, I can use QNX to RUN programs on the PPC box
from the directories on the PC where the programs are
compiled.

No you can’t run programs cross-endian at this time. Tools such as rcp or
telnet can be used to access cross-endian platforms.

-Adam

Tom Evans <tom@nospam.invalid> wrote:

Operating System Tech Support wrote:
“Tom Evans” <> tom@nospam.invalid> > wrote in message
news:> 3BF8BECA.7B91@nospam.invalid> …
I’ve just managed to get QNX running on an embedded PPC and
have got the network working.

So, great, I can use QNX to RUN programs on the PPC box
from the directories on the PC where the programs are
compiled.

No you can’t run programs cross-endian at this time. Tools such as rcp or
telnet can be used to access cross-endian platforms.

That’s a problem. We were banking on being run QNX on hardware that
doesn’t have any local filesystem, and to run code using QNX.

So what you need is a big endian server. There is nothing wrong with
using a PPC as a server which is getting its files NFS mounted from
a PC/Windows/Solaris etc.

Telnet, FTP and friends do not provide anything like the transparent
functionality of QNET. QNET is (was) a major useful feature of QNX.

When will this functionality be supported?

There is a lot more to cross endian transparency. The resource manager
framework is geared up to be able to support “decoding” of standard
message headers and the like, but servers also have to be set up to
be able to handle this. For example all of the devctl()'s that
a custom resource manager (or one of our own) receive … should we
swap all of the data even if we don’t use all of it? How do we
know about user structures and how they are packed? What about
the data contained within the messages?

When we provide the support (and we will) we hope to provide a
set of helper functions which can be used to make most of this work
transparent to the programmers. For now most customers mixing
processors have been doing so in an endian homogenous manner, so
we have been concentrating on other areas of improvement. NFS
has served well to bridge the gap when file access has been
required.

Also please DOCUMENT this unexpected limitation! Put something into the
Knowledge Base on this. Could you also make your QDN newsgroups
searchable so previous answers can be found?

You are absolutely correct, this should be documented. It
is not in the SysArch guide, because that book is a long
range “directional” book which provides overview of the
technology. I’m surprised that the issue has not already been
added to a QDN entry however.

Thomas

Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Core OS Technology Group
(613)-591-0931 http://www.qnx.com/

thomasf@qnx.com wrote:

Tom Evans <> tom@nospam.invalid> > wrote:
Operating System Tech Support wrote:
“Tom Evans” <> tom@nospam.invalid> > wrote in message
news:> 3BF8BECA.7B91@nospam.invalid> …
So, great, I can use QNX to RUN programs on the PPC box
from the directories on the PC where the programs are
compiled.

No you can’t run programs cross-endian at this time.

That’s a problem. We were banking on being run QNX on
hardware that doesn’t have any local filesystem, and
to run code using QNX.

So what you need is a big endian server.

Like a Macintosh? Does QNX run on these? We don’t want to
have to BUILD our own file servers and then port QNX
to them.

When will this functionality be supported?

There is a lot more to cross endian transparency. The
resource manager framework is geared up to be able to
support “decoding” of standard message headers and
the like, but servers also have to be set up to
be able to handle this. For example all of the
devctl()'s that a custom resource manager (or one
of our own) receive … should we swap all of the
data even if we don’t use all of it? How do we
know about user structures and how they are
packed? What about the data contained within
the messages?

I can’t see that this is a problem. Yes, I know that
it always takes at least a month to beat the message into
“new hires” that endian issues ARE a REAL PROBLEM that
can’t be solved with either simplistic software or
hardware hacks (PCI byte-lane swappers notwithstanding),
and I’ve been there and done that plenty of times.

And the answer is - all user data in messages MUST
ALWAYS be in the SAME ORDER. Preferably in standard
“network order” which is unfortunately the opposite
of what Intel came up with in the 8080 all those
years ago.

Network programmers have had to deal with this
ever since the early 80’s (and all network
programming in QNX has to as well), so why
should using messages with Neutrino be any
different? Except, I guess, for the all the
existing code that was written under the
assumption that QNX only ran on X86s.

When we provide the support (and we will) we
hope to provide a set of helper functions which

Whatever you do, please don’t consider using ASN1
or XML. XDR is a possible solution, but it (and
any other general solution) probably involves
registering full structure descriptions for
EVERY message type, right? Not exactly
backwards-compatible.

Could you at least get QNET FILE operations working
I don’t care if /net/whatever/dev doesn’t work,
as long as that keeps giving EENDIAN and I can
read plain files.

Thanks,

Tom Evans
InitialSurnameAt
tennyson.com.au

Tom Evans <tom@nospam.invalid> wrote:

thomasf@qnx.com > wrote:

[snip]

There is a lot more to cross endian transparency. The
resource manager framework is geared up to be able to
support “decoding” of standard message headers and
the like, but servers also have to be set up to
be able to handle this. For example all of the
devctl()'s that a custom resource manager (or one
of our own) receive … should we swap all of the
data even if we don’t use all of it? How do we
know about user structures and how they are
packed? What about the data contained within
the messages?

I can’t see that this is a problem. Yes, I know that
it always takes at least a month to beat the message into
“new hires” that endian issues ARE a REAL PROBLEM that
can’t be solved with either simplistic software or
hardware hacks (PCI byte-lane swappers notwithstanding),
and I’ve been there and done that plenty of times.

And the answer is - all user data in messages MUST
ALWAYS be in the SAME ORDER. Preferably in standard
“network order” which is unfortunately the opposite
of what Intel came up with in the 8080 all those
years ago.

Network programmers have had to deal with this
ever since the early 80’s (and all network
programming in QNX has to as well), so why
should using messages with Neutrino be any
different? Except, I guess, for the all the
existing code that was written under the
assumption that QNX only ran on X86s.

You didn’t really get it, do you?

Suppose a user applicaiton defined:

struct {
int a;
short b;
short c;
} mydata;

And then did:

MsgSend(coid, &mydata, sizeof(mydata), 0, 0);

Who do you think should do all the “htonl()”, “htons()”
operation?

Of cause it won’t be kernel or QNET or library, cause
neither of them have knowladge of “mydata”.

The only person could do that is the apllication itself.
So it have to do sth like:

mydata.a = htonl(mydata.a);
mydata.b = htons(mydata.b);
mydata.c = htons(mydata.c);
MsgSend(coid, &mydata, sizeof(mydata), 0, 0);

OK, this will work, but, what if the server he’s talking
to is on same node? There is totaly time waste to convert
them before send, and the server have to convert it back
after receive.

Oh, yeah, then only do the hton[ls] if application is send
over network. Sorry, the design base of QNET is the application
WILL NOT aware of networking, so “cat local” or “cat /net/remote/file”
will work the same way. You don’t really want a “cat” and
a “netcat” do you?

-xtang

Xiaodan Tang wrote:

Tom Evans <> tom@nospam.invalid> > wrote:
thomasf@qnx.com > wrote:

[snip]

And the answer is - all user data in messages MUST
ALWAYS be in the SAME ORDER. Preferably in standard
“network order” which is unfortunately the opposite
of what Intel came up with in the 8080 all those
years ago.

Network programmers have had to deal with this
ever since the early 80’s (and all network
programming in QNX has to as well), so why
should using messages with Neutrino be any
different? Except, I guess, for the all the
existing code that was written under the
assumption that QNX only ran on X86s.

You didn’t really get it, do you?

I think I did and do. I can’t think of a
SIMPLE solution. I was hoping you knew of one.

Suppose a user application defined:

struct {
int a;
short b;
short c;
} mydata;

And then did:

MsgSend(void, &mydata, sizeof(mydata), 0, 0);

Who do you think should do all the “htonl()”, “htons()”
operation?

Of cause it won’t be kernel or QNET or library, cause
neither of them have knowledge of “mydata”.

The only person could do that is the application itself.
So it have to do (stuff) like:

mydata.a = htonl(mydata.a);
mydata.b = htons(mydata.b);
mydata.c = htons(mydata.c);
MsgSend(coid, &mydata, sizeof(mydata), 0, 0);

You seem to be agreeing with me. And so the problem
with this is…?

OK, this will work, but, what if the server he’s talking
to is on same node? There is totaly time waste to convert
them before send, and the server have to convert it back
after receive.

So? Traditional network programming (which often runs to
a server on the same host) has been doing the above since
the early 80’s. Of course on the “right” CPUs there is no
overhead of inserting the “ntohx()” MACROs at all. The x86
isn’t the “right” CPU, but it is 99.99% of QNX, right?

QNX programmers haven’t had to do any “network aware
programming”, haven’t done this and so it isn’t realistic
or even possible to require all QNX code to change, just
to support embedded PPCs.

Can’t happen. Won’t happen. That’s a more powerful
“reason” than some minor inefficiency in execution times.

Oh, yeah, then only do the hton[ls] if application is send
over network. Sorry, the design base of QNET is the application
WILL NOT aware of networking, so “cat local” or
“cat /net/remote/file” will work the same way. You don’t
really want a “cat” and a “netcat” do you?

No. I’d just like it to work somehow. It doesn’t at the moment.

Does QSSL have ANY proposed solution to the above, or are
the PPC and all other big-endian CPUs going to be permanent
“poor cousins” in the QNX World?

If a PPC can’t receive ANY messages from a USER
Application running on an x86 then what’s the point
of QNX Messages and what’s the current use of
running QNX on a PPC? Better to pick ARM-LE,
MIPS-LE or SH-LE if possible.

Is this true? That there’s no way to send ANY
QNX messages between QNX x86s and PPCs?

I can only think of three solutions:

  • All user code has to htonx() EVERYTHING, including
    all opens, reads, writes, ioctls - UNACCEPTABLE.

  • All user code has to “register” all its network
    data structures with the OS in an XDR-style
    representation so the OS can convert when required.
    Wouldn’t that be fun?

  • Don’t run QNX on big-endian CPUs.

Here’s a small proposal that would get SOME functionality.

Could QSSL write a small driver that registers as (say)
“/dev/fs_4_ppc” which performs the endian conversions
for the common file operations to support fs-qnx4,
fs-dos and fs-pkg ONLY, so that from a PPC I can read
files in /net/pc/home/tevans" as
“/net/pc/dev/fs_4_ppc/home/tevans”?

Tom Evans
InitialSurnameAt
tennyson.com.au

Tom Evans <tom@nospam.invalid> wrote:

[Comments snipped]

No. I’d just like it to work somehow. It doesn’t at the moment.

Does QSSL have ANY proposed solution to the above, or are
the PPC and all other big-endian CPUs going to be permanent
“poor cousins” in the QNX World?

As I mentioned before Tom, we will at some point be going
through and providing a transparent mechanism at the
resource manager level to do the endian translation. For
now the limitation is that machines can only use native
networking if their endians match. In my eyes this does
not make PPC (or all other big endian machines) poor
cousins to the x86. Indeed we have at least one major
customer using MIPS->PPC qnet currently. There is very
little limitation on the drivers etc that you can use on
big endian machines, so as I mentioned before it is possible
to have a PPC server which retrieves its file using NFS
from another node (or provides them to the other node) when
endian boundaries must be crossed.

This is the solution for now.

If a PPC can’t receive ANY messages from a USER
Application running on an x86 then what’s the point
of QNX Messages and what’s the current use of
running QNX on a PPC? Better to pick ARM-LE,
MIPS-LE or SH-LE if possible.

Indeed if you must absolutely incorporate x86 into
your design (which many customers don’t feel the
need to do) and you want native messaging, then
for now you will have to stay little endian.

[Small proposal snipped]

It is an interesting idea, but the work would be better
spent in the resource manager library where we can do
a high level conversion and let the servers manager the
content of the data. It is just a matter of writing the
translators for all of the <sys/iomsg.h> common structures.

Thomas

Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Core OS Technology Group
(613)-591-0931 http://www.qnx.com/

thomasf@qnx.com wrote:

Tom Evans <> tom@nospam.invalid> > wrote:
[Comments snipped]
For now the limitation is that machines can only use native
networking if their endians match.

Does that mean the “preferred development workstation”
(that supports splitting the code between the deeply
embedded hardware and the workstation during code
development as shown below) for PPCs is
Sun/SPARC/Solaris?

Indeed we have at least one major customer using
MIPS->PPC qnet currently.

That would have to be MIBSBE. Understood.

so as I mentioned before it is possible
to have a PPC server which retrieves its file using NFS
from another node (or provides them to the other node) when
endian boundaries must be crossed.

This is the solution for now.

I’ll ask our local rep to ask for estimates of when this
might be available. I wish you luck.

Indeed if you must absolutely incorporate x86 into
your design (which many customers don’t feel the
need to do) and you want native messaging, then
for now you will have to stay little endian.

The whole point was to support a development environment
that allows the following WITHOUT having to buy a
comparatively (to a PC) very expensive Sun workstation:
The x86 isn’t for putting in the product mix, it’s the
standard development workstation.

Assuming PC development host “pc” and embedded device “embed”.

Assume a simple driver “test” that provides interface
“/dev/t” and uses interface “/dev/hw” that is being
worked on.

Embed

| ------------- |
| | Modules | |
| --------±— |
| | |
| /dev/t | |
| --------±— |
| | test | |
| --------±— |
| | |
| /dev/hw | |
| --------±— |
| | Module HW | |

-------------

Eventually this driver is to run on “embed” (as above),
but we would prefer to run in on “pc” in order to
make debugging simpler. It also provides all the
“traditional” debug features (printing to the console.
logging to files, reading configuration and debug
configuration from files and so on).

Embed

| ------------- | PC
| | Modules | | -----------------
| ------±----- | | /dev/t |
| ±---------------------+ | Log Files
| /dev/t | Q | | t | Config Files
| | N | ------±----- | Photon Display
| | E | | test | | Debug Input
| /dev/hw | T | ------±----- | Etc. etc.
| ±---------------------+ |
| | hw | | /dev/hw |
| ------±----- | -----------------
| | Module X | |

-------------

During development it is run on “pc” with the following two
commands entered to make it work:

On the PC, make “hw” on “embed” appear locally:

ln -s /net/embed/dev/hw /dev/hw

On “embed”, make “t” on “pc” appear locally:

ln -s /net/pc/dev/t /dev/t

Is there a “cleaner and more standard” way to make modules
work across different machines, or is putting symbolic
links between “/net//dev/” and “/dev/*” the usual method?

Can you suggest a way to achieve something like the above debugging
simplicity between PC development hosts and (deeply embedded, no disk or
FLASH file system) PPCs?

Tom Evans
InitialSurnameAt
tennyson.com.au

Tom Evans <tom@nospam.invalid> wrote:

thomasf@qnx.com > wrote:
Tom Evans <> tom@nospam.invalid> > wrote:
[Comments snipped]
For now the limitation is that machines can only use native
networking if their endians match.

Does that mean the “preferred development workstation”
(that supports splitting the code between the deeply
embedded hardware and the workstation during code
development as shown below) for PPCs is
Sun/SPARC/Solaris?

No, not in the sense that you describe, only because we
don’t support a native port of QNX6 on these systems. If
you want to use Solaris to build as a development machine
we won’t stop you =;-).

The whole point was to support a development environment
that allows the following WITHOUT having to buy a
comparatively (to a PC) very expensive Sun workstation:
The x86 isn’t for putting in the product mix, it’s the
standard development workstation.

Assuming PC development host “pc” and embedded device “embed”.

[ Snipped diagram of development of a driver natively ]

Can you suggest a way to achieve something like the above debugging
simplicity between PC development hosts and (deeply embedded, no disk or
FLASH file system) PPCs?

Unfortunately to accomplish exactly what you want right
now is not possible. The closest thing would be to use
an NFS mount for file logging to the PC and then use our
remote debug agent (pdebug) operating on the PPC sending
back to the x86 and debug your system that way.

What you have illustrated is definitely a point that we
want to get to … but it is not available to you today.

Thomas

Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Core OS Technology Group
(613)-591-0931 http://www.qnx.com/