Skip to contentSkip to conversation

Gianfar ethernet drop package

DISCUSSION Aníbal Almeida Pinto 2 participants 6 messages Aug 24, 2012 – Aug 27, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

I have an board with a ppc with a 8379, kernel 3.0.39 and with a Gianfar Ethernet Controller Version 1.2.

When connect the board to office network the number of dropped packets reported by ifconfig continues to increase.

Following the test made at [1] I use tcpdump and when running it the number of drop packages don't have increased.

When executing ethtool eth0 -S it return a rx-dropped-by-kernel != 0. And the rest of drop packages

Is possible to get info why the packages are dropped?

What is the relation between ethtool rx-dropped-by-kernel and ifconfig drop package ?

The output from ifconfig eth0 and ethtool -S eth0 executed one after other:

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:1D:11:91:00:00
          inet addr:172.18.208.187  Bcast:0.0.0.0  Mask:255.255.252.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:967819 errors:0 dropped:54676 overruns:0 frame:0
          TX packets:467 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:110916831 (105.7 MiB)  TX bytes:45317 (44.2 KiB)
          Base address:0x8000

ethtool -S eth0
NIC statistics:

     rx-dropped-by-kernel: 628278
     rx-large-frame-errors: 0
     rx-short-frame-errors: 0
     rx-non-octet-errors: 0
     rx-crc-errors: 0
     rx-overrun-errors: 0
     rx-busy-errors: 0
     rx-babbling-errors: 0
     rx-truncated-frames: 0
     ethernet-bus-error: 0
     tx-babbling-errors: 0
     tx-underrun-errors: 0
     rx-skb-missing-errors: 0
     tx-timeout-errors: 0
     tx-rx-64-frames: 227705
     tx-rx-65-127-frames: 743446
     tx-rx-128-255-frames: 117818
     tx-rx-256-511-frames: 43480
     tx-rx-512-1023-frames: 21406
     tx-rx-1024-1518-frames: 81741
     tx-rx-1519-1522-good-vlan: 0
     rx-bytes: 239178758
     rx-packets: 1235130
     rx-fcs-errors: 2
     receive-multicast-packet: 293898
     receive-broadcast-packet: 936991
     rx-control-frame-packets: 0
     rx-pause-frame-packets: 0
     rx-unknown-op-code: 0
     rx-alignment-error: 0
     rx-frame-length-error: 0
     rx-code-error: 0
     rx-carrier-sense-error: 1
     rx-undersize-packets: 0
     rx-oversize-packets: 0
     rx-fragmented-frames: 0
     rx-jabber-frames: 1
     rx-dropped-frames: 0
     tx-byte-counter: 51355
     tx-packets: 467
     tx-multicast-packets: 0
     tx-broadcast-packets: 132
     tx-pause-control-frames: 0
     tx-deferral-packets: 0
     tx-excessive-deferral-packets: 0
     tx-single-collision-packets: 0
     tx-multiple-collision-packets: 0
     tx-late-collision-packets: 0
     tx-excessive-collision-packets: 0
     tx-total-collision: 0
     reserved: 0
     tx-dropped-frames: 0
     tx-jabber-frames: 0
     tx-fcs-errors: 0
     tx-control-frames: 0
     tx-oversize-frames: 0
     tx-undersize-frames: 0
     tx-fragmented-frames: 0

[1] - http://www.novell.com/support/kb/doc.php?id=7007165

Thanks.

Regards,
Aníbal

#1 lore raw
Quoted 8 lines · Aníbal Almeida Pinto

Hi,

I have an board with a ppc with a 8379, kernel 3.0.39 and with a Gianfar Ethernet Controller Version 1.2.

When connect the board to office network the number of dropped packets reported by ifconfig continues to increase.

Quoted 7 lines

Following the test made at [1] I use tcpdump and when running it the number of drop packages don't have increased.

When executing ethtool eth0 -S it return a rx-dropped-by-kernel != 0. And the rest of drop packages

Is possible to get info why the packages are dropped?

You receive frames for unknown protocols. So they are dropped.

When running tcpdump, your tcpdump get them, they are not dropped.

So just parse your tcpdump output ?

#2 lore raw

Em 24-08-2012 19:17, Eric Dumazet escreveu:

Quoted 15 lines · Aníbal Almeida Pinto
Quoted 14 lines

Hi,

I have an board with a ppc with a 8379, kernel 3.0.39 and with a Gianfar Ethernet Controller Version 1.2.

When connect the board to office network the number of dropped packets reported by ifconfig continues to increase.

Following the test made at [1] I use tcpdump and when running it the number of drop packages don't have increased.

When executing ethtool eth0 -S it return a rx-dropped-by-kernel != 0. And the rest of drop packages

