Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Marvell if_mvgbe



(2012/10/15 15:28), David Laight wrote:
On Mon, Oct 15, 2012 at 11:33:14AM +1300, Lloyd Parkes wrote:

On 13/10/2012, at 1:42 AM, Robert Swindells <rjs%fdy2.co.uk@localhost> wrote:

I have been using the following patch for a while now on the
SheevaPlug, it should reduce the number of receive interrupts
generated by the ethernet controllers.

Great. The interrupt load on some of my older gear was so bad that I had to 
retire that gear, so I approve of fewer interrupts.

+static uint32_t
+mvgbe_ipg_rx(struct mvgbec_softc *csc, struct mvgbe_softc *sc)
+{
+
+       if (csc->sc_flags & FLAGS_IPG2)
+               return (((sc->sc_ipg_rx & 0x8000) << 10) |
+                       ((sc->sc_ipg_rx & 0x7fff) << 7));
+       else if (csc->sc_flags & FLAGS_IPG1)
+               return ((sc->sc_ipg_rx & 0x3fff) << 8);
+       else
+               return 0;
+}
...
+       if ((csc->sc_flags & FLAGS_IPG1) || (csc->sc_flags & FLAGS_IPG2))
+               sc->sc_ipg_rx = 768;

You need to replace all the numeric constants with #defines though.
I can read and write network device drivers (that aren't too complicated),
but I don't know what this code does without referring to the Marvell
data sheets.

Also, remove the 'else' following the 'return's.

        David

 I've added the sysctl interface to mvgbe (if_mvgbe.c rev. 1.25).


Modified Files:
        src/sys/dev/marvell: if_mvgbe.c mvgbereg.h

Log Message:
Add code to modify interrupt coalescing with sysctl.
 - both TX side an RX side.
 - different setting for each port
 - TX side is hw.mvgbe.mvgbe*.ipginttx
 - RX side is hw.mvgbe.mvgbe*.ipgintrx
 - The default value is 768.
 - The lowest value is 0
 - For highest value, 0x3777 is used for V1, and 0xffff is used for V2.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/mvgbereg.h


 Example:

# sysctl -a |grep mvgbe
kern.root_device = mvgbe0
net.interfaces.mvgbe0.sndq.len = 0
net.interfaces.mvgbe0.sndq.maxlen = 256
net.interfaces.mvgbe0.sndq.drops = 0
hw.mvgbe.mvgbe0.ipginttx = 768
hw.mvgbe.mvgbe0.ipgintrx = 768

five# ping -f 192.168.1.30
PING 192.168.1.30 (192.168.1.30): 52 data bytes
.^C.....

----192.168.1.30 PING Statistics----
11500 packets transmitted, 11500 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.125/0.589/99.985/3.764 ms
  2327.7 packets/sec sent,  2327.8 packets/sec received



# sysctl -w hw.mvgbe.mvgbe0.ipgintrx=0
hw.mvgbe.mvgbe0.ipgintrx: 768 -> 0

five# ping -f 192.168.1.30
PING 192.168.1.30 (192.168.1.30): 52 data bytes
.^C......

----192.168.1.30 PING Statistics----
4582 packets transmitted, 4582 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.113/0.583/99.895/3.720 ms
  2391.0 packets/sec sent,  2391.1 packets/sec received


# sysctl -w hw.mvgbe.mvgbe0.ipgintrx=65535
hw.mvgbe.mvgbe0.ipgintrx: 0 -> 65535

five# ping -f 192.168.1.30
PING 192.168.1.30 (192.168.1.30): 52 data bytes
.^C.......

----192.168.1.30 PING Statistics----
427 packets transmitted, 427 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.413/17.336/114.079/17.427 ms
  100.3 packets/sec sent,  99.8 packets/sec received

The delay and the standard deviation are good at both 0 and 768,
so I think 768 is reasonable on SheevaPlug.

--
-----------------------------------------------
                SAITOH Masanobu (msaitoh%execsw.org@localhost
                                 msaitoh%netbsd.org@localhost)


Home | Main Index | Thread Index | Old Index