Disabling LRO using ethtool? - linux

My NIC driver does not support H/W LRO but emulates LRO in the driver. Now GRO (which is a linux network stack feature) can be disabled using 'ethtool -k ethx gro off'. Is that available for LRO as well? i know most distros have either LRO or GRO. So if LRO is disabled using ethtool does it imply turning off the H/W LRO feature or the LRO emulation feature that i do in my driver?

Yes, if your ethtool is new enough.
On my Ubuntu box (Natty Narwhal), "man ethtool" and "ethtool --help" show that LRO is controlled just like GRO; i.e.
ethtool -K ethX lro off
Run "ethtool --help | grep lro" to see if yours supports it.

ethtool -k ethx lro off
It should prevent the system from performing lro. However, many of the drivers which still use LRO are broken and do not honor ethtool.
http://www.spinics.net/lists/netdev/msg149013.html

Related

Can I increase linux entropy by using rng-daemon without hardware generator?

I want to continuously increase /prco/sys/random/entropy_avail when it reduced.
I first check the rngd (https://wiki.archlinux.org/index.php/Rng-tools)
It says /dev/random is very slow since it only collects entropy from device drivers and other (slow) sources and I think that is why we use rngd.
And it says rngd mainly uses hardware random number generators (TRNG), present in modern hardware like recent AMD/Intel processors, VIA Nano or even Raspberry Pi.
However, when I start rngd it says
[root#localhost init.d]# rngd
can't open entropy source(tpm or intel/amd rng)
Maybe RNG device modules are not loaded
But I don't have Intel RDRAND confirmed by cat /proc/cpuinfo | grep rdrand:
[root#localhost init.d]# cat /proc/cpuinfo | grep rdrand | wc -l
0
If there is any possible resources that I can use?
Alternatively, is it possible making script to increase /proc/sys/random/entropy_avail?
Try this:
sudo apt-get install haveged

How to set up autoip with local-link (RNDIS) on linux and embedded linux

I'm trying to figure out how to automatically setup an zeroconfig network address on a RNDIS Usb Gadget.
currently when i plug in the device, on the device i have to
$ modprobe g_ether
$ ifconfig usb0 up
$ avahi-autoipd usb0 &
and on the host i have to
$ avahi-autoipd usb0 &
they'll both get a 169.x.x.x number and I can ping, sometimes it doesn't work though. The device does not have a NetworkManager, we use busy box to start, I'm sort of looking at this as a possible solution Static Host RNDIS IP by linux based USB Gadget device, but I'd prefer to use local ip's.
A long time ago i some vague instructions on how to set a script to run in /etc/network/interfaces when a interface becomes available, but i'm having a hard time finding that again.
Thanks!
I figured it out, in /etc/network/interfaces
allow-hotplug usb0
iface usb* inet manual
up /usr/sbin/avahi-autoipd --force-bind -D $IFACE
down /usr/sbin/avahi-autoipd --kill $IFACE

Can I simulate pulling out the network cable?

I'm running a long-running socket connection, locally. When I kill the server application it closes cleanly. I now want to see how the client behaves when it does not close cleanly. If they were on different servers I could pull out the network cable. When the connection is local I have nothing to pull. [Insert rude joke here.]
I can do netstat -an |grep tcp | grep :80 and see the connection, which looks something like this:
tcp 0 0 10.1.2.3:80 10.1.2.3:40494 ESTABLISHED
Can I use that 40494 port number to kill or hang the socket, the same way I can use a program's PID to kill it?
Very similar question: How can I simulate a 'plugged network cable' (TCP/IP)? (That question is asking about Windows, I am on Linux)
Unload the kernel module for the network driver might kill it the way you want.
Pick your network interface from the list of active (eth0, eth1, etc...)
ifconfig -a
eth0 Link encap:Ethernet HWaddr 18:A9:05:68:6F:B0
inet6 addr: fe80::1aa9:5ff:fe68:6fb0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9000 Metric:1
To find the driver module for eth0 interface
ls -l /sys/class/net/eth0/device/driver/module
lrwxrwxrwx 1 root root 0 Aug 15 18:39 module -> ../../../../module/bnx2
To list the kernel modules for your system run
lsmod | grep bnx
bnx2i 48158 0
cnic 55511 1 bnx2i
bnx2 81890 0
To remove the module from memory will require root or sudo access
rmmod -f -w bnx2
This is not a safe operation and you messing with the operating system in an unsafe way. Expect bad things(tm) to happen when you do this. Don't do it in a production environment. Also this may not work depending on the driver behavior itself.
That said, this is an interesting problem and I'm interested in hearing how it turns out.
It appears the answer is "no", there is no way to kill a particular connection.
What I ended up doing was sudo ifdown eth0 (then afterwards sudo ifup eth0 to restore the network). Obviously this is a sledgehammer approach, as it takes down all connections.
For completeness, another approach was to guess which Apache process was running the socket connection, and kill just that process. But apart from involving guessing, that is also more application specific than the question I was asking.

How do I log data from my serial ports consistently?

I need to deal with two pieces of custom hardware which both send debugging data over two serial connections. Those serial connections go through two serial-to-USB converters. The serial-to-USB devices have the same vendor numbers, device numbers, and, apparently, the same serial numbers.
Here's the issue: I want to log the two serial ports separately. The custom hardware needs to be rebooted constantly, and whether they attach to the same /dev/ttyUSB* is completely random. How can I make them pick the same device path every time? I could make it dependent on what port it is plugged into, but that seems kind of hacky.
So, I ran a diff against the output of udevadm, like so:
$ udevadm info -a -p `udevadm info -q path -n /dev/ttyUSB1` > usb1
$ udevadm info -a -p `udevadm info -q path -n /dev/ttyUSB2` > usb2
$ diff usb1 usb2
The output of the diff is long; you can see it here
Grepping for serial (same for both):
$ udevadm info -a -p `udevadm info -q path -n /dev/ttyUSB2` | grep serial
SUBSYSTEMS=="usb-serial"
ATTRS{serial}=="0001"
ATTRS{serial}=="0000:00:1d.7"
Other info:
I'm using PuTTY to read from the serial ports.
OS:
$ uname -a
Linux xxxxxxxx.localdomain 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Please check if the usb-serial converter is based on a ftdi chip?
(You can check driver filenames)
If so; you have a chance to change serial number,or even the manufacturer info.
http://www.ftdichip.com/Support/Utilities.htm
Check the tools; MProg and FT_PROG utility tools.

Get details of RAID configuration on Linux

How to get the details of RAID configuration in Linux ?
mdadm -D /dev/mdxx will give you detail of raid configuration.
cat /proc/mdstat will give detail about raid algorithm,level and chunk size etc .
This is real if this RAID is sofware....
In case of RAID hardware, you could type this command :
lspci -vv | grep -i raid
01:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2208 [Thunderbolt] (rev 01)
Kernel driver in use: megaraid_sas
Kernel modules: megaraid_sas
If you're talking about a running array:
cat /proc/mdstat
If you're talking about the mdadm config file, it's usually in /etc or /etc/mdadm depending on the distribution you're running on. The following command should find it in any event:
find /etc -name '*mdadm*'
ETA: Also, I would strongly recommend that you carefully study the mdadm man page so that you are very familiar with that utility. Knowing that utility well will save your bacon at some point.
mdadm --detail /dev/md0
(or whatever /dev/mdXXX you are using)

Resources