Quoted 8 lines
Quoted 1 line

Is possible to get info why the packages are dropped?

You receive frames for unknown protocols. So they are dropped.

When running tcpdump, your tcpdump get them, they are not dropped.

So just parse your tcpdump output ?

I generate the log on the board with tcpdump -i eth0 -w log_eth0.txt and loaded the result on wireshark (on other pc).

On the wireshark everything appears to be fine don't have nothing that indicate the protocol isn't supported.

On /etc/protocols is a list with protocols, it there is a place where exist a place with protocols supported by kernel ?

Thanks

#3 lore raw
Quoted 8 lines · Aníbal Almeida Pinto

I generate the log on the board with tcpdump -i eth0 -w log_eth0.txt and loaded the result on wireshark (on other pc).

On the wireshark everything appears to be fine don't have nothing that indicate the protocol isn't supported.

On /etc/protocols is a list with protocols, it there is a place where exist a place with protocols supported by kernel ?

So all frames understood by wireshark are also automatically handled by your linux machine ? That sounds cool, so we no longer have to add stuff in the kernel ?

Let me explain again :

For example, if you dont have IPv6 loaded, IPv6 frames wont be handled, and they appear to be dropped. They really are.

If you run tcpdump/wireshark, these frames are at least delivered once to a sniffer, so they are not "dropped", even if no protocol handler actually reacts to them.

#4 lore raw

Em 27-08-2012 12:08, Eric Dumazet escreveu:

Quoted 15 lines · Aníbal Almeida Pinto
Quoted 9 lines

I generate the log on the board with tcpdump -i eth0 -w log_eth0.txt and loaded the result on wireshark (on other pc).

On the wireshark everything appears to be fine don't have nothing that indicate the protocol isn't supported.

On /etc/protocols is a list with protocols, it there is a place where exist a place with protocols supported by kernel ?

So all frames understood by wireshark are also automatically handled by your linux machine ? That sounds cool, so we no longer have to add stuff in the kernel ?

Quoted 8 lines

Let me explain again :

For example, if you dont have IPv6 loaded, IPv6 frames wont be handled, and they appear to be dropped. They really are.

If you run tcpdump/wireshark, these frames are at least delivered once to a sniffer, so they are not "dropped", even if no protocol handler actually reacts to them.

I understand your explanation.

My problem now is to identify why the packages were dropped.

Wireshark report what listen and with ifconfig I only know how many have been dropped.

I made a program, inline at the end, that tries to see the sockets that I can create on a system, that will give me a idea of what protocol handler that I have.

The program isn't complete and the options are a lot ...

Even with this I only can see the log of tcpdump and try to find frames that belong to protocols not supported, don't know if there isn't another reason, like Softnet backlog full or Bad / Unintended VLAN tags

Is there any way of put tcpdump or other tool to only log the packages dropped ?

Thanks

#include <stdio.h>
#include <stdlib.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>

#include <netdb.h>

#include <errno.h>

