Netdev List
 help / color / mirror / Atom feed
* [PATCH RFC V1 net-next 0/6] Time based packet transmission
From: Richard Cochran @ 2017-09-18  7:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, intel-wired-lan, Andre Guedes, Anna-Maria Gleixner,
	David Miller, Henrik Austad, Jesus Sanchez-Palencia, John Stultz,
	Thomas Gleixner, Vinicius Costa Gomes

This series is an early RFC that introduces a new socket option
allowing time based transmission of packets.  This option will be
useful in implementing various real time protocols over Ethernet,
including but not limited to P802.1Qbv, which is currently finding
its way into 802.1Q.

* Open questions about SO_TXTIME semantics

  - What should the kernel do if the dialed Tx time is in the past?
    Should the packet be sent ASAP, or should we throw an error?

  - Should the kernel inform the user if it detects a missed deadline,
    via the error queue for example?

  - What should the timescale be for the dialed Tx time?  Should the
    kernel select UTC when using the SW Qdisc and the HW time
    otherwise?  Or should the socket option include a clockid_t?

* Things todo

  - Design a Qdisc for purpose of configuring SO_TXTIME.  There should
    be one option to dial HW offloading or SW best effort.

  - Implement the SW best effort variant.  Here is my back of the
    napkin sketch.  Each interface has its own timerqueue keeping the
    TXTIME packets in order and a FIFO for all other traffic.  A guard
    window starts at the earliest deadline minus the maximum MTU minus
    a configurable fudge factor.  The Qdisc uses a hrtimer to transmit
    the next packet in the timerqueue.  During the guard window, all
    other traffic is defered unless the next packet can be transmitted
    before the guard window expires.

* Current limitations

  - The driver does not handle out of order packets.  If user space
    sends a packet with an earlier Tx time, then the code should stop
    the queue, reshuffle the descriptors accordingly, and then
    restart the queue.

  - The driver does not correctly queue up packets in the distant
    future.  The i210 has a limited time window of +/- 0.5 seconds.
    Packets with a Tx time greater than that should be deferred in
    order to enqueue them later on.

* Performance measurements

  1. Prepared a PC and the Device Under Test (DUT) each with an Intel
     i210 card connected with a crossover cable.
  2. The DUT was a Pentium(R) D CPU 2.80GHz running PREEMPT_RT
     4.9.40-rt30 with about 50 usec maximum latency under cyclictest.
  3. Synchronized the DUT's PHC to the PC's PHC using ptp4l.
  4. Synchronized the DUT's system clock to its PHC using phc2sys.
  5. Started netperf to produce some network load.
  6. Measured the arrival time of the packets at the PC's PHC using
     hardware time stamping.

  I ran ten minute tests both with and without using the so_txtime
  option, with a period was 1 millisecond.  I then repeated the
  so_txtime case but with a 250 microsecond period.  The measured
  offset from the expected period (in nanoseconds) is shown in the
  following table.

  |         | plain preempt_rt |     so_txtime | txtime @ 250 us |
  |---------+------------------+---------------+-----------------|
  | min:    |    +1.940800e+04 | +4.720000e+02 |   +4.720000e+02 |
  | max:    |    +7.556000e+04 | +5.680000e+02 |   +5.760000e+02 |
  | pk-pk:  |    +5.615200e+04 | +9.600000e+01 |   +1.040000e+02 |
  | mean:   |    +3.292776e+04 | +5.072274e+02 |   +5.073602e+02 |
  | stddev: |    +6.514709e+03 | +1.310849e+01 |   +1.507144e+01 |
  | count:  |           600000 |        600000 |         2400000 |

  Using so_txtime, the peak to peak jitter is about 100 nanoseconds,
  independent of the period.  In contrast, plain preempt_rt shows a
  jitter of of 56 microseconds.  The average delay of 507 nanoseconds
  when using so_txtime is explained by the documented input and output
  delays on the i210 cards.

  The test program is appended, below.  If anyone is interested in
  reproducing this test, I can provide helper scripts.

Thanks,
Richard


Richard Cochran (6):
  net: Add a new socket option for a future transmit time.
  net: skbuff: Add a field to support time based transmission.
  net: ipv4: raw: Hook into time based transmission.
  net: ipv4: udp: Hook into time based transmission.
  net: packet: Hook into time based transmission.
  net: igb: Implement time based transmission.

 arch/alpha/include/uapi/asm/socket.h           |  3 ++
 arch/frv/include/uapi/asm/socket.h             |  3 ++
 arch/ia64/include/uapi/asm/socket.h            |  3 ++
 arch/m32r/include/uapi/asm/socket.h            |  3 ++
 arch/mips/include/uapi/asm/socket.h            |  3 ++
 arch/mn10300/include/uapi/asm/socket.h         |  3 ++
 arch/parisc/include/uapi/asm/socket.h          |  3 ++
 arch/powerpc/include/uapi/asm/socket.h         |  3 ++
 arch/s390/include/uapi/asm/socket.h            |  3 ++
 arch/sparc/include/uapi/asm/socket.h           |  3 ++
 arch/xtensa/include/uapi/asm/socket.h          |  3 ++
 drivers/net/ethernet/intel/igb/e1000_82575.h   |  1 +
 drivers/net/ethernet/intel/igb/e1000_defines.h | 68 +++++++++++++++++++++++++-
 drivers/net/ethernet/intel/igb/e1000_regs.h    |  5 ++
 drivers/net/ethernet/intel/igb/igb.h           |  3 +-
 drivers/net/ethernet/intel/igb/igb_main.c      | 68 +++++++++++++++++++++++---
 include/linux/skbuff.h                         |  2 +
 include/net/sock.h                             |  2 +
 include/uapi/asm-generic/socket.h              |  3 ++
 net/core/sock.c                                | 12 +++++
 net/ipv4/raw.c                                 |  2 +
 net/ipv4/udp.c                                 |  5 +-
 net/packet/af_packet.c                         |  6 +++
 23 files changed, 200 insertions(+), 10 deletions(-)

-- 
2.11.0

---8<---
/*
 * This program demonstrates transmission of UDP packets using the
 * system TAI timer.
 *
 * Copyright (C) 2017 linutronix GmbH
 *
 * Large portions taken from the linuxptp stack.
 * Copyright (C) 2011, 2012 Richard Cochran <richardcochran@gmail.com>
 *
 * Some portions taken from the sgd test program.
 * Copyright (C) 2015 linutronix GmbH
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
#define _GNU_SOURCE /*for CPU_SET*/
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <ifaddrs.h>
#include <linux/ethtool.h>
#include <linux/net_tstamp.h>
#include <linux/sockios.h>
#include <net/if.h>
#include <netinet/in.h>
#include <poll.h>
#include <pthread.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#define DEFAULT_PERIOD	1000000
#define DEFAULT_DELAY	500000
#define MCAST_IPADDR	"239.1.1.1"
#define UDP_PORT	7788

#ifndef SO_TXTIME
#define SO_TXTIME	61
#endif

#define pr_err(s)	fprintf(stderr, s "\n")
#define pr_info(s)	fprintf(stdout, s "\n")

static int running = 1, use_so_txtime = 1;
static int period_nsec = DEFAULT_PERIOD;
static int waketx_delay = DEFAULT_DELAY;
static struct in_addr mcast_addr;

static int mcast_bind(int fd, int index)
{
	int err;
	struct ip_mreqn req;
	memset(&req, 0, sizeof(req));
	req.imr_ifindex = index;
	err = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, &req, sizeof(req));
	if (err) {
		pr_err("setsockopt IP_MULTICAST_IF failed: %m");
		return -1;
	}
	return 0;
}

static int mcast_join(int fd, int index, const struct sockaddr *grp,
		      socklen_t grplen)
{
	int err, off = 0;
	struct ip_mreqn req;
	struct sockaddr_in *sa = (struct sockaddr_in *) grp;

	memset(&req, 0, sizeof(req));
	memcpy(&req.imr_multiaddr, &sa->sin_addr, sizeof(struct in_addr));
	req.imr_ifindex = index;
	err = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &req, sizeof(req));
	if (err) {
		pr_err("setsockopt IP_ADD_MEMBERSHIP failed: %m");
		return -1;
	}
	err = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &off, sizeof(off));
	if (err) {
		pr_err("setsockopt IP_MULTICAST_LOOP failed: %m");
		return -1;
	}
	return 0;
}

static void normalize(struct timespec *ts)
{
	while (ts->tv_nsec > 999999999) {
		ts->tv_sec += 1;
		ts->tv_nsec -= 1000000000;
	}
}

static int sk_interface_index(int fd, const char *name)
{
	struct ifreq ifreq;
	int err;

	memset(&ifreq, 0, sizeof(ifreq));
	strncpy(ifreq.ifr_name, name, sizeof(ifreq.ifr_name) - 1);
	err = ioctl(fd, SIOCGIFINDEX, &ifreq);
	if (err < 0) {
		pr_err("ioctl SIOCGIFINDEX failed: %m");
		return err;
	}
	return ifreq.ifr_ifindex;
}

static int open_socket(const char *name, struct in_addr mc_addr, short port)
{
	struct sockaddr_in addr;
	int fd, index, on = 1;

	memset(&addr, 0, sizeof(addr));
	addr.sin_family = AF_INET;
	addr.sin_addr.s_addr = htonl(INADDR_ANY);
	addr.sin_port = htons(port);

	fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
	if (fd < 0) {
		pr_err("socket failed: %m");
		goto no_socket;
	}
	index = sk_interface_index(fd, name);
	if (index < 0)
		goto no_option;

	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) {
		pr_err("setsockopt SO_REUSEADDR failed: %m");
		goto no_option;
	}
	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr))) {
		pr_err("bind failed: %m");
		goto no_option;
	}
	if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name))) {
		pr_err("setsockopt SO_BINDTODEVICE failed: %m");
		goto no_option;
	}
	addr.sin_addr = mc_addr;
	if (mcast_join(fd, index, (struct sockaddr *) &addr, sizeof(addr))) {
		pr_err("mcast_join failed");
		goto no_option;
	}
	if (mcast_bind(fd, index)) {
		goto no_option;
	}
	if (use_so_txtime && setsockopt(fd, SOL_SOCKET, SO_TXTIME, &on, sizeof(on))) {
		pr_err("setsockopt SO_TXTIME failed: %m");
		goto no_option;
	}

	return fd;
no_option:
	close(fd);
no_socket:
	return -1;
}

static int udp_open(const char *name)
{
	int fd;

	if (!inet_aton(MCAST_IPADDR, &mcast_addr))
		return -1;

	fd = open_socket(name, mcast_addr, UDP_PORT);

	return fd;
}

static int udp_send(int fd, void *buf, int len, __u64 txtime)
{
	union {
		char buf[CMSG_SPACE(sizeof(__u64))];
		struct cmsghdr align;
	} u;
	struct sockaddr_in sin;
	struct cmsghdr *cmsg;
	struct msghdr msg;
	struct iovec iov;
	ssize_t cnt;

	memset(&sin, 0, sizeof(sin));
	sin.sin_family = AF_INET;
	sin.sin_addr = mcast_addr;
	sin.sin_port = htons(UDP_PORT);

	iov.iov_base = buf;
	iov.iov_len = len;

	memset(&msg, 0, sizeof(msg));
	msg.msg_name = &sin;
	msg.msg_namelen = sizeof(sin);
	msg.msg_iov = &iov;
	msg.msg_iovlen = 1;

	/*
	 * We specify the transmission time in the CMSG.
	 */
	if (use_so_txtime) {
		msg.msg_control = u.buf;
		msg.msg_controllen = sizeof(u.buf);
		cmsg = CMSG_FIRSTHDR(&msg);
		cmsg->cmsg_level = SOL_SOCKET;
		cmsg->cmsg_type = SO_TXTIME;
		cmsg->cmsg_len = CMSG_LEN(sizeof(__u64));
		*((__u64 *) CMSG_DATA(cmsg)) = txtime;
	}
	cnt = sendmsg(fd, &msg, 0);
	if (cnt < 1) {
		pr_err("sendmsg failed: %m");
		return cnt;
	}
	return cnt;
}

static unsigned char tx_buffer[256];
static int marker;

static int run_nanosleep(clockid_t clkid, int fd)
{
	struct timespec ts;
	int cnt, err;
	__u64 txtime;

	clock_gettime(clkid, &ts);

	/* Start one to two seconds in the future. */
	ts.tv_sec += 1;
	ts.tv_nsec = 1000000000 - waketx_delay;
	normalize(&ts);

	txtime = ts.tv_sec * 1000000000ULL + ts.tv_nsec;
	txtime += waketx_delay;

	while (running) {
		err = clock_nanosleep(clkid, TIMER_ABSTIME, &ts, NULL);
		switch (err) {
		case 0:
			cnt = udp_send(fd, tx_buffer, sizeof(tx_buffer), txtime);
			if (cnt != sizeof(tx_buffer)) {
				pr_err("udp_send failed");
			}
			memset(tx_buffer, marker++, sizeof(tx_buffer));
			ts.tv_nsec += period_nsec;
			normalize(&ts);
			txtime += period_nsec;
			break;
		case EINTR:
			continue;
		default:
			fprintf(stderr, "clock_nanosleep returned %d: %s",
				err, strerror(err));
			return err;
		}
	}

	return 0;
}

static int set_realtime(pthread_t thread, int priority, int cpu)
{
	cpu_set_t cpuset;
	struct sched_param sp;
	int err, policy;

	int min = sched_get_priority_min(SCHED_FIFO);
	int max = sched_get_priority_max(SCHED_FIFO);

	fprintf(stderr, "min %d max %d\n", min, max);

	if (priority < 0) {
		return 0;
	}

	err = pthread_getschedparam(thread, &policy, &sp);
	if (err) {
		fprintf(stderr, "pthread_getschedparam: %s\n", strerror(err));
		return -1;
	}

	sp.sched_priority = priority;

	err = pthread_setschedparam(thread, SCHED_FIFO, &sp);
	if (err) {
		fprintf(stderr, "pthread_setschedparam: %s\n", strerror(err));
		return -1;
	}

	if (cpu < 0) {
		return 0;
	}
	CPU_ZERO(&cpuset);
	CPU_SET(cpu, &cpuset);
	err = pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
	if (err) {
		fprintf(stderr, "pthread_setaffinity_np: %s\n", strerror(err));
		return -1;
	}

	return 0;
}

static void usage(char *progname)
{
	fprintf(stderr,
		"\n"
		"usage: %s [options]\n"
		"\n"
		" -c [num]   run on CPU 'num'\n"
		" -d [num]   delay from wake up to transmission in nanoseconds (default %d)\n"
		" -h         prints this message and exits\n"
		" -i [name]  use network interface 'name'\n"
		" -p [num]   run with RT priorty 'num'\n"
		" -P [num]   period in nanoseconds (default %d)\n"
		" -u         do not use SO_TXTIME\n"
		"\n",
		progname, DEFAULT_DELAY, DEFAULT_PERIOD);
}

int main(int argc, char *argv[])
{
	int c, cpu = -1, err, fd, priority = -1;
	clockid_t clkid = CLOCK_TAI;
	char *iface = NULL, *progname;

	/* Process the command line arguments. */
	progname = strrchr(argv[0], '/');
	progname = progname ? 1 + progname : argv[0];
	while (EOF != (c = getopt(argc, argv, "c:d:hi:p:P:u"))) {
		switch (c) {
		case 'c':
			cpu = atoi(optarg);
			break;
		case 'd':
			waketx_delay = atoi(optarg);
			break;
		case 'h':
			usage(progname);
			return 0;
		case 'i':
			iface = optarg;
			break;
		case 'p':
			priority = atoi(optarg);
			break;
		case 'P':
			period_nsec = atoi(optarg);
			break;
		case 'u':
			use_so_txtime = 0;
			break;
		case '?':
			usage(progname);
			return -1;
		}
	}

	if (waketx_delay > 999999999 || waketx_delay < 0) {
		pr_err("Bad wake up to transmission delay.");
		usage(progname);
		return -1;
	}

	if (period_nsec < 1000) {
		pr_err("Bad period.");
		usage(progname);
		return -1;
	}

	if (!iface) {
		pr_err("Need a network interface.");
		usage(progname);
		return -1;
	}

	if (set_realtime(pthread_self(), priority, cpu)) {
		return -1;
	}

	fd = udp_open(iface);
	if (fd < 0) {
		return -1;
	}

	err = run_nanosleep(clkid, fd);

	close(fd);
	return err;
}

^ permalink raw reply

* Re: Regression in throughput between kvm guests over virtual bridge
From: Jason Wang @ 2017-09-18  7:36 UTC (permalink / raw)
  To: Matthew Rosato, netdev; +Cc: davem, mst
In-Reply-To: <55f9173b-a419-98f0-2516-cbd57299ba5d@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4108 bytes --]



On 2017年09月18日 11:13, Jason Wang wrote:
>
>
> On 2017年09月16日 03:19, Matthew Rosato wrote:
>>> It looks like vhost is slowed down for some reason which leads to more
>>> idle time on 4.13+VHOST_RX_BATCH=1. Appreciated if you can collect the
>>> perf.diff on host, one for rx and one for tx.
>>>
>> perf data below for the associated vhost threads, baseline=4.12,
>> delta1=4.13, delta2=4.13+VHOST_RX_BATCH=1
>>
>> Client vhost:
>>
>> 60.12%  -11.11%  -12.34%  [kernel.vmlinux]   [k] raw_copy_from_user
>> 13.76%   -1.28%   -0.74%  [kernel.vmlinux]   [k] get_page_from_freelist
>>   2.00%   +3.69%   +3.54%  [kernel.vmlinux]   [k] __wake_up_sync_key
>>   1.19%   +0.60%   +0.66%  [kernel.vmlinux]   [k] __alloc_pages_nodemask
>>   1.12%   +0.76%   +0.86%  [kernel.vmlinux]   [k] copy_page_from_iter
>>   1.09%   +0.28%   +0.35%  [vhost]            [k] vhost_get_vq_desc
>>   1.07%   +0.31%   +0.26%  [kernel.vmlinux]   [k] alloc_skb_with_frags
>>   0.94%   +0.42%   +0.65%  [kernel.vmlinux]   [k] alloc_pages_current
>>   0.91%   -0.19%   -0.18%  [kernel.vmlinux]   [k] memcpy
>>   0.88%   +0.26%   +0.30%  [kernel.vmlinux]   [k] __next_zones_zonelist
>>   0.85%   +0.05%   +0.12%  [kernel.vmlinux]   [k] iov_iter_advance
>>   0.79%   +0.09%   +0.19%  [vhost]            [k] __vhost_add_used_n
>>   0.74%                    [kernel.vmlinux]   [k] get_task_policy.part.7
>>   0.74%   -0.01%   -0.05%  [kernel.vmlinux]   [k] tun_net_xmit
>>   0.60%   +0.17%   +0.33%  [kernel.vmlinux]   [k] policy_nodemask
>>   0.58%   -0.15%   -0.12%  [ebtables]         [k] ebt_do_table
>>   0.52%   -0.25%   -0.22%  [kernel.vmlinux]   [k] __alloc_skb
>>     ...
>>   0.42%   +0.58%   +0.59%  [kernel.vmlinux]   [k] eventfd_signal
>>     ...
>>   0.32%   +0.96%   +0.93%  [kernel.vmlinux]   [k] finish_task_switch
>>     ...
>>           +1.50%   +1.16%  [kernel.vmlinux]   [k] get_task_policy.part.9
>>           +0.40%   +0.42%  [kernel.vmlinux]   [k] __skb_get_hash_symmetr
>>           +0.39%   +0.40%  [kernel.vmlinux]   [k] _copy_from_iter_full
>>           +0.24%   +0.23%  [vhost_net]        [k] vhost_net_buf_peek
>>
>> Server vhost:
>>
>> 61.93%  -10.72%  -10.91%  [kernel.vmlinux]   [k] raw_copy_to_user
>>   9.25%   +0.47%   +0.86%  [kernel.vmlinux]   [k] free_hot_cold_page
>>   5.16%   +1.41%   +1.57%  [vhost]            [k] vhost_get_vq_desc
>>   5.12%   -3.81%   -3.78%  [kernel.vmlinux]   [k] skb_release_data
>>   3.30%   +0.42%   +0.55%  [kernel.vmlinux]   [k] raw_copy_from_user
>>   1.29%   +2.20%   +2.28%  [kernel.vmlinux]   [k] copy_page_to_iter
>>   1.24%   +1.65%   +0.45%  [vhost_net]        [k] handle_rx
>>   1.08%   +3.03%   +2.85%  [kernel.vmlinux]   [k] __wake_up_sync_key
>>   0.96%   +0.70%   +1.10%  [vhost]            [k] translate_desc
>>   0.69%   -0.20%   -0.22%  [kernel.vmlinux]   [k] tun_do_read.part.10
>>   0.69%                    [kernel.vmlinux]   [k] tun_peek_len
>>   0.67%   +0.75%   +0.78%  [kernel.vmlinux]   [k] eventfd_signal
>>   0.52%   +0.96%   +0.98%  [kernel.vmlinux]   [k] finish_task_switch
>>   0.50%   +0.05%   +0.09%  [vhost]            [k] vhost_add_used_n
>>     ...
>>           +0.63%   +0.58%  [vhost_net]        [k] vhost_net_buf_peek
>>           +0.32%   +0.32%  [kernel.vmlinux]   [k] _copy_to_iter
>>           +0.19%   +0.19%  [kernel.vmlinux]   [k] __skb_get_hash_symmetr
>>           +0.11%   +0.21%  [vhost]            [k] vhost_umem_interval_tr
>>
>
> Looks like for some unknown reason which leads more wakeups.
>
> Could you please try to attached patch to see if it solves or mitigate 
> the issue?
>
> Thanks 

My bad, please try this.

Thanks

[-- Attachment #2: 0001-vhost_net-conditionally-enable-tx-polling.patch --]
[-- Type: text/x-patch, Size: 898 bytes --]

>From 8be3edfcd415ba6157ab34d250127c6f2b21ff5d Mon Sep 17 00:00:00 2001
From: Jason Wang <jasowang@redhat.com>
Date: Mon, 18 Sep 2017 10:56:30 +0800
Subject: [PATCH] vhost_net: conditionally enable tx polling

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vhost/net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 58585ec..2b308e0 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -471,6 +471,7 @@ static void handle_tx(struct vhost_net *net)
 		goto out;
 
 	vhost_disable_notify(&net->dev, vq);
+	vhost_net_disable_vq(net, vq);
 
 	hdr_size = nvq->vhost_hlen;
 	zcopy = nvq->ubufs;
@@ -562,6 +563,8 @@ static void handle_tx(struct vhost_net *net)
 					% UIO_MAXIOV;
 			}
 			vhost_discard_vq_desc(vq, 1);
+			if (err == -EAGAIN)
+				vhost_net_enable_vq(net, vq);
 			break;
 		}
 		if (err != len)
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 ethtool] ethtool: Remove UDP Fragmentation Offload error prints
From: Tariq Toukan @ 2017-09-18  7:35 UTC (permalink / raw)
  To: John W. Linville
  Cc: netdev, Eran Ben Elisha, Michal Kubecek, Eric Dumazet,
	David S. Miller, Shaker Daibes, Tariq Toukan

From: Shaker Daibes <shakerd@mellanox.com>

UFO was removed in kernel, here we remove UFO error prints when using
"ethtool -k" command.

Fixes the following issue:
Features for ens8:
Cannot get device udp-fragmentation-offload settings: Operation not
supported

Signed-off-by: Shaker Daibes <shakerd@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
---
 ethtool.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ethtool.c b/ethtool.c
index ad18704e7c5f..aeeef65e7ef3 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2186,6 +2186,10 @@ get_features(struct cmd_context *ctx, const struct feature_defs *defs)
 		eval.cmd = off_flag_def[i].get_cmd;
 		err = send_ioctl(ctx, &eval);
 		if (err) {
+			if (errno == EOPNOTSUPP &&
+			    off_flag_def[i].get_cmd == ETHTOOL_GUFO)
+				continue;
+
 			fprintf(stderr,
 				"Cannot get device %s settings: %m\n",
 				off_flag_def[i].long_name);
-- 
1.8.3.1

^ permalink raw reply related

* Re: Page allocator bottleneck
From: Aaron Lu @ 2017-09-18  7:34 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: Jesper Dangaard Brouer, David Miller, Mel Gorman, Eric Dumazet,
	Alexei Starovoitov, Saeed Mahameed, Eran Ben Elisha,
	Linux Kernel Network Developers, Andrew Morton, Michal Hocko,
	linux-mm, Dave Hansen
In-Reply-To: <6069fd36-ed0e-145c-3134-35232bf951a7@mellanox.com>

[-- Attachment #1: Type: text/plain, Size: 1563 bytes --]

On Sun, Sep 17, 2017 at 07:16:15PM +0300, Tariq Toukan wrote:
> 
> It's nice to have the option to dynamically play with the parameter.
> But maybe we should also think of changing the default fraction guaranteed
> to the PCP, so that unaware admins of networking servers would also benefit.

I collected some performance data with will-it-scale/page_fault1 process
mode on different machines with different pcp->batch sizes, starting
from the default 31(calculated by zone_batchsize(), 31 is the standard
value for any zone that has more than 1/2MiB memory), then incremented
by 31 upwards till 527. PCP's upper limit is 6*batch.

An image is plotted and attached: batch_full.png(full here means the
number of process started equals to CPU number).

>From the image:
- For EX machines, they all see throughput increase with increased batch
  size and peaked at around batch_size=310, then fall;
- For EP machines, Haswell-EP and Broadwell-EP also see throughput
  increase with increased batch size and peaked at batch_size=279, then
  fall, batch_size=310 also delivers pretty good result. Skylake-EP is
  quite different in that it doesn't see any obvious throughput increase
  after batch_size=93, though the trend is still increasing, but in a very
  small way and finally peaked at batch_size=403, then fall.
  Ivybridge EP behaves much like desktop ones.
- For Desktop machines, they do not see any obvious changes with
  increased batch_size.

So the default batch size(31) doesn't deliver good enough result, we
probbaly should change the default value.

[-- Attachment #2: batch_full.png --]
[-- Type: image/png, Size: 25626 bytes --]

^ permalink raw reply

* Re: [PATCH net-next v9] openvswitch: enable NSH support
From: Yang, Yi @ 2017-09-18  7:14 UTC (permalink / raw)
  To: Jiri Benc
  Cc: dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, e@erig.me,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
In-Reply-To: <20170914110902.2a45f637@griffin>

On Thu, Sep 14, 2017 at 05:09:02PM +0800, Jiri Benc wrote:
> On Thu, 14 Sep 2017 16:37:59 +0800, Yi Yang wrote:
> > OVS master and 2.8 branch has merged NSH userspace
> > patch series, this patch is to enable NSH support
> > in kernel data path in order that OVS can support
> > NSH in compat mode by porting this.
> 
> http://vger.kernel.org/~davem/net-next.html

I see it has been open now, v9 this patch series is still ok to
current net-next without any hunk, so please help review v9, thanks a
lot.

^ permalink raw reply

* Re: scheduling while atomic from vmci_transport_recv_stream_cb in 3.16 kernels
From: Michal Hocko @ 2017-09-18  6:11 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Jorgen S. Hansen, Aditya Sarwade, Thomas Hellstrom, LKML,
	netdev@vger.kernel.org, Masik Petr, Sasha Levin, Stable tree
In-Reply-To: <1505495535.2825.41.camel@decadent.org.uk>

On Fri 15-09-17 18:12:15, Ben Hutchings wrote:
> On Thu, 2017-09-14 at 10:59 +0200, Michal Hocko wrote:
> > On Wed 13-09-17 18:58:13, Jorgen S. Hansen wrote:
> > [...]
> > > The patch series look good to me.
> > 
> > Thanks for double checking. Ben, could you merge this to 3.16 stable
> > branch, please?
> 
> I have a long list of requests to work through, but I will get to this
> eventually.

Thanks!
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* [PATCH net-next] net: remove useless comments in dst.c
From: Duan Jiong @ 2017-09-18  6:00 UTC (permalink / raw)
  To: netdev; +Cc: weiwan

dst gc related code has been removed in commit
5b7c9a8ff828, so those comments are no longer
useful.

Signed-off-by: Duan Jiong <jduan@fiberhome.com>
---
 net/core/dst.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/net/core/dst.c b/net/core/dst.c
index a6c47da..a710d39 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -25,23 +25,6 @@
 #include <net/dst.h>
 #include <net/dst_metadata.h>

-/*
- * Theory of operations:
- * 1) We use a list, protected by a spinlock, to add
- *    new entries from both BH and non-BH context.
- * 2) In order to keep spinlock held for a small delay,
- *    we use a second list where are stored long lived
- *    entries, that are handled by the garbage collect thread
- *    fired by a workqueue.
- * 3) This list is guarded by a mutex,
- *    so that the gc_task and dst_dev_event() can be synchronized.
- */
-
-/*
- * We want to keep lock & list close together
- * to dirty as few cache lines as possible in __dst_free().
- * As this is not a very strong hint, we dont force an alignment on SMP.
- */
 int dst_discard_out(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
  kfree_skb(skb);
-- 
2.9.3

^ permalink raw reply related

* Re: [PATCH] bnx2x: drop packets where gso_size is too big for hardware
From: Daniel Axtens @ 2017-09-18  4:41 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: netdev, tlfalcon, Yuval.Mintz, ariel.elior, everest-linux-l2,
	jay.vosburgh
In-Reply-To: <1504159341.15310.6.camel@edumazet-glaptop3.roam.corp.google.com>

Hi Eric,

>> +		if (unlikely(skb_shinfo(skb)->gso_size + hlen > MAX_PACKET_SIZE)) {
>> +			BNX2X_ERR("reported gso segment size plus headers "
>> +				  "(%d + %d) > MAX_PACKET_SIZE; dropping pkt!",
>> +				  skb_shinfo(skb)->gso_size, hlen);
>> +
>> +			goto free_and_drop;
>> +		}
>> +
>
>
> If you had this test in bnx2x_features_check(), packet could be
> segmented by core networking stack before reaching bnx2x_start_xmit() by
> clearing NETIF_F_GSO_MASK
>
> -> No drop would be involved.
>
> check i40evf_features_check() for similar logic.

So I've been experimenting with this and reading through the core
networking code. If my understanding is correct, disabling GSO will
cause the packet to be segmented, but it will be segemented into
gso_size+header length packets. So in this case (~10kB gso_size) the
resultant packets will still be too big - although at least they don't
cause a crash in that case.

We could continue with this anyway as it at least prevents the crash -
but, and I haven't been able to find a nice definitive answer to this -
are implementations of ndo_start_xmit permitted to assume that the the
skb passed in will fit within the MTU? I notice that most callers will
attempt to ensure this - for example ip_output.c, ip6_output.c and
ip_forward.c all contain calls to skb_gso_validate_mtu(). If
implementations are permitted to assume this, perhaps a fix to
openvswitch would be more appropriate?

Regards,
Daniel

^ permalink raw reply

* Re: [PATCH] vhost_net: conditionally enable tx polling
From: kbuild test robot @ 2017-09-18  4:14 UTC (permalink / raw)
  To: Jason Wang; +Cc: kbuild-all, Matthew Rosato, netdev, davem, mst
In-Reply-To: <55f9173b-a419-98f0-2516-cbd57299ba5d@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 5778 bytes --]

Hi Jason,

[auto build test WARNING on vhost/linux-next]
[also build test WARNING on v4.14-rc1 next-20170915]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jason-Wang/vhost_net-conditionally-enable-tx-polling/20170918-112041
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
config: x86_64-randconfig-x009-201738 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers//vhost/net.c: In function 'handle_tx':
>> drivers//vhost/net.c:565:4: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
       if (err = -EAGAIN)
       ^~

vim +565 drivers//vhost/net.c

   442	
   443	/* Expects to be always run from workqueue - which acts as
   444	 * read-size critical section for our kind of RCU. */
   445	static void handle_tx(struct vhost_net *net)
   446	{
   447		struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX];
   448		struct vhost_virtqueue *vq = &nvq->vq;
   449		unsigned out, in;
   450		int head;
   451		struct msghdr msg = {
   452			.msg_name = NULL,
   453			.msg_namelen = 0,
   454			.msg_control = NULL,
   455			.msg_controllen = 0,
   456			.msg_flags = MSG_DONTWAIT,
   457		};
   458		size_t len, total_len = 0;
   459		int err;
   460		size_t hdr_size;
   461		struct socket *sock;
   462		struct vhost_net_ubuf_ref *uninitialized_var(ubufs);
   463		bool zcopy, zcopy_used;
   464	
   465		mutex_lock(&vq->mutex);
   466		sock = vq->private_data;
   467		if (!sock)
   468			goto out;
   469	
   470		if (!vq_iotlb_prefetch(vq))
   471			goto out;
   472	
   473		vhost_disable_notify(&net->dev, vq);
   474		vhost_net_disable_vq(net, vq);
   475	
   476		hdr_size = nvq->vhost_hlen;
   477		zcopy = nvq->ubufs;
   478	
   479		for (;;) {
   480			/* Release DMAs done buffers first */
   481			if (zcopy)
   482				vhost_zerocopy_signal_used(net, vq);
   483	
   484			/* If more outstanding DMAs, queue the work.
   485			 * Handle upend_idx wrap around
   486			 */
   487			if (unlikely(vhost_exceeds_maxpend(net)))
   488				break;
   489	
   490			head = vhost_net_tx_get_vq_desc(net, vq, vq->iov,
   491							ARRAY_SIZE(vq->iov),
   492							&out, &in);
   493			/* On error, stop handling until the next kick. */
   494			if (unlikely(head < 0))
   495				break;
   496			/* Nothing new?  Wait for eventfd to tell us they refilled. */
   497			if (head == vq->num) {
   498				if (unlikely(vhost_enable_notify(&net->dev, vq))) {
   499					vhost_disable_notify(&net->dev, vq);
   500					continue;
   501				}
   502				break;
   503			}
   504			if (in) {
   505				vq_err(vq, "Unexpected descriptor format for TX: "
   506				       "out %d, int %d\n", out, in);
   507				break;
   508			}
   509			/* Skip header. TODO: support TSO. */
   510			len = iov_length(vq->iov, out);
   511			iov_iter_init(&msg.msg_iter, WRITE, vq->iov, out, len);
   512			iov_iter_advance(&msg.msg_iter, hdr_size);
   513			/* Sanity check */
   514			if (!msg_data_left(&msg)) {
   515				vq_err(vq, "Unexpected header len for TX: "
   516				       "%zd expected %zd\n",
   517				       len, hdr_size);
   518				break;
   519			}
   520			len = msg_data_left(&msg);
   521	
   522			zcopy_used = zcopy && len >= VHOST_GOODCOPY_LEN
   523					   && (nvq->upend_idx + 1) % UIO_MAXIOV !=
   524					      nvq->done_idx
   525					   && vhost_net_tx_select_zcopy(net);
   526	
   527			/* use msg_control to pass vhost zerocopy ubuf info to skb */
   528			if (zcopy_used) {
   529				struct ubuf_info *ubuf;
   530				ubuf = nvq->ubuf_info + nvq->upend_idx;
   531	
   532				vq->heads[nvq->upend_idx].id = cpu_to_vhost32(vq, head);
   533				vq->heads[nvq->upend_idx].len = VHOST_DMA_IN_PROGRESS;
   534				ubuf->callback = vhost_zerocopy_callback;
   535				ubuf->ctx = nvq->ubufs;
   536				ubuf->desc = nvq->upend_idx;
   537				msg.msg_control = ubuf;
   538				msg.msg_controllen = sizeof(ubuf);
   539				ubufs = nvq->ubufs;
   540				atomic_inc(&ubufs->refcount);
   541				nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV;
   542			} else {
   543				msg.msg_control = NULL;
   544				ubufs = NULL;
   545			}
   546	
   547			total_len += len;
   548			if (total_len < VHOST_NET_WEIGHT &&
   549			    !vhost_vq_avail_empty(&net->dev, vq) &&
   550			    likely(!vhost_exceeds_maxpend(net))) {
   551				msg.msg_flags |= MSG_MORE;
   552			} else {
   553				msg.msg_flags &= ~MSG_MORE;
   554			}
   555	
   556			/* TODO: Check specific error and bomb out unless ENOBUFS? */
   557			err = sock->ops->sendmsg(sock, &msg, len);
   558			if (unlikely(err < 0)) {
   559				if (zcopy_used) {
   560					vhost_net_ubuf_put(ubufs);
   561					nvq->upend_idx = ((unsigned)nvq->upend_idx - 1)
   562						% UIO_MAXIOV;
   563				}
   564				vhost_discard_vq_desc(vq, 1);
 > 565				if (err = -EAGAIN)
   566					vhost_net_enable_vq(net, vq);
   567				break;
   568			}
   569			if (err != len)
   570				pr_debug("Truncated TX packet: "
   571					 " len %d != %zd\n", err, len);
   572			if (!zcopy_used)
   573				vhost_add_used_and_signal(&net->dev, vq, head, 0);
   574			else
   575				vhost_zerocopy_signal_used(net, vq);
   576			vhost_net_tx_packet(net);
   577			if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
   578				vhost_poll_queue(&vq->poll);
   579				break;
   580			}
   581		}
   582	out:
   583		mutex_unlock(&vq->mutex);
   584	}
   585	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31832 bytes --]

^ permalink raw reply

* Re: [RFC PATCH] can: m_can: Support higher speed CAN-FD bitrates
From: Yang, Wenyou @ 2017-09-18  3:47 UTC (permalink / raw)
  To: Sekhar Nori, Franklin S Cooper Jr, wg, mkl, mario.huettel,
	socketcan, quentin.schulz, edumazet, linux-can, netdev,
	linux-kernel
  Cc: Wenyou Yang, Dong Aisheng
In-Reply-To: <a7e301a7-bc54-c348-bdb1-b6a0af41665f@ti.com>



On 2017/9/14 13:06, Sekhar Nori wrote:
> On Thursday 14 September 2017 03:28 AM, Franklin S Cooper Jr wrote:
>>
>> On 08/18/2017 02:39 PM, Franklin S Cooper Jr wrote:
>>> During test transmitting using CAN-FD at high bitrates (4 Mbps) only
>>> resulted in errors. Scoping the signals I noticed that only a single bit
>>> was being transmitted and with a bit more investigation realized the actual
>>> MCAN IP would go back to initialization mode automatically.
>>>
>>> It appears this issue is due to the MCAN needing to use the Transmitter
>>> Delay Compensation Mode as defined in the MCAN User's Guide. When this
>>> mode is used the User's Guide indicates that the Transmitter Delay
>>> Compensation Offset register should be set. The document mentions that this
>>> register should be set to (1/dbitrate)/2*(Func Clk Freq).
>>>
>>> Additional CAN-CIA's "Bit Time Requirements for CAN FD" document indicates
>>> that this TDC mode is only needed for data bit rates above 2.5 Mbps.
>>> Therefore, only enable this mode and only set TDCO when the data bit rate
>>> is above 2.5 Mbps.
>>>
>>> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
>>> ---
>>> I'm pretty surprised that this hasn't been implemented already since
>>> the primary purpose of CAN-FD is to go beyond 1 Mbps and the MCAN IP
>>> supports up to 10 Mbps.
>>>
>>> So it will be nice to get comments from users of this driver to understand
>>> if they have been able to use CAN-FD beyond 2.5 Mbps without this patch.
>>> If they haven't what did they do to get around it if they needed higher
>>> speeds.
>>>
>>> Meanwhile I plan on testing this using a more "realistic" CAN bus to insure
>>> everything still works at 5 Mbps which is the max speed of my CAN
>>> transceiver.
>> ping. Anyone has any thoughts on this?
> I added Dong who authored the m_can driver and Wenyou who added the only
> in-kernel user of the driver for any help.
I tested it on SAMA5D2 Xplained board both with and without this patch,  
both work with the 4M bps data bit rate.

>
> Thanks,
> Sekhar
>
>>>   drivers/net/can/m_can/m_can.c | 24 +++++++++++++++++++++++-
>>>   1 file changed, 23 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
>>> index f4947a7..720e073 100644
>>> --- a/drivers/net/can/m_can/m_can.c
>>> +++ b/drivers/net/can/m_can/m_can.c
>>> @@ -126,6 +126,12 @@ enum m_can_mram_cfg {
>>>   #define DBTP_DSJW_SHIFT		0
>>>   #define DBTP_DSJW_MASK		(0xf << DBTP_DSJW_SHIFT)
>>>   
>>> +/* Transmitter Delay Compensation Register (TDCR) */
>>> +#define TDCR_TDCO_SHIFT		8
>>> +#define TDCR_TDCO_MASK		(0x7F << TDCR_TDCO_SHIFT)
>>> +#define TDCR_TDCF_SHIFT		0
>>> +#define TDCR_TDCF_MASK		(0x7F << TDCR_TDCO_SHIFT)
>>> +
>>>   /* Test Register (TEST) */
>>>   #define TEST_LBCK		BIT(4)
>>>   
>>> @@ -977,6 +983,8 @@ static int m_can_set_bittiming(struct net_device *dev)
>>>   	const struct can_bittiming *dbt = &priv->can.data_bittiming;
>>>   	u16 brp, sjw, tseg1, tseg2;
>>>   	u32 reg_btp;
>>> +	u32 enable_tdc = 0;
>>> +	u32 tdco;
>>>   
>>>   	brp = bt->brp - 1;
>>>   	sjw = bt->sjw - 1;
>>> @@ -991,9 +999,23 @@ static int m_can_set_bittiming(struct net_device *dev)
>>>   		sjw = dbt->sjw - 1;
>>>   		tseg1 = dbt->prop_seg + dbt->phase_seg1 - 1;
>>>   		tseg2 = dbt->phase_seg2 - 1;
>>> +
>>> +		/* TDC is only needed for bitrates beyond 2.5 MBit/s
>>> +		 * Specified in the "Bit Time Requirements for CAN FD" document
>>> +		 */
>>> +		if (dbt->bitrate > 2500000) {
>>> +			enable_tdc = DBTP_TDC;
>>> +			/* Equation based on Bosch's M_CAN User Manual's
>>> +			 * Transmitter Delay Compensation Section
>>> +			 */
>>> +			tdco = priv->can.clock.freq / (dbt->bitrate * 2);
>>> +			m_can_write(priv, M_CAN_TDCR, tdco << TDCR_TDCO_SHIFT);
>>> +		}
>>> +
>>>   		reg_btp = (brp << DBTP_DBRP_SHIFT) | (sjw << DBTP_DSJW_SHIFT) |
>>>   			(tseg1 << DBTP_DTSEG1_SHIFT) |
>>> -			(tseg2 << DBTP_DTSEG2_SHIFT);
>>> +			(tseg2 << DBTP_DTSEG2_SHIFT) | enable_tdc;
>>> +
>>>   		m_can_write(priv, M_CAN_DBTP, reg_btp);
>>>   	}
>>>   
>>>

Regards,
Wenyou Yang

^ permalink raw reply

* Re: Regression in throughput between kvm guests over virtual bridge
From: Jason Wang @ 2017-09-18  3:13 UTC (permalink / raw)
  To: Matthew Rosato, netdev; +Cc: davem, mst
In-Reply-To: <7345a69d-5e47-7058-c72b-bdd0f3c69210@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3468 bytes --]



On 2017年09月16日 03:19, Matthew Rosato wrote:
>> It looks like vhost is slowed down for some reason which leads to more
>> idle time on 4.13+VHOST_RX_BATCH=1. Appreciated if you can collect the
>> perf.diff on host, one for rx and one for tx.
>>
> perf data below for the associated vhost threads, baseline=4.12,
> delta1=4.13, delta2=4.13+VHOST_RX_BATCH=1
>
> Client vhost:
>
> 60.12%  -11.11%  -12.34%  [kernel.vmlinux]   [k] raw_copy_from_user
> 13.76%   -1.28%   -0.74%  [kernel.vmlinux]   [k] get_page_from_freelist
>   2.00%   +3.69%   +3.54%  [kernel.vmlinux]   [k] __wake_up_sync_key
>   1.19%   +0.60%   +0.66%  [kernel.vmlinux]   [k] __alloc_pages_nodemask
>   1.12%   +0.76%   +0.86%  [kernel.vmlinux]   [k] copy_page_from_iter
>   1.09%   +0.28%   +0.35%  [vhost]            [k] vhost_get_vq_desc
>   1.07%   +0.31%   +0.26%  [kernel.vmlinux]   [k] alloc_skb_with_frags
>   0.94%   +0.42%   +0.65%  [kernel.vmlinux]   [k] alloc_pages_current
>   0.91%   -0.19%   -0.18%  [kernel.vmlinux]   [k] memcpy
>   0.88%   +0.26%   +0.30%  [kernel.vmlinux]   [k] __next_zones_zonelist
>   0.85%   +0.05%   +0.12%  [kernel.vmlinux]   [k] iov_iter_advance
>   0.79%   +0.09%   +0.19%  [vhost]            [k] __vhost_add_used_n
>   0.74%                    [kernel.vmlinux]   [k] get_task_policy.part.7
>   0.74%   -0.01%   -0.05%  [kernel.vmlinux]   [k] tun_net_xmit
>   0.60%   +0.17%   +0.33%  [kernel.vmlinux]   [k] policy_nodemask
>   0.58%   -0.15%   -0.12%  [ebtables]         [k] ebt_do_table
>   0.52%   -0.25%   -0.22%  [kernel.vmlinux]   [k] __alloc_skb
>     ...
>   0.42%   +0.58%   +0.59%  [kernel.vmlinux]   [k] eventfd_signal
>     ...
>   0.32%   +0.96%   +0.93%  [kernel.vmlinux]   [k] finish_task_switch
>     ...
>           +1.50%   +1.16%  [kernel.vmlinux]   [k] get_task_policy.part.9
>           +0.40%   +0.42%  [kernel.vmlinux]   [k] __skb_get_hash_symmetr
>           +0.39%   +0.40%  [kernel.vmlinux]   [k] _copy_from_iter_full
>           +0.24%   +0.23%  [vhost_net]        [k] vhost_net_buf_peek
>
> Server vhost:
>
> 61.93%  -10.72%  -10.91%  [kernel.vmlinux]   [k] raw_copy_to_user
>   9.25%   +0.47%   +0.86%  [kernel.vmlinux]   [k] free_hot_cold_page
>   5.16%   +1.41%   +1.57%  [vhost]            [k] vhost_get_vq_desc
>   5.12%   -3.81%   -3.78%  [kernel.vmlinux]   [k] skb_release_data
>   3.30%   +0.42%   +0.55%  [kernel.vmlinux]   [k] raw_copy_from_user
>   1.29%   +2.20%   +2.28%  [kernel.vmlinux]   [k] copy_page_to_iter
>   1.24%   +1.65%   +0.45%  [vhost_net]        [k] handle_rx
>   1.08%   +3.03%   +2.85%  [kernel.vmlinux]   [k] __wake_up_sync_key
>   0.96%   +0.70%   +1.10%  [vhost]            [k] translate_desc
>   0.69%   -0.20%   -0.22%  [kernel.vmlinux]   [k] tun_do_read.part.10
>   0.69%                    [kernel.vmlinux]   [k] tun_peek_len
>   0.67%   +0.75%   +0.78%  [kernel.vmlinux]   [k] eventfd_signal
>   0.52%   +0.96%   +0.98%  [kernel.vmlinux]   [k] finish_task_switch
>   0.50%   +0.05%   +0.09%  [vhost]            [k] vhost_add_used_n
>     ...
>           +0.63%   +0.58%  [vhost_net]        [k] vhost_net_buf_peek
>           +0.32%   +0.32%  [kernel.vmlinux]   [k] _copy_to_iter
>           +0.19%   +0.19%  [kernel.vmlinux]   [k] __skb_get_hash_symmetr
>           +0.11%   +0.21%  [vhost]            [k] vhost_umem_interval_tr
>

Looks like for some unknown reason which leads more wakeups.

Could you please try to attached patch to see if it solves or mitigate 
the issue?

Thanks

[-- Attachment #2: 0001-vhost_net-conditionally-enable-tx-polling.patch --]
[-- Type: text/x-patch, Size: 899 bytes --]

>From 63b276ed881c1e2a89b7ea35b6f328f70ddd6185 Mon Sep 17 00:00:00 2001
From: Jason Wang <jasowang@redhat.com>
Date: Mon, 18 Sep 2017 10:56:30 +0800
Subject: [PATCH] vhost_net: conditionally enable tx polling

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vhost/net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 58585ec..397d86a 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -471,6 +471,7 @@ static void handle_tx(struct vhost_net *net)
 		goto out;
 
 	vhost_disable_notify(&net->dev, vq);
+	vhost_net_disable_vq(net, vq);
 
 	hdr_size = nvq->vhost_hlen;
 	zcopy = nvq->ubufs;
@@ -562,6 +563,8 @@ static void handle_tx(struct vhost_net *net)
 					% UIO_MAXIOV;
 			}
 			vhost_discard_vq_desc(vq, 1);
+			if (err = -EAGAIN)
+				vhost_net_enable_vq(net, vq);
 			break;
 		}
 		if (err != len)
-- 
1.8.3.1


^ permalink raw reply related

* Re: [PATCH V2] tipc: Use bsearch library function
From: Joe Perches @ 2017-09-17 21:15 UTC (permalink / raw)
  To: Jon Maloy, Thomas Meyer
  Cc: Ying Xue, netdev@vger.kernel.org,
	tipc-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, davem@davemloft.net
In-Reply-To: <DB5PR0701MB195892D3D60DAB5D7C1109AE9A620@DB5PR0701MB1958.eurprd07.prod.outlook.com>

On Sun, 2017-09-17 at 16:27 +0000, Jon Maloy wrote:
> > -----Original Message-----
> > From: Thomas Meyer [mailto:thomas@m3y3r.de]
[]
> > What about the other binary search implementation in the same file? Should
> > I try to convert it it will it get NAKed for performance reasons too?
> 
> The searches for inserting and removing publications is less time critical,
> so that would be ok with me.
> If you have any more general interest in improving the code in this file
> (which is needed) it would also be appreciated.

Perhaps using an rbtree would be an improvement.

^ permalink raw reply

* Re: [PATCH net-next v2 0/7] korina: performance fixes and cleanup
From: Florian Fainelli @ 2017-09-17 20:09 UTC (permalink / raw)
  To: Roman Yeryomin, netdev
In-Reply-To: <20170917172353.32225-1-roman@advem.lv>



On 09/17/2017 10:23 AM, Roman Yeryomin wrote:
> Changes from v1:
> - use GRO instead of increasing ring size
> - use NAPI_POLL_WEIGHT instead of defining own NAPI_WEIGHT
> - optimize rx descriptor flags processing

net-next is closed at the moment, but these look like reasonable
changes, I would just replace patch 7 with a patch that entirely drops
the driver specific version since that does not serve any purpose in the
context of an in-kernel driver.

Some nice clean-ups that you should also consider for future changes:

- reduce the duplication of tests/conditions in korina_send_packet(), a
lot of them are testing for the same things and setting the same
descriptor bits

- move korina_tx() to a NAPI context instead of working from hard
interrupt context

- get rid of the MIPS dma_cache_* calls and instead properly use the
DMA-API to allocate descriptors and invalidate/write-back skb->data

> 
> Roman Yeryomin (7):
>   net: korina: don't use overflow and underflow interrupts
>   net: korina: optimize rx descriptor flags processing
>   net: korina: use NAPI_POLL_WEIGHT
>   net: korina: use GRO
>   net: korina: whitespace cleanup
>   net: korina: update authors
>   net: korina: bump version
> 
>  drivers/net/ethernet/korina.c | 230 ++++++++++++++----------------------------
>  1 file changed, 78 insertions(+), 152 deletions(-)
> 

-- 
Florian

^ permalink raw reply

* Re: [PATCH net-next v2 7/7] net: korina: bump version
From: Florian Fainelli @ 2017-09-17 20:01 UTC (permalink / raw)
  To: Roman Yeryomin, netdev
In-Reply-To: <20170917172521.32639-1-roman@advem.lv>



On 09/17/2017 10:25 AM, Roman Yeryomin wrote:
> Signed-off-by: Roman Yeryomin <roman@advem.lv>

You can probably drop the version because it does not really make much
sense for an in-kernel driver anyway.
-- 
Florian

^ permalink raw reply

* Re: [REGRESSION] Warning in tcp_fastretrans_alert() of net/ipv4/tcp_input.c
From: Oleksandr Natalenko @ 2017-09-17 18:43 UTC (permalink / raw)
  To: Neal Cardwell
  Cc: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI, Netdev,
	Yuchung Cheng
In-Reply-To: <12759907.teKvueDKTR@natalenko.name>

Hi.

Just to note that it looks like disabling RACK and re-enabling FACK prevents 
warning from happening:

net.ipv4.tcp_fack = 1
net.ipv4.tcp_recovery = 0

Hope I get semantics of these tunables right.

On pátek 15. září 2017 21:04:36 CEST Oleksandr Natalenko wrote:
> Hello.
> 
> With net.ipv4.tcp_fack set to 0 the warning still appears:
> 
> ===
> » sysctl net.ipv4.tcp_fack
> net.ipv4.tcp_fack = 0
> 
> » LC_TIME=C dmesg -T | grep WARNING
> [Fri Sep 15 20:40:30 2017] WARNING: CPU: 1 PID: 711 at net/ipv4/tcp_input.c:
> 2826 tcp_fastretrans_alert+0x7c8/0x990
> [Fri Sep 15 20:40:30 2017] WARNING: CPU: 0 PID: 711 at net/ipv4/tcp_input.c:
> 2826 tcp_fastretrans_alert+0x7c8/0x990
> [Fri Sep 15 20:48:37 2017] WARNING: CPU: 1 PID: 711 at net/ipv4/tcp_input.c:
> 2826 tcp_fastretrans_alert+0x7c8/0x990
> [Fri Sep 15 20:48:55 2017] WARNING: CPU: 0 PID: 711 at net/ipv4/tcp_input.c:
> 2826 tcp_fastretrans_alert+0x7c8/0x990
> 
> » ps -up 711
> USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
> root       711  4.3  0.0      0     0 ?        S    18:12   7:23 [irq/123-
> enp3s0]
> ===
> 
> Any suggestions?
> 
> On pátek 15. září 2017 16:03:00 CEST Neal Cardwell wrote:
> > Thanks for testing that. That is a very useful data point.
> > 
> > I was able to cook up a packetdrill test that could put the connection
> > in CA_Disorder with retransmitted packets out, but not in CA_Open. So
> > we do not yet have a test case to reproduce this.
> > 
> > We do not see this warning on our fleet at Google. One significant
> > difference I see between our environment and yours is that it seems
> > 
> > you run with FACK enabled:
> >   net.ipv4.tcp_fack = 1
> > 
> > Note that FACK was disabled by default (since it was replaced by RACK)
> > between kernel v4.10 and v4.11. And this is exactly the time when this
> > bug started manifesting itself for you and some others, but not our
> > fleet. So my new working hypothesis would be that this warning is due
> > to a behavior that only shows up in kernels >=4.11 when FACK is
> > enabled.
> > 
> > Would you be able to disable FACK ("sysctl net.ipv4.tcp_fack=0" at
> > boot, or net.ipv4.tcp_fack=0 in /etc/sysctl.conf, or equivalent),
> > reboot, and test the kernel for a few days to see if the warning still
> > pops up?
> > 
> > thanks,
> > neal
> > 
> > [ps: apologies for the previous, mis-formatted post...]

^ permalink raw reply

* Re: [PATCH] hamradio: baycom: use new parport device model
From: Thomas Sailer @ 2017-09-17 18:20 UTC (permalink / raw)
  To: Sudip Mukherjee, David S. Miller; +Cc: linux-kernel, linux-hams, netdev
In-Reply-To: <1505648780-4385-1-git-send-email-sudipm.mukherjee@gmail.com>

Acked-By: Thomas Sailer <t.sailer@alumni.ethz.ch>

Am 17.09.2017 um 13:46 schrieb Sudip Mukherjee:
> Modify baycom driver to use the new parallel port device model.
> 
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
> 
> Not tested on real hardware, only tested on qemu and verified that the
> device is binding to the driver properly in epp_open but then unbinding
> as the device was not found.
> 
>   drivers/net/hamradio/baycom_epp.c | 50 +++++++++++++++++++++++++++++++++++----
>   1 file changed, 46 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
> index 1503f10..1e62d00 100644
> --- a/drivers/net/hamradio/baycom_epp.c
> +++ b/drivers/net/hamradio/baycom_epp.c
> @@ -840,6 +840,7 @@ static int epp_open(struct net_device *dev)
>   	unsigned char tmp[128];
>   	unsigned char stat;
>   	unsigned long tstart;
> +	struct pardev_cb par_cb;
>   	
>           if (!pp) {
>                   printk(KERN_ERR "%s: parport at 0x%lx unknown\n", bc_drvname, dev->base_addr);
> @@ -859,8 +860,21 @@ static int epp_open(struct net_device *dev)
>                   return -EIO;
>   	}
>   	memset(&bc->modem, 0, sizeof(bc->modem));
> -        bc->pdev = parport_register_device(pp, dev->name, NULL, epp_wakeup,
> -					   NULL, PARPORT_DEV_EXCL, dev);
> +	memset(&par_cb, 0, sizeof(par_cb));
> +	par_cb.wakeup = epp_wakeup;
> +	par_cb.private = (void *)dev;
> +	par_cb.flags = PARPORT_DEV_EXCL;
> +	for (i = 0; i < NR_PORTS; i++)
> +		if (baycom_device[i] == dev)
> +			break;
> +
> +	if (i == NR_PORTS) {
> +		pr_err("%s: no device found\n", bc_drvname);
> +		parport_put_port(pp);
> +		return -ENODEV;
> +	}
> +
> +	bc->pdev = parport_register_dev_model(pp, dev->name, &par_cb, i);
>   	parport_put_port(pp);
>           if (!bc->pdev) {
>                   printk(KERN_ERR "%s: cannot register parport at 0x%lx\n", bc_drvname, pp->base);
> @@ -1185,6 +1199,23 @@ MODULE_LICENSE("GPL");
>   
>   /* --------------------------------------------------------------------- */
>   
> +static int baycom_epp_par_probe(struct pardevice *par_dev)
> +{
> +	struct device_driver *drv = par_dev->dev.driver;
> +	int len = strlen(drv->name);
> +
> +	if (strncmp(par_dev->name, drv->name, len))
> +		return -ENODEV;
> +
> +	return 0;
> +}
> +
> +static struct parport_driver baycom_epp_par_driver = {
> +	.name = "bce",
> +	.probe = baycom_epp_par_probe,
> +	.devmodel = true,
> +};
> +
>   static void __init baycom_epp_dev_setup(struct net_device *dev)
>   {
>   	struct baycom_state *bc = netdev_priv(dev);
> @@ -1204,10 +1235,15 @@ static void __init baycom_epp_dev_setup(struct net_device *dev)
>   
>   static int __init init_baycomepp(void)
>   {
> -	int i, found = 0;
> +	int i, found = 0, ret;
>   	char set_hw = 1;
>   
>   	printk(bc_drvinfo);
> +
> +	ret = parport_register_driver(&baycom_epp_par_driver);
> +	if (ret)
> +		return ret;
> +
>   	/*
>   	 * register net devices
>   	 */
> @@ -1241,7 +1277,12 @@ static int __init init_baycomepp(void)
>   		found++;
>   	}
>   
> -	return found ? 0 : -ENXIO;
> +	if (found == 0) {
> +		parport_unregister_driver(&baycom_epp_par_driver);
> +		return -ENXIO;
> +	}
> +
> +	return 0;
>   }
>   
>   static void __exit cleanup_baycomepp(void)
> @@ -1260,6 +1301,7 @@ static void __exit cleanup_baycomepp(void)
>   				printk(paranoia_str, "cleanup_module");
>   		}
>   	}
> +	parport_unregister_driver(&baycom_epp_par_driver);
>   }
>   
>   module_init(init_baycomepp);
> 

^ permalink raw reply

* [PATCH net-next v2 7/7] net: korina: bump version
From: Roman Yeryomin @ 2017-09-17 17:25 UTC (permalink / raw)
  To: netdev

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 drivers/net/ethernet/korina.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index d58aa4bfcb58..7cecd9dbc111 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -66,8 +66,8 @@
 #include <asm/mach-rc32434/dma_v.h>
 
 #define DRV_NAME	"korina"
-#define DRV_VERSION	"0.10"
-#define DRV_RELDATE	"04Mar2008"
+#define DRV_VERSION	"0.20"
+#define DRV_RELDATE	"15Sep2017"
 
 #define STATION_ADDRESS_HIGH(dev) (((dev)->dev_addr[0] << 8) | \
 				   ((dev)->dev_addr[1]))
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next v2 6/7] net: korina: update authors
From: Roman Yeryomin @ 2017-09-17 17:25 UTC (permalink / raw)
  To: netdev

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 drivers/net/ethernet/korina.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index c26f0d84ba6b..d58aa4bfcb58 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -4,6 +4,7 @@
  *  Copyright 2004 IDT Inc. (rischelp@idt.com)
  *  Copyright 2006 Felix Fietkau <nbd@openwrt.org>
  *  Copyright 2008 Florian Fainelli <florian@openwrt.org>
+ *  Copyright 2017 Roman Yeryomin <roman@advem.lv>
  *
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
@@ -1150,5 +1151,6 @@ module_platform_driver(korina_driver);
 MODULE_AUTHOR("Philip Rischel <rischelp@idt.com>");
 MODULE_AUTHOR("Felix Fietkau <nbd@openwrt.org>");
 MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
+MODULE_AUTHOR("Roman Yeryomin <roman@advem.lv>");
 MODULE_DESCRIPTION("IDT RC32434 (Korina) Ethernet driver");
 MODULE_LICENSE("GPL");
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next v2 5/7] net: korina: whitespace cleanup
From: Roman Yeryomin @ 2017-09-17 17:25 UTC (permalink / raw)
  To: netdev

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 drivers/net/ethernet/korina.c | 58 +++++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index 5f36e1703378..c26f0d84ba6b 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -64,9 +64,9 @@
 #include <asm/mach-rc32434/eth.h>
 #include <asm/mach-rc32434/dma_v.h>
 
-#define DRV_NAME        "korina"
-#define DRV_VERSION     "0.10"
-#define DRV_RELDATE     "04Mar2008"
+#define DRV_NAME	"korina"
+#define DRV_VERSION	"0.10"
+#define DRV_RELDATE	"04Mar2008"
 
 #define STATION_ADDRESS_HIGH(dev) (((dev)->dev_addr[0] << 8) | \
 				   ((dev)->dev_addr[1]))
@@ -75,7 +75,7 @@
 				   ((dev)->dev_addr[4] << 8)  | \
 				   ((dev)->dev_addr[5]))
 
-#define MII_CLOCK 1250000 	/* no more than 2.5MHz */
+#define MII_CLOCK	1250000 /* no more than 2.5MHz */
 
 /* the following must be powers of two */
 #define KORINA_NUM_RDS	64  /* number of receive descriptors */
@@ -87,15 +87,19 @@
 #define KORINA_RBSIZE	1536 /* size of one resource buffer = Ether MTU */
 #define KORINA_RDS_MASK	(KORINA_NUM_RDS - 1)
 #define KORINA_TDS_MASK	(KORINA_NUM_TDS - 1)
-#define RD_RING_SIZE 	(KORINA_NUM_RDS * sizeof(struct dma_desc))
+#define RD_RING_SIZE	(KORINA_NUM_RDS * sizeof(struct dma_desc))
 #define TD_RING_SIZE	(KORINA_NUM_TDS * sizeof(struct dma_desc))
 
-#define TX_TIMEOUT 	(6000 * HZ / 1000)
+#define TX_TIMEOUT	(6000 * HZ / 1000)
 
-enum chain_status { desc_filled, desc_empty };
-#define IS_DMA_FINISHED(X)   (((X) & (DMA_DESC_FINI)) != 0)
-#define IS_DMA_DONE(X)   (((X) & (DMA_DESC_DONE)) != 0)
-#define RCVPKT_LENGTH(X)     (((X) & ETH_RX_LEN) >> ETH_RX_LEN_BIT)
+enum chain_status {
+	desc_filled,
+	desc_empty
+};
+
+#define IS_DMA_FINISHED(X)	(((X) & (DMA_DESC_FINI)) != 0)
+#define IS_DMA_DONE(X)		(((X) & (DMA_DESC_DONE)) != 0)
+#define RCVPKT_LENGTH(X)	(((X) & ETH_RX_LEN) >> ETH_RX_LEN_BIT)
 
 /* Information that need to be kept for each board. */
 struct korina_private {
@@ -123,7 +127,7 @@ struct korina_private {
 	int rx_irq;
 	int tx_irq;
 
-	spinlock_t lock;        /* NIC xmit lock */
+	spinlock_t lock;	/* NIC xmit lock */
 
 	int dma_halt_cnt;
 	int dma_run_cnt;
@@ -146,17 +150,17 @@ static inline void korina_start_dma(struct dma_reg *ch, u32 dma_addr)
 static inline void korina_abort_dma(struct net_device *dev,
 					struct dma_reg *ch)
 {
-       if (readl(&ch->dmac) & DMA_CHAN_RUN_BIT) {
-	       writel(0x10, &ch->dmac);
+	if (readl(&ch->dmac) & DMA_CHAN_RUN_BIT) {
+		writel(0x10, &ch->dmac);
 
-	       while (!(readl(&ch->dmas) & DMA_STAT_HALT))
-		       netif_trans_update(dev);
+		while (!(readl(&ch->dmas) & DMA_STAT_HALT))
+			netif_trans_update(dev);
 
-	       writel(0, &ch->dmas);
-       }
+		writel(0, &ch->dmas);
+	}
 
-       writel(0, &ch->dmadptr);
-       writel(0, &ch->dmandptr);
+	writel(0, &ch->dmadptr);
+	writel(0, &ch->dmandptr);
 }
 
 static inline void korina_chain_dma(struct dma_reg *ch, u32 dma_addr)
@@ -685,7 +689,7 @@ static int korina_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
 /* ethtool helpers */
 static void netdev_get_drvinfo(struct net_device *dev,
-			struct ethtool_drvinfo *info)
+				struct ethtool_drvinfo *info)
 {
 	struct korina_private *lp = netdev_priv(dev);
 
@@ -728,10 +732,10 @@ static u32 netdev_get_link(struct net_device *dev)
 }
 
 static const struct ethtool_ops netdev_ethtool_ops = {
-	.get_drvinfo            = netdev_get_drvinfo,
-	.get_link               = netdev_get_link,
-	.get_link_ksettings     = netdev_get_link_ksettings,
-	.set_link_ksettings     = netdev_set_link_ksettings,
+	.get_drvinfo		= netdev_get_drvinfo,
+	.get_link		= netdev_get_link,
+	.get_link_ksettings	= netdev_get_link_ksettings,
+	.set_link_ksettings	= netdev_set_link_ksettings,
 };
 
 static int korina_alloc_ring(struct net_device *dev)
@@ -863,7 +867,7 @@ static int korina_init(struct net_device *dev)
 	/* Management Clock Prescaler Divisor
 	 * Clock independent setting */
 	writel(((idt_cpu_freq) / MII_CLOCK + 1) & ~1,
-		       &lp->eth_regs->ethmcp);
+			&lp->eth_regs->ethmcp);
 
 	/* don't transmit until fifo contains 48b */
 	writel(48, &lp->eth_regs->ethfifott);
@@ -946,14 +950,14 @@ static int korina_open(struct net_device *dev)
 			0, "Korina ethernet Rx", dev);
 	if (ret < 0) {
 		printk(KERN_ERR "%s: unable to get Rx DMA IRQ %d\n",
-		    dev->name, lp->rx_irq);
+			dev->name, lp->rx_irq);
 		goto err_release;
 	}
 	ret = request_irq(lp->tx_irq, korina_tx_dma_interrupt,
 			0, "Korina ethernet Tx", dev);
 	if (ret < 0) {
 		printk(KERN_ERR "%s: unable to get Tx DMA IRQ %d\n",
-		    dev->name, lp->tx_irq);
+			dev->name, lp->tx_irq);
 		goto err_free_rx_irq;
 	}
 
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next v2 4/7] net: korina: use GRO
From: Roman Yeryomin @ 2017-09-17 17:24 UTC (permalink / raw)
  To: netdev

Performance gain when receiving locally is 55->95Mbps and 50->65Mbps for NAT.

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 drivers/net/ethernet/korina.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index c210add9b654..5f36e1703378 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -406,7 +406,7 @@ static int korina_rx(struct net_device *dev, int limit)
 		skb->protocol = eth_type_trans(skb, dev);
 
 		/* Pass the packet to upper layers */
-		netif_receive_skb(skb);
+		napi_gro_receive(&lp->napi, skb);
 		dev->stats.rx_packets++;
 		dev->stats.rx_bytes += pkt_len;
 
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next v2 3/7] net: korina: use NAPI_POLL_WEIGHT
From: Roman Yeryomin @ 2017-09-17 17:24 UTC (permalink / raw)
  To: netdev

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 drivers/net/ethernet/korina.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index e5466e19994a..c210add9b654 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -1082,7 +1082,7 @@ static int korina_probe(struct platform_device *pdev)
 	dev->netdev_ops = &korina_netdev_ops;
 	dev->ethtool_ops = &netdev_ethtool_ops;
 	dev->watchdog_timeo = TX_TIMEOUT;
-	netif_napi_add(dev, &lp->napi, korina_poll, 64);
+	netif_napi_add(dev, &lp->napi, korina_poll, NAPI_POLL_WEIGHT);
 
 	lp->phy_addr = (((lp->rx_irq == 0x2c? 1:0) << 8) | 0x05);
 	lp->mii_if.dev = dev;
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next v2 2/7] net: korina: optimize rx descriptor flags processing
From: Roman Yeryomin @ 2017-09-17 17:24 UTC (permalink / raw)
  To: netdev

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 drivers/net/ethernet/korina.c | 87 ++++++++++++++++++++++---------------------
 1 file changed, 44 insertions(+), 43 deletions(-)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index 98d686ed69a9..e5466e19994a 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -363,59 +363,60 @@ static int korina_rx(struct net_device *dev, int limit)
 		if ((KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) == 0)
 			break;
 
-		/* Update statistics counters */
-		if (devcs & ETH_RX_CRC)
-			dev->stats.rx_crc_errors++;
-		if (devcs & ETH_RX_LOR)
-			dev->stats.rx_length_errors++;
-		if (devcs & ETH_RX_LE)
-			dev->stats.rx_length_errors++;
-		if (devcs & ETH_RX_OVR)
-			dev->stats.rx_fifo_errors++;
-		if (devcs & ETH_RX_CV)
-			dev->stats.rx_frame_errors++;
-		if (devcs & ETH_RX_CES)
-			dev->stats.rx_length_errors++;
-		if (devcs & ETH_RX_MP)
-			dev->stats.multicast++;
-
-		if ((devcs & ETH_RX_LD) != ETH_RX_LD) {
-			/* check that this is a whole packet
-			 * WARNING: DMA_FD bit incorrectly set
-			 * in Rc32434 (errata ref #077) */
+		/* check that this is a whole packet
+		 * WARNING: DMA_FD bit incorrectly set
+		 * in Rc32434 (errata ref #077) */
+		if (!(devcs & ETH_RX_LD))
+			goto next;
+
+		if (!(devcs & ETH_RX_ROK)) {
+			/* Update statistics counters */
 			dev->stats.rx_errors++;
 			dev->stats.rx_dropped++;
-		} else if ((devcs & ETH_RX_ROK)) {
-			pkt_len = RCVPKT_LENGTH(devcs);
+			if (devcs & ETH_RX_CRC)
+				dev->stats.rx_crc_errors++;
+			if (devcs & ETH_RX_LE)
+				dev->stats.rx_length_errors++;
+			if (devcs & ETH_RX_OVR)
+				dev->stats.rx_fifo_errors++;
+			if (devcs & ETH_RX_CV)
+				dev->stats.rx_frame_errors++;
+			if (devcs & ETH_RX_CES)
+				dev->stats.rx_frame_errors++;
+
+			goto next;
+		}
 
-			/* must be the (first and) last
-			 * descriptor then */
-			pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data;
+		pkt_len = RCVPKT_LENGTH(devcs);
 
-			/* invalidate the cache */
-			dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4);
+		/* must be the (first and) last
+		 * descriptor then */
+		pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data;
 
-			/* Malloc up new buffer. */
-			skb_new = netdev_alloc_skb_ip_align(dev, KORINA_RBSIZE);
+		/* invalidate the cache */
+		dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4);
 
-			if (!skb_new)
-				break;
-			/* Do not count the CRC */
-			skb_put(skb, pkt_len - 4);
-			skb->protocol = eth_type_trans(skb, dev);
+		/* Malloc up new buffer. */
+		skb_new = netdev_alloc_skb_ip_align(dev, KORINA_RBSIZE);
 
-			/* Pass the packet to upper layers */
-			netif_receive_skb(skb);
-			dev->stats.rx_packets++;
-			dev->stats.rx_bytes += pkt_len;
+		if (!skb_new)
+			break;
+		/* Do not count the CRC */
+		skb_put(skb, pkt_len - 4);
+		skb->protocol = eth_type_trans(skb, dev);
 
-			/* Update the mcast stats */
-			if (devcs & ETH_RX_MP)
-				dev->stats.multicast++;
+		/* Pass the packet to upper layers */
+		netif_receive_skb(skb);
+		dev->stats.rx_packets++;
+		dev->stats.rx_bytes += pkt_len;
 
-			lp->rx_skb[lp->rx_next_done] = skb_new;
-		}
+		/* Update the mcast stats */
+		if (devcs & ETH_RX_MP)
+			dev->stats.multicast++;
+
+		lp->rx_skb[lp->rx_next_done] = skb_new;
 
+next:
 		rd->devcs = 0;
 
 		/* Restore descriptor's curr_addr */
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next v2 1/7] net: korina: don't use overflow and underflow interrupts
From: Roman Yeryomin @ 2017-09-17 17:24 UTC (permalink / raw)
  To: netdev

When such interrupts occur there is not much we can do.
Dropping the whole ring doesn't help and only produces high packet loss.
If we just ignore the interrupt the mac will drop one or few packets instead of the whole ring.
Also this will lower the irq handling load and increase performance.

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 drivers/net/ethernet/korina.c | 83 +------------------------------------------
 1 file changed, 1 insertion(+), 82 deletions(-)

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index 3c0a6451273d..98d686ed69a9 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -122,8 +122,6 @@ struct korina_private {
 
 	int rx_irq;
 	int tx_irq;
-	int ovr_irq;
-	int und_irq;
 
 	spinlock_t lock;        /* NIC xmit lock */
 
@@ -891,8 +889,6 @@ static void korina_restart_task(struct work_struct *work)
 	 */
 	disable_irq(lp->rx_irq);
 	disable_irq(lp->tx_irq);
-	disable_irq(lp->ovr_irq);
-	disable_irq(lp->und_irq);
 
 	writel(readl(&lp->tx_dma_regs->dmasm) |
 				DMA_STAT_FINI | DMA_STAT_ERR,
@@ -911,40 +907,10 @@ static void korina_restart_task(struct work_struct *work)
 	}
 	korina_multicast_list(dev);
 
-	enable_irq(lp->und_irq);
-	enable_irq(lp->ovr_irq);
 	enable_irq(lp->tx_irq);
 	enable_irq(lp->rx_irq);
 }
 
-static void korina_clear_and_restart(struct net_device *dev, u32 value)
-{
-	struct korina_private *lp = netdev_priv(dev);
-
-	netif_stop_queue(dev);
-	writel(value, &lp->eth_regs->ethintfc);
-	schedule_work(&lp->restart_task);
-}
-
-/* Ethernet Tx Underflow interrupt */
-static irqreturn_t korina_und_interrupt(int irq, void *dev_id)
-{
-	struct net_device *dev = dev_id;
-	struct korina_private *lp = netdev_priv(dev);
-	unsigned int und;
-
-	spin_lock(&lp->lock);
-
-	und = readl(&lp->eth_regs->ethintfc);
-
-	if (und & ETH_INT_FC_UND)
-		korina_clear_and_restart(dev, und & ~ETH_INT_FC_UND);
-
-	spin_unlock(&lp->lock);
-
-	return IRQ_HANDLED;
-}
-
 static void korina_tx_timeout(struct net_device *dev)
 {
 	struct korina_private *lp = netdev_priv(dev);
@@ -952,25 +918,6 @@ static void korina_tx_timeout(struct net_device *dev)
 	schedule_work(&lp->restart_task);
 }
 
-/* Ethernet Rx Overflow interrupt */
-static irqreturn_t
-korina_ovr_interrupt(int irq, void *dev_id)
-{
-	struct net_device *dev = dev_id;
-	struct korina_private *lp = netdev_priv(dev);
-	unsigned int ovr;
-
-	spin_lock(&lp->lock);
-	ovr = readl(&lp->eth_regs->ethintfc);
-
-	if (ovr & ETH_INT_FC_OVR)
-		korina_clear_and_restart(dev, ovr & ~ETH_INT_FC_OVR);
-
-	spin_unlock(&lp->lock);
-
-	return IRQ_HANDLED;
-}
-
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void korina_poll_controller(struct net_device *dev)
 {
@@ -993,8 +940,7 @@ static int korina_open(struct net_device *dev)
 	}
 
 	/* Install the interrupt handler
-	 * that handles the Done Finished
-	 * Ovr and Und Events */
+	 * that handles the Done Finished */
 	ret = request_irq(lp->rx_irq, korina_rx_dma_interrupt,
 			0, "Korina ethernet Rx", dev);
 	if (ret < 0) {
@@ -1010,31 +956,10 @@ static int korina_open(struct net_device *dev)
 		goto err_free_rx_irq;
 	}
 
-	/* Install handler for overrun error. */
-	ret = request_irq(lp->ovr_irq, korina_ovr_interrupt,
-			0, "Ethernet Overflow", dev);
-	if (ret < 0) {
-		printk(KERN_ERR "%s: unable to get OVR IRQ %d\n",
-		    dev->name, lp->ovr_irq);
-		goto err_free_tx_irq;
-	}
-
-	/* Install handler for underflow error. */
-	ret = request_irq(lp->und_irq, korina_und_interrupt,
-			0, "Ethernet Underflow", dev);
-	if (ret < 0) {
-		printk(KERN_ERR "%s: unable to get UND IRQ %d\n",
-		    dev->name, lp->und_irq);
-		goto err_free_ovr_irq;
-	}
 	mod_timer(&lp->media_check_timer, jiffies + 1);
 out:
 	return ret;
 
-err_free_ovr_irq:
-	free_irq(lp->ovr_irq, dev);
-err_free_tx_irq:
-	free_irq(lp->tx_irq, dev);
 err_free_rx_irq:
 	free_irq(lp->rx_irq, dev);
 err_release:
@@ -1052,8 +977,6 @@ static int korina_close(struct net_device *dev)
 	/* Disable interrupts */
 	disable_irq(lp->rx_irq);
 	disable_irq(lp->tx_irq);
-	disable_irq(lp->ovr_irq);
-	disable_irq(lp->und_irq);
 
 	korina_abort_tx(dev);
 	tmp = readl(&lp->tx_dma_regs->dmasm);
@@ -1073,8 +996,6 @@ static int korina_close(struct net_device *dev)
 
 	free_irq(lp->rx_irq, dev);
 	free_irq(lp->tx_irq, dev);
-	free_irq(lp->ovr_irq, dev);
-	free_irq(lp->und_irq, dev);
 
 	return 0;
 }
@@ -1113,8 +1034,6 @@ static int korina_probe(struct platform_device *pdev)
 
 	lp->rx_irq = platform_get_irq_byname(pdev, "korina_rx");
 	lp->tx_irq = platform_get_irq_byname(pdev, "korina_tx");
-	lp->ovr_irq = platform_get_irq_byname(pdev, "korina_ovr");
-	lp->und_irq = platform_get_irq_byname(pdev, "korina_und");
 
 	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "korina_regs");
 	dev->base_addr = r->start;
-- 
2.11.0

^ permalink raw reply related

* [PATCH net-next v2 0/7] korina: performance fixes and cleanup
From: Roman Yeryomin @ 2017-09-17 17:23 UTC (permalink / raw)
  To: netdev

Changes from v1:
- use GRO instead of increasing ring size
- use NAPI_POLL_WEIGHT instead of defining own NAPI_WEIGHT
- optimize rx descriptor flags processing

Roman Yeryomin (7):
  net: korina: don't use overflow and underflow interrupts
  net: korina: optimize rx descriptor flags processing
  net: korina: use NAPI_POLL_WEIGHT
  net: korina: use GRO
  net: korina: whitespace cleanup
  net: korina: update authors
  net: korina: bump version

 drivers/net/ethernet/korina.c | 230 ++++++++++++++----------------------------
 1 file changed, 78 insertions(+), 152 deletions(-)

-- 
2.11.0

^ permalink raw reply

* Dear Talented
From: Kim Sharma @ 2017-09-17 13:13 UTC (permalink / raw)
  To: Recipients

Dear Talented,

I am Talent Scout For BLUE SKY FILM STUDIO, Present Blue sky Studio a
Film Corporation Located in the United State, is Soliciting for the
Right to use Your Photo/Face and Personality as One of the Semi -Major
Role/ Character in our Upcoming ANIMATED Stereoscope 3D Movie-The Story
of Anubis (Anubis 2018) The Movie is Currently Filming (In
Production) Please Note That There Will Be No Auditions, Traveling or
Any Special / Professional Acting Skills, Since the Production of This
Movie Will Be Done with our State of Art Computer -Generating Imagery
Equipment. We Are Prepared to Pay the Total Sum of $620,000.00 USD. For
More Information/Understanding, Please Write us on the E-Mail Below.
CONTACT EMAIL: Blueskyanimatedstudio@usa.com
All Reply to: Blueskyanimatedstudio@usa.com
Note: Only the Response send to this mail will be Given a Prior
Consideration.


Talent Scout
Kim Sharma

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox