* [PATCH] another for ibm_ocp_enet gzip'd
@ 2002-03-15 19:41 andrew may
2002-03-15 20:05 ` Tom Rini
2002-03-15 20:06 ` Tom Rini
0 siblings, 2 replies; 11+ messages in thread
From: andrew may @ 2002-03-15 19:41 UTC (permalink / raw)
To: linuxppc-embedded; +Cc: Armin
[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]
This patch includes the last patch that I sent before the
directory move, plus some more stuff.
1. Fix merge error with MAX_NUM_PHYS in find phy loop.
(the for loop condition should match the if check)
2. Fix bad Partner Link check for the added Phy.
3. added mal.sh to generate a new ibm_ocp_mal.c
mal.sh DCRN_MAL_BASE >ibm_ocp_mal.c
or mal.sh DCRN_MAL_BASE DCRN_MAL1_BASE >ibm_ocp_mal.c
will work. It seems that the second on generates a smaller
object file even though the code is bigger for the 405GP.
I would think it is because MAL1 is 0.
This condenses all the get/set mal calls into one for get
and one for set. I also changed mal_num to mal, just to help
me find/change things.
I think this is a better approach than what was in the _mal.c,
but I didn't change the makefile to generate the code on the
fly yet.
4. Added skb_res as a module param and config.in option.
5. Created rx_clean/fill functions to remove duplicate code
in open and the 2 rx interrupts.
6. Handle dev_alloc failures better by retrying to alloc before
the rxde interrupt.
[-- Attachment #2: ocp_enet.diff.gz --]
[-- Type: application/octet-stream, Size: 9410 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-15 19:41 [PATCH] another for ibm_ocp_enet gzip'd andrew may
@ 2002-03-15 20:05 ` Tom Rini
2002-03-15 22:25 ` andrew may
2002-03-15 20:06 ` Tom Rini
1 sibling, 1 reply; 11+ messages in thread
From: Tom Rini @ 2002-03-15 20:05 UTC (permalink / raw)
To: andrew may; +Cc: linuxppc-embedded, Armin
On Fri, Mar 15, 2002 at 11:41:37AM -0800, andrew may wrote:
> 3. added mal.sh to generate a new ibm_ocp_mal.c
> mal.sh DCRN_MAL_BASE >ibm_ocp_mal.c
> or mal.sh DCRN_MAL_BASE DCRN_MAL1_BASE >ibm_ocp_mal.c
> will work. It seems that the second on generates a smaller
> object file even though the code is bigger for the 405GP.
> I would think it is because MAL1 is 0.
> This condenses all the get/set mal calls into one for get
> and one for set. I also changed mal_num to mal, just to help
> me find/change things.
>
> I think this is a better approach than what was in the _mal.c,
> but I didn't change the makefile to generate the code on the
> fly yet.
This looks very cool. Can you add in some comments to the shell script,
and I didn't see any bashisms in there, can you verify it works with
pdksh or one of the other script shells which can be /bin/sh ?
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-15 19:41 [PATCH] another for ibm_ocp_enet gzip'd andrew may
2002-03-15 20:05 ` Tom Rini
@ 2002-03-15 20:06 ` Tom Rini
1 sibling, 0 replies; 11+ messages in thread
From: Tom Rini @ 2002-03-15 20:06 UTC (permalink / raw)
To: andrew may; +Cc: linuxppc-embedded, Armin
On Fri, Mar 15, 2002 at 11:41:37AM -0800, andrew may wrote:
> 4. Added skb_res as a module param and config.in option.
Can you add a Configure.help entry for this as well? Thanks.
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-15 20:05 ` Tom Rini
@ 2002-03-15 22:25 ` andrew may
2002-03-15 22:31 ` Tom Rini
0 siblings, 1 reply; 11+ messages in thread
From: andrew may @ 2002-03-15 22:25 UTC (permalink / raw)
To: Tom Rini; +Cc: andrew may, linuxppc-embedded, Armin
[-- Attachment #1: Type: text/plain, Size: 785 bytes --]
On Fri, Mar 15, 2002 at 01:05:58PM -0700, Tom Rini wrote:
> On Fri, Mar 15, 2002 at 11:41:37AM -0800, andrew may wrote:
>
> > 3. added mal.sh to generate a new ibm_ocp_mal.c
>
> This looks very cool. Can you add in some comments to the shell script,
> and I didn't see any bashisms in there, can you verify it works with
> pdksh or one of the other script shells which can be /bin/sh ?
I am not sure how I can check against other shells since I don't
have them on my machine. Is sh --posix good enough?
Here is a patch to mal.sh with some more comments, taking an
arg of the Mal count, and some spacing fixups.
Am taking a day off my work, work so I am not around the code
to do a patch for the Config.help, but I will include the text
I would like there. It may be a bit verbose.
[-- Attachment #2: mal.sh.diff --]
[-- Type: text/plain, Size: 3626 bytes --]
--- mal.sh.old Fri Mar 15 14:10:53 2002
+++ mal.sh Fri Mar 15 14:16:17 2002
@@ -1,25 +1,70 @@
#!/bin/sh
+#
+# We want one arg with the number of MALs to support.
+# The first is just MAL_BASE and the second is called
+# MAL1_BASE and so on. If we don't get just one arg
+# we default to 1 MAL.
+#
+# It would be nice to grep these out of a header, but
+# I don't think we can tell which header we need to
+# grep without going through the defines with a pre-compile.
+
+# The c-comments below describe why we need to generate
+# this code.
+
+BASES="DCRN_MAL_BASE"
+if [ $# -ne 1 ] ; then
+ END=1
+else
+ END=$1
+fi
+
+I=1
+while [ $I -lt $END ] ; do
+ BASES="$BASES DCRN_MAL${I}_BASE"
+ I=$((I+1))
+done
+
+DCRNS="DCRN_MALCR \
+ DCRN_MALDBR \
+ DCRN_MALESR \
+ DCRN_MALIER \
+ DCRN_MALTXCARR \
+ DCRN_MALTXCASR \
+ DCRN_MALTXDEIR \
+ DCRN_MALTXEOBISR \
+ DCRN_MALRXCARR \
+ DCRN_MALRXCASR \
+ DCRN_MALRXDEIR \
+ DCRN_MALRXEOBISR \
+ DCRN_MALRXCTP0R \
+ DCRN_MALTXCTP0R \
+ DCRN_MALTXCTP1R \
+ DCRN_MALRCBS0 "
-DCRNS=" DCRN_MALCR \
- DCRN_MALDBR \
- DCRN_MALESR \
- DCRN_MALIER \
- DCRN_MALTXCARR \
- DCRN_MALTXCASR \
- DCRN_MALTXDEIR \
- DCRN_MALTXEOBISR \
- DCRN_MALRXCARR \
- DCRN_MALRXCASR \
- DCRN_MALRXDEIR \
- DCRN_MALRXEOBISR \
- DCRN_MALRXCTP0R \
- DCRN_MALTXCTP0R \
- DCRN_MALTXCTP1R \
- DCRN_MALRCBS0 "
echo '#include <linux/config.h>'
echo '#include <asm/ibm4xx.h>'
echo
-echo '/* Dynamically generated code-DONNOT EDIT*/'
+echo '/* Dynamically generated code-DONNOT EDIT */'
+
+echo '/* */'
+
+echo '/* This stuff needs to be done since the */'
+echo '/* DCRN number is actually in the opcode */'
+echo '/* itself. So there is no simple way for */'
+echo '/* the driver to store off the base value */'
+echo '/* and do the math at run time. Take a */'
+echo '/* look at the PPCBoot code to see the */'
+echo '/* self modifying code needed to do this */'
+echo '/* at run time. */'
+echo '/* */'
+echo '/* This could be expanded to cover more */'
+echo '/* than just the ethernet driver. So it */'
+echo '/* may be valuable to move this into arch */'
+echo '/* and export the 2 functions. At that */'
+echo '/* point it may be just as well to dump */'
+echo '/* the names/macros here and just expand */'
+echo '/* it with just the numbers. */'
echo
echo
@@ -28,12 +73,14 @@
echo '{'
echo ' switch(dcrn) {'
for DCRN in $DCRNS; do
- for BASE in $@; do
- echo ' case' $DCRN '(' $BASE ') :'
- echo ' return mfdcr( ' $DCRN '(' $BASE '));'
+ for BASE in $BASES; do
+ echo " case ${DCRN}(${BASE}):"
+ echo " return mfdcr( ${DCRN}(${BASE}) );"
done
done
echo ' }'
+echo ' /*Should we do some sort of error?*/'
+echo ' /*Extra return keeps the compiler happy*/'
echo ' return 0;'
echo '}'
@@ -44,11 +91,14 @@
echo '{'
echo ' switch(dcrn) {'
for DCRN in $DCRNS; do
- for BASE in $@; do
- echo ' case' $DCRN '(' $BASE ') :'
- echo ' mtdcr( ' $DCRN '(' $BASE '), val);'
+ for BASE in $BASES; do
+ echo " case ${DCRN}(${BASE}) :"
+ echo " mtdcr( ${DCRN}(${BASE}), val);"
echo ' break;'
done
done
+echo ' default:'
+echo ' /*Should we do some sort of error?*/'
+echo ' break;'
echo ' }'
echo '}'
[-- Attachment #3: ocp_help --]
[-- Type: text/plain, Size: 824 bytes --]
Amount of bytes to Reserve on a skb for the IBM OCP Enet Driver
CONFIG_IBM_OCP_ENET_SKB_RES
Many standard ethernet drivers need to reserve 2 bytes of data
on the skb before giving the data ptr to the hardware. This is
so the IP data will be 16-byte aligned when it goes up the stack.
This is a requirement for some processors and it can cause major
slow downs on others. The 405GP dose not have problems with the
misaligned data so the default is 0. If you need to route the
incoming ethernet packets to another device that has alignment
requirements this can help remove a data copy. A value of 2 can
help at getting 16-byte aligned IP data for another device. A
larger value can be used when routing to a IP tunnel device.
Make sure XXX_DESC_SIZE - XXX_SKB_RES >= 1514, or larger if VLANS
are used.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-15 22:25 ` andrew may
@ 2002-03-15 22:31 ` Tom Rini
2002-03-18 22:25 ` andrew may
0 siblings, 1 reply; 11+ messages in thread
From: Tom Rini @ 2002-03-15 22:31 UTC (permalink / raw)
To: andrew may; +Cc: linuxppc-embedded, Armin
On Fri, Mar 15, 2002 at 02:25:42PM -0800, andrew may wrote:
> On Fri, Mar 15, 2002 at 01:05:58PM -0700, Tom Rini wrote:
> > On Fri, Mar 15, 2002 at 11:41:37AM -0800, andrew may wrote:
> >
> > > 3. added mal.sh to generate a new ibm_ocp_mal.c
> >
> > This looks very cool. Can you add in some comments to the shell script,
> > and I didn't see any bashisms in there, can you verify it works with
> > pdksh or one of the other script shells which can be /bin/sh ?
>
> I am not sure how I can check against other shells since I don't
> have them on my machine. Is sh --posix good enough?
It depends on what 'sh' is.
> Here is a patch to mal.sh with some more comments, taking an
> arg of the Mal count, and some spacing fixups.
Looks good.
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-18 22:25 ` andrew may
@ 2002-03-18 14:53 ` Armin
2002-03-18 22:56 ` andrew may
2002-03-19 0:28 ` Tom Rini
1 sibling, 1 reply; 11+ messages in thread
From: Armin @ 2002-03-18 14:53 UTC (permalink / raw)
To: andrew may; +Cc: linuxppc-embedded
andrew may wrote:
> +#Do we want CONFIG_IBM_OCP_MAL_CNT ?
No
> +ibm_ocp_mal.c: mal.sh
> + $(SH) ./mal.sh 2 >ibm_ocp_mal.c
> +
>
And this get applied on top of your first patch?
armin
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-15 22:31 ` Tom Rini
@ 2002-03-18 22:25 ` andrew may
2002-03-18 14:53 ` Armin
2002-03-19 0:28 ` Tom Rini
0 siblings, 2 replies; 11+ messages in thread
From: andrew may @ 2002-03-18 22:25 UTC (permalink / raw)
To: Tom Rini; +Cc: andrew may, linuxppc-embedded, Armin
[-- Attachment #1: Type: text/plain, Size: 817 bytes --]
On Fri, Mar 15, 2002 at 03:31:40PM -0700, Tom Rini wrote:
> On Fri, Mar 15, 2002 at 02:25:42PM -0800, andrew may wrote:
> > On Fri, Mar 15, 2002 at 01:05:58PM -0700, Tom Rini wrote:
> > > On Fri, Mar 15, 2002 at 11:41:37AM -0800, andrew may wrote:
> > >
> > > > 3. added mal.sh to generate a new ibm_ocp_mal.c
> > >
> > > This looks very cool. Can you add in some comments to the shell script,
> > > and I didn't see any bashisms in there, can you verify it works with
> > > pdksh or one of the other script shells which can be /bin/sh ?
> >
> > I am not sure how I can check against other shells since I don't
> > have them on my machine. Is sh --posix good enough?
>
> It depends on what 'sh' is.
Well I just have bash 2.05a.0(1)-release as a debian package.
Here is a patch for the Config.help and the Makefile
[-- Attachment #2: ocp_enet-5.diff --]
[-- Type: text/plain, Size: 1892 bytes --]
diff -u linux-base/Documentation/Configure.help linux-ppc/Documentation/Configure.help
--- linux-base/Documentation/Configure.help Wed Mar 13 19:52:39 2002
+++ linux-ppc/Documentation/Configure.help Mon Mar 18 13:53:19 2002
@@ -24099,6 +24099,21 @@
Number of ethernet transmit (write) buffers. Unless you know what
you are doing the default should be fine.
+PowerPC 405 on-chip ethernet -- Amount of bytes to Reserve on a skb
+CONFIG_IBM_OCP_ENET_SKB_RES
+ Many standard ethernet drivers need to reserve 2 bytes of data
+ on the skb before giving the data ptr to the hardware. This is
+ so the IP data will be 16-byte aligned when it goes up the stack.
+ This is a requirement for some processors and it can cause major
+ slow downs on others. The 405GP dose not have problems with the
+ misaligned data so the default is 0. If you need to route the
+ incoming ethernet packets to another device that has alignment
+ requirements this can help remove a data copy. A value of 2 can
+ help at getting 16-byte aligned IP data for another device. A
+ larger value can be used when routing to a IP tunnel device.
+ Make sure XXX_DESC_SIZE - XXX_SKB_RES >= 1514, or larger if VLANS
+ are used.
+
PPC 405 I2C Algorithm
CONFIG_PPC405_I2C_ALGO
Enable this option to use the built-in I2C on your 405.
diff -ur linux-base/drivers/net/ibm_ocp/Makefile linux-ppc/drivers/net/ibm_ocp/Makefile
--- linux-base/drivers/net/ibm_ocp/Makefile Wed Mar 13 19:52:33 2002
+++ linux-ppc/drivers/net/ibm_ocp/Makefile Mon Mar 18 13:49:18 2002
@@ -19,3 +19,10 @@
obj-$(CONFIG_IBM_OCP_ENET) += ibm_ocp_enet.o ibm_ocp_phy.o ibm_ocp_mal.o
include $(TOPDIR)/Rules.make
+
+#This will generate code for 2MALs this works for the 405GP even
+#though it has only one since the 2nd is defined at offset 0
+#Do we want CONFIG_IBM_OCP_MAL_CNT ?
+ibm_ocp_mal.c: mal.sh
+ $(SH) ./mal.sh 2 >ibm_ocp_mal.c
+
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-18 14:53 ` Armin
@ 2002-03-18 22:56 ` andrew may
0 siblings, 0 replies; 11+ messages in thread
From: andrew may @ 2002-03-18 22:56 UTC (permalink / raw)
To: Armin; +Cc: andrew may, linuxppc-embedded
On Mon, Mar 18, 2002 at 02:53:48PM +0000, Armin wrote:
> andrew may wrote:
>
> > +#Do we want CONFIG_IBM_OCP_MAL_CNT ?
>
> No
Well then you get to update the makefile when
we start having more MALs around.
> > +ibm_ocp_mal.c: mal.sh
> > + $(SH) ./mal.sh 2 >ibm_ocp_mal.c
> > +
> >
>
>
> And this get applied on top of your first patch?
Yes, how else would get mal.sh. There was the first
patch, and a second patch that fixed up mal.sh.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-18 22:25 ` andrew may
2002-03-18 14:53 ` Armin
@ 2002-03-19 0:28 ` Tom Rini
2002-03-19 0:54 ` andrew may
1 sibling, 1 reply; 11+ messages in thread
From: Tom Rini @ 2002-03-19 0:28 UTC (permalink / raw)
To: andrew may; +Cc: linuxppc-embedded, Armin
On Mon, Mar 18, 2002 at 02:25:07PM -0800, andrew may wrote:
> On Fri, Mar 15, 2002 at 03:31:40PM -0700, Tom Rini wrote:
> > On Fri, Mar 15, 2002 at 02:25:42PM -0800, andrew may wrote:
> > > On Fri, Mar 15, 2002 at 01:05:58PM -0700, Tom Rini wrote:
> > > > On Fri, Mar 15, 2002 at 11:41:37AM -0800, andrew may wrote:
> > > >
> > > > > 3. added mal.sh to generate a new ibm_ocp_mal.c
> > > >
> > > > This looks very cool. Can you add in some comments to the shell script,
> > > > and I didn't see any bashisms in there, can you verify it works with
> > > > pdksh or one of the other script shells which can be /bin/sh ?
> > >
> > > I am not sure how I can check against other shells since I don't
> > > have them on my machine. Is sh --posix good enough?
> >
> > It depends on what 'sh' is.
>
> Well I just have bash 2.05a.0(1)-release as a debian package.
Can you apt-get pdksh or ksh at your liesure please?
> Here is a patch for the Config.help and the Makefile
Thanks.
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-19 0:28 ` Tom Rini
@ 2002-03-19 0:54 ` andrew may
2002-03-19 1:01 ` Tom Rini
0 siblings, 1 reply; 11+ messages in thread
From: andrew may @ 2002-03-19 0:54 UTC (permalink / raw)
To: Tom Rini; +Cc: andrew may, linuxppc-embedded, Armin
On Mon, Mar 18, 2002 at 05:28:20PM -0700, Tom Rini wrote:
> Can you apt-get pdksh or ksh at your liesure please?
pdksh 5.2.14-6 works fine on mal.sh
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] another for ibm_ocp_enet gzip'd
2002-03-19 0:54 ` andrew may
@ 2002-03-19 1:01 ` Tom Rini
0 siblings, 0 replies; 11+ messages in thread
From: Tom Rini @ 2002-03-19 1:01 UTC (permalink / raw)
To: andrew may; +Cc: linuxppc-embedded, Armin
On Mon, Mar 18, 2002 at 04:54:05PM -0800, andrew may wrote:
> On Mon, Mar 18, 2002 at 05:28:20PM -0700, Tom Rini wrote:
> > Can you apt-get pdksh or ksh at your liesure please?
>
> pdksh 5.2.14-6 works fine on mal.sh
Great, thanks alot.
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2002-03-19 1:01 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-15 19:41 [PATCH] another for ibm_ocp_enet gzip'd andrew may
2002-03-15 20:05 ` Tom Rini
2002-03-15 22:25 ` andrew may
2002-03-15 22:31 ` Tom Rini
2002-03-18 22:25 ` andrew may
2002-03-18 14:53 ` Armin
2002-03-18 22:56 ` andrew may
2002-03-19 0:28 ` Tom Rini
2002-03-19 0:54 ` andrew may
2002-03-19 1:01 ` Tom Rini
2002-03-15 20:06 ` Tom Rini
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).