struct socket_conf {
	int socket_family; // domain
	int socket_type;
	int protocol;
};
struct socket_conf conf_list[] = {
	{ PF_LOCAL, SOCK_STREAM, 0 },	// Local stream socket
	{ PF_LOCAL, SOCK_DGRAM, 0 },	// Local datagram socket
	{ PF_INET, SOCK_STREAM, IPPROTO_TCP }, // TCP/IP stream socket
	{ PF_INET, SOCK_DGRAM, IPPROTO_UDP}, // UDP datagram socket
	{ PF_UNSPEC, SOCK_DGRAM , 0 },
	{ PF_LOCAL, SOCK_DGRAM , 0 },
	{ PF_UNIX, SOCK_DGRAM , 0 },
	{ PF_FILE, SOCK_DGRAM , 0 },
	{ PF_INET, SOCK_DGRAM , 0 },
//	{ PF_AX, SOCK_DGRAM , 0 },
	{ PF_IPX, SOCK_DGRAM , 0 },
	{ PF_APPLETALK, SOCK_DGRAM , 0 },
	{ PF_NETROM, SOCK_DGRAM , 0 },
	{ PF_BRIDGE, SOCK_DGRAM , 0 },
	{ PF_ATMPVC, SOCK_DGRAM , 0 },
//	{ PF_X, SOCK_DGRAM , 0 },
	{ PF_INET, SOCK_DGRAM , 0 },
	{ PF_ROSE, SOCK_DGRAM , 0 },
	{ PF_DECnet, SOCK_DGRAM , 0 },
	{ PF_NETBEUI, SOCK_DGRAM , 0 },
	{ PF_SECURITY, SOCK_DGRAM , 0 },
	{ PF_KEY, SOCK_DGRAM , 0 },
	{ PF_NETLINK , SOCK_DGRAM , 0 },
	{ PF_ROUTE , SOCK_DGRAM , 0 },
	{ PF_PACKET, SOCK_DGRAM , 0 },
	{ PF_ASH, SOCK_DGRAM , 0 },
	{ PF_ECONET, SOCK_DGRAM , 0 },
	{ PF_ATMSVC, SOCK_DGRAM , 0 },
	{ PF_SNA, SOCK_DGRAM , 0 },
	{ PF_IRDA, SOCK_DGRAM , 0 },
	{ PF_MAX, SOCK_DGRAM , 0 },
	{ AF_UNSPEC  , SOCK_DGRAM , 0 },
	{ AF_LOCAL  , SOCK_DGRAM , 0 },
	{ AF_UNIX  , SOCK_DGRAM , 0 },
	{ AF_FILE , SOCK_DGRAM , 0 },
	{ AF_INET, SOCK_DGRAM , 0 },
	{ AF_AX25, SOCK_DGRAM , 0 },
	{ AF_IPX , SOCK_DGRAM , 0 },
	{ AF_APPLETALK  , SOCK_DGRAM , 0 },
	{ AF_NETROM    , SOCK_DGRAM , 0 },
	{ AF_BRIDGE   , SOCK_DGRAM , 0 },
	{ AF_ATMPVC  , SOCK_DGRAM , 0 },
	{ AF_X25    , SOCK_DGRAM , 0 },
	{ AF_INET6 , SOCK_DGRAM , 0 },
	{ AF_ROSE   , SOCK_DGRAM , 0 },
	{ AF_DECnet  , SOCK_DGRAM , 0 },
	{ AF_NETBEUI  , SOCK_DGRAM , 0 },
	{ AF_SECURITY , SOCK_DGRAM , 0 },
//	{ pseudo_AF_KEY , SOCK_DGRAM , 0 },
	{ AF_NETLINK   , SOCK_DGRAM , 0 },
	{ AF_ROUTE    , SOCK_DGRAM , 0 },
	{ AF_PACKET  , SOCK_DGRAM , 0 },
	{ AF_ASH    , SOCK_DGRAM , 0 },
	{ AF_ECONET , SOCK_DGRAM , 0 },
	{ AF_ATMSVC , SOCK_DGRAM , 0 },
	{ AF_SNA   , SOCK_DGRAM , 0 },
	{ AF_IRDA , SOCK_DGRAM , 0 },
	{ AF_MAX  , SOCK_DGRAM , 0 },
};

int main(int argc, char * argv[]){

	int s, i;
	struct protoent * p;

	setprotoent(0);

	for(i = 0 ; i < sizeof(conf_list) / sizeof(struct socket_conf) ; i++) {

		p = getprotobynumber(conf_list[i].socket_family);

		printf("Index %d", i);

		if(p != NULL)
			printf(" prot %s", p->p_name);

		printf(" : ");	
				fflush(stdout);

		s = socket(conf_list[i].socket_family,
				conf_list[i].socket_type,
				conf_list[i].protocol
				);

		if( s == -1)
			perror("socket()");
		else
			printf("ok\n");

		fflush(stdout);
	}

	endprotoent();

	return 1;
}
#5 lore raw
Quoted 2 lines · Aníbal Almeida Pinto

Is there any way of put tcpdump or other tool to only log the packages dropped ?

To log such packets with tcpdump, I am afraid you'll need to patch your kernel.

We dont have a way to tell tcpdump "sniff dropped packets"

Something like this one

(alternatively you can use dropwatch (based on drop_monitor)) and tweak it...

net/core/dev.c +5 -8
index 3401e2d..1336570 100644
@@ -3263,14 +3263,6 @@ another_round:
 	if (sk_memalloc_socks() && skb_pfmemalloc(skb))
 		goto skip_taps;
 
-	list_for_each_entry_rcu(ptype, &ptype_all, list) {
-		if (!ptype->dev || ptype->dev == skb->dev) {
-			if (pt_prev)
-				ret = deliver_skb(skb, pt_prev, orig_dev);
-			pt_prev = ptype;
-		}
-	}
-
 skip_taps:
 #ifdef CONFIG_NET_CLS_ACT
 	skb = handle_ing(skb, &pt_prev, &ret, orig_dev);
@@ -3337,6 +3329,11 @@ ncls:
 	} else {
 drop:
 		atomic_long_inc(&skb->dev->rx_dropped);
+		list_for_each_entry_rcu(ptype, &ptype_all, list) {
+			if (!ptype->dev || ptype->dev == skb->dev) {
+				ret = deliver_skb(skb, ptype, orig_dev);
+			}
+		}
 		kfree_skb(skb);
 		/* Jamal, now you will not able to escape explaining
 		 * me how you were going to use this. :-)