Netdev List
 help / color / mirror / Atom feed
* [PATCH V3 net-next 15/17] net: hns3: add support for querying advertised pause frame by ethtool ethx
From: Lipeng @ 2017-12-20  8:43 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, linuxarm, salil.mehta, lipeng321
In-Reply-To: <1513759399-40915-1-git-send-email-lipeng321@huawei.com>

This patch adds support for querying advertised pause frame by using
ethtool command(ethtool ethx).

Fixes: 496d03e960ae ("net: hns3: Add Ethtool support to HNS3 driver")
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: Lipeng <lipeng321@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hnae3.h             |  2 ++
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c      | 15 +++++++++++++++
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 15 +++++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index a67d02a9..82e9a80 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -394,6 +394,8 @@ struct hnae3_ae_ops {
 	void (*get_tqps_and_rss_info)(struct hnae3_handle *h,
 				      u16 *free_tqps, u16 *max_rss_size);
 	int (*set_channels)(struct hnae3_handle *handle, u32 new_tqps_num);
+	void (*get_flowctrl_adv)(struct hnae3_handle *handle,
+				 u32 *flowctrl_adv);
 };
 
 struct hnae3_dcb_ops {
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index b829ec7..2ae4d39 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -575,6 +575,7 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
 				   struct ethtool_link_ksettings *cmd)
 {
 	struct hnae3_handle *h = hns3_get_handle(netdev);
+	u32 flowctrl_adv = 0;
 	u32 supported_caps;
 	u32 advertised_caps;
 	u8 media_type = HNAE3_MEDIA_TYPE_UNKNOWN;
@@ -650,6 +651,8 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
 		if (!cmd->base.autoneg)
 			advertised_caps &= ~HNS3_LM_AUTONEG_BIT;
 
+		advertised_caps &= ~HNS3_LM_PAUSE_BIT;
+
 		/* now, map driver link modes to ethtool link modes */
 		hns3_driv_to_eth_caps(supported_caps, cmd, false);
 		hns3_driv_to_eth_caps(advertised_caps, cmd, true);
@@ -662,6 +665,18 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
 	/* 4.mdio_support */
 	cmd->base.mdio_support = ETH_MDIO_SUPPORTS_C22;
 
+	/* 5.get flow control setttings */
+	if (h->ae_algo->ops->get_flowctrl_adv)
+		h->ae_algo->ops->get_flowctrl_adv(h, &flowctrl_adv);
+
+	if (flowctrl_adv & ADVERTISED_Pause)
+		ethtool_link_ksettings_add_link_mode(cmd, advertising,
+						     Pause);
+
+	if (flowctrl_adv & ADVERTISED_Asym_Pause)
+		ethtool_link_ksettings_add_link_mode(cmd, advertising,
+						     Asym_Pause);
+
 	return 0;
 }
 
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index bb31212..4d69688 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -4660,6 +4660,20 @@ static u32 hclge_get_fw_version(struct hnae3_handle *handle)
 	return hdev->fw_version;
 }
 
+static void hclge_get_flowctrl_adv(struct hnae3_handle *handle,
+				   u32 *flowctrl_adv)
+{
+	struct hclge_vport *vport = hclge_get_vport(handle);
+	struct hclge_dev *hdev = vport->back;
+	struct phy_device *phydev = hdev->hw.mac.phydev;
+
+	if (!phydev)
+		return;
+
+	*flowctrl_adv |= (phydev->advertising & ADVERTISED_Pause) |
+			 (phydev->advertising & ADVERTISED_Asym_Pause);
+}
+
 static void hclge_set_flowctrl_adv(struct hclge_dev *hdev, u32 rx_en, u32 tx_en)
 {
 	struct phy_device *phydev = hdev->hw.mac.phydev;
@@ -5478,6 +5492,7 @@ static int hclge_set_channels(struct hnae3_handle *handle, u32 new_tqps_num)
 	.get_tqps_and_rss_info = hclge_get_tqps_and_rss_info,
 	.set_channels = hclge_set_channels,
 	.get_channels = hclge_get_channels,
+	.get_flowctrl_adv = hclge_get_flowctrl_adv,
 };
 
 static struct hnae3_ae_algo ae_algo = {
-- 
1.9.1

^ permalink raw reply related

* [PATCH V3 net-next 16/17] net: hns3: Increase the default depth of bucket for TM shaper
From: Lipeng @ 2017-12-20  8:43 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, linuxarm, salil.mehta, lipeng321
In-Reply-To: <1513759399-40915-1-git-send-email-lipeng321@huawei.com>

Burstiness of a flow is determined by the depth of a bucket, When the
upper rate of shaper is large, the current depth of a bucket is not
enough.

The default upper rate of shaper is 100G, so increase the depth of
a bucket according to UM.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Lipeng <lipeng321@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
index 7cfe1eb..ea9355d 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
@@ -23,8 +23,8 @@ enum hclge_shaper_level {
 	HCLGE_SHAPER_LVL_PF	= 1,
 };
 
-#define HCLGE_SHAPER_BS_U_DEF	1
-#define HCLGE_SHAPER_BS_S_DEF	4
+#define HCLGE_SHAPER_BS_U_DEF	5
+#define HCLGE_SHAPER_BS_S_DEF	20
 
 #define HCLGE_ETHER_MAX_RATE	100000
 
-- 
1.9.1

^ permalink raw reply related

* Re: [patch iproute2] tc: add -bs option for batch mode
From: Or Gerlitz @ 2017-12-20  8:47 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Chris Mi, Linux Netdev List
In-Reply-To: <20171219071547.35b002c8@xeon-e3>

On Tue, Dec 19, 2017 at 5:15 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Tue, 19 Dec 2017 15:33:46 +0900
> Chris Mi <chrism@mellanox.com> wrote:
>
>> Currently in tc batch mode, only one command is read from the batch
>> file and sent to kernel to process. With this patch, we can accumulate
>> several commands before sending to kernel. The batch size is specified
>> using option -bs or -batchsize.
>>
>> To accumulate the commands in tc, we allocate an array of struct iovec.
>> If batchsize is bigger than 1 and we haven't accumulated enough
>> commands, rtnl_talk() will return without actually sending the message.
>> One exception is that there is no more command in the batch file.
>>
>> But please note that kernel still processes the requests one by one.
>> To process the requests in parallel in kernel is another effort.
>> The time we're saving in this patch is the user mode and kernel mode
>> context switch. So this patch works on top of the current kernel.
>>
>> Using the following script in kernel, we can generate 1,000,000 rules.
>>       tools/testing/selftests/tc-testing/tdc_batch.py
>>
>> Without this patch, 'tc -b $file' exection time is:
>>
>> real    0m14.916s
>> user    0m6.808s
>> sys     0m8.046s
>>
>> With this patch, 'tc -b $file -bs 10' exection time is:
>>
>> real    0m12.286s
>> user    0m5.903s
>> sys     0m6.312s
>>
>> The insertion rate is improved more than 10%.
>>
>> Signed-off-by: Chris Mi <chrism@mellanox.com>
>
> I think this is probably optimizing for an unrealistic use case.
> If there are 1M rules then it should be managed by a dynamic process
> like a routing daemon with a real database and API. Such a daemon
> would talk to kernel directly. Plus at scale netlink gets overwhelmed
> and the daemon has to handle resync.

Standalone tools such as ip and tc are indeed used many ties mostly at staging,
development and performance benchmarking environments (where applications on
production systems (e.g FRR or OVS) would embed the NL code in house
and do direct
calls into the kernel).  As such, I think there's a value to max out
the tc tool ability to add flows.

> Not convinced that the added complexity and error handling issues
> warrant the change. The batch mode already sucks at handling errors.

Lets have Chris fix the patch and see how the revised bits look.

Or.

^ permalink raw reply

* [PATCH net v2] ipv4: Fix use-after-free when flushing FIB tables
From: Ido Schimmel @ 2017-12-20  8:51 UTC (permalink / raw)
  To: netdev; +Cc: davem, alexander.h.duyck, dsahern, fengguang.wu, mlxsw,
	Ido Schimmel

Since commit 0ddcf43d5d4a ("ipv4: FIB Local/MAIN table collapse") the
local table uses the same trie allocated for the main table when custom
rules are not in use.

When a net namespace is dismantled, the main table is flushed and freed
(via an RCU callback) before the local table. In case the callback is
invoked before the local table is iterated, a use-after-free can occur.

Fix this by iterating over the FIB tables in reverse order, so that the
main table is always freed after the local table.

v2: Add a comment to make the fix more explicit per Dave's and Alex's
feedback.

Fixes: 0ddcf43d5d4a ("ipv4: FIB Local/MAIN table collapse")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
---
 net/ipv4/fib_frontend.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index f52d27a422c3..08ce7f14ede1 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1298,14 +1298,17 @@ static int __net_init ip_fib_net_init(struct net *net)
 
 static void ip_fib_net_exit(struct net *net)
 {
-	unsigned int i;
+	int i;
 
 	rtnl_lock();
 #ifdef CONFIG_IP_MULTIPLE_TABLES
 	RCU_INIT_POINTER(net->ipv4.fib_main, NULL);
 	RCU_INIT_POINTER(net->ipv4.fib_default, NULL);
 #endif
-	for (i = 0; i < FIB_TABLE_HASHSZ; i++) {
+	/* The local table must be destroyed before the main table,
+	 * as it might be using main's trie.
+	 */
+	for (i = FIB_TABLE_HASHSZ - 1; i >= 0; i--) {
 		struct hlist_head *head = &net->ipv4.fib_table_hash[i];
 		struct hlist_node *tmp;
 		struct fib_table *tb;
-- 
2.14.3

^ permalink raw reply related

* [QUESTION] Doubt about NAPI_GRO_CB(skb)->is_atomic in tcpv4 gro process
From: Yunsheng Lin @ 2017-12-20  9:09 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: alexander.duyck, davem@davemloft.net, linuxarm@huawei.com,
	yuxiaowu, wzhen.wang, Xuehuahu

Hi, all
	I have some doubt about NAPI_GRO_CB(skb)->is_atomic when
analyzing the tcpv4 gro process:

Firstly we set NAPI_GRO_CB(skb)->is_atomic to 1 in dev_gro_receive:
https://elixir.free-electrons.com/linux/v4.15-rc4/source/net/core/dev.c#L4838

And then in inet_gro_receive, we check the NAPI_GRO_CB(skb)->is_atomic
before setting NAPI_GRO_CB(skb)->is_atomic according to IP_DF bit in the ip header:
https://elixir.free-electrons.com/linux/v4.15-rc4/source/net/ipv4/af_inet.c#L1319

struct sk_buff **inet_gro_receive(struct sk_buff **head, struct sk_buff *skb)
{
.....................
	for (p = *head; p; p = p->next) {
........................

		/* If the previous IP ID value was based on an atomic
		 * datagram we can overwrite the value and ignore it.
		 */
		if (NAPI_GRO_CB(skb)->is_atomic)                      //we check it here
			NAPI_GRO_CB(p)->flush_id = flush_id;
		else
			NAPI_GRO_CB(p)->flush_id |= flush_id;
	}

	NAPI_GRO_CB(skb)->is_atomic = !!(iph->frag_off & htons(IP_DF));  //we set it here
	NAPI_GRO_CB(skb)->flush |= flush;
	skb_set_network_header(skb, off);
................................
}

My question is whether we should check the NAPI_GRO_CB(skb)->is_atomic or NAPI_GRO_CB(p)->is_atomic?
If we should check NAPI_GRO_CB(skb)->is_atomic, then maybe it is unnecessary because it is alway true.
If we should check NAPI_GRO_CB(p)->is_atomic, maybe there is a bug here.

So what is the logic here? I am just start analyzing the gro, maybe I miss something obvious here.

^ permalink raw reply

* RE: [patch iproute2] tc: add -bs option for batch mode
From: Chris Mi @ 2017-12-20  9:23 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev@vger.kernel.org, gerlitz.or@gmail.com
In-Reply-To: <20171219072231.055bcc9d@xeon-e3>

> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Tuesday, December 19, 2017 11:23 PM
> To: Chris Mi <chrism@mellanox.com>
> Cc: netdev@vger.kernel.org; gerlitz.or@gmail.com
> Subject: Re: [patch iproute2] tc: add -bs option for batch mode
> 
> On Tue, 19 Dec 2017 15:33:46 +0900
> Chris Mi <chrism@mellanox.com> wrote:
> 
> > Currently in tc batch mode, only one command is read from the batch
> > file and sent to kernel to process. With this patch, we can accumulate
> > several commands before sending to kernel. The batch size is specified
> > using option -bs or -batchsize.
> >
> > To accumulate the commands in tc, we allocate an array of struct iovec.
> > If batchsize is bigger than 1 and we haven't accumulated enough
> > commands, rtnl_talk() will return without actually sending the message.
> > One exception is that there is no more command in the batch file.
> >
> > But please note that kernel still processes the requests one by one.
> > To process the requests in parallel in kernel is another effort.
> > The time we're saving in this patch is the user mode and kernel mode
> > context switch. So this patch works on top of the current kernel.
> >
> > Using the following script in kernel, we can generate 1,000,000 rules.
> > 	tools/testing/selftests/tc-testing/tdc_batch.py
> >
> > Without this patch, 'tc -b $file' exection time is:
> >
> > real    0m14.916s
> > user    0m6.808s
> > sys     0m8.046s
> >
> > With this patch, 'tc -b $file -bs 10' exection time is:
> >
> > real    0m12.286s
> > user    0m5.903s
> > sys     0m6.312s
> >
> > The insertion rate is improved more than 10%.
> >
> > Signed-off-by: Chris Mi <chrism@mellanox.com>
> > ---
> >  include/libnetlink.h | 27 ++++++++++++++++
> >  include/utils.h      |  8 +++++
> >  lib/libnetlink.c     | 30 +++++++++++++-----
> >  lib/utils.c          | 20 ++++++++++++
> >  man/man8/tc.8        |  5 +++
> >  tc/m_action.c        | 63 ++++++++++++++++++++++++++++---------
> >  tc/tc.c              | 27 ++++++++++++++--
> >  tc/tc_common.h       |  3 ++
> >  tc/tc_filter.c       | 89 ++++++++++++++++++++++++++++++++++++---------
> -------
> >  9 files changed, 221 insertions(+), 51 deletions(-)
> 
> In addition to my earlier comments, these are the implementation issues.
> 
> >
> > diff --git a/include/libnetlink.h b/include/libnetlink.h index
> > a4d83b9e..07e88c94 100644
> > --- a/include/libnetlink.h
> > +++ b/include/libnetlink.h
> > @@ -13,6 +13,8 @@
> >  #include <linux/netconf.h>
> >  #include <arpa/inet.h>
> >
> > +#define MSG_IOV_MAX 256
> > +
> >  struct rtnl_handle {
> >  	int			fd;
> >  	struct sockaddr_nl	local;
> > @@ -93,6 +95,31 @@ int rtnl_dump_filter_nc(struct rtnl_handle *rth,
> >  			void *arg, __u16 nc_flags);
> >  #define rtnl_dump_filter(rth, filter, arg) \
> >  	rtnl_dump_filter_nc(rth, filter, arg, 0)
> > +
> > +extern int msg_iov_index;
> > +static inline int get_msg_iov_index(void) {
> > +	return msg_iov_index;
> > +}
> > +static inline void set_msg_iov_index(int index) {
> > +	msg_iov_index = index;
> > +}
> > +static inline void incr_msg_iov_index(void) {
> > +	++msg_iov_index;
> > +}
> > +
> > +extern int batch_size;
> > +static inline int get_batch_size(void) {
> > +	return batch_size;
> > +}
> > +static inline void set_batch_size(int size) {
> > +	batch_size = size;
> > +}
> 
> Iproute2 is C not C++; no accessors for every variable.
I have changed them to C style.
> 
> 
> >  int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
> >  	      struct nlmsghdr **answer)
> >  	__attribute__((warn_unused_result));
> > diff --git a/include/utils.h b/include/utils.h index
> > d3895d56..66cb4747 100644
> > --- a/include/utils.h
> > +++ b/include/utils.h
> > @@ -235,6 +235,14 @@ void print_nlmsg_timestamp(FILE *fp, const struct
> > nlmsghdr *n);
> >
> >  extern int cmdlineno;
> >  ssize_t getcmdline(char **line, size_t *len, FILE *in);
> > +
> > +extern int cmdlinetotal;
> > +static inline int getcmdlinetotal(void) {
> > +	return cmdlinetotal;
> > +}
> > +void setcmdlinetotal(const char *name);
> > +
> >  int makeargs(char *line, char *argv[], int maxargs);  int
> > inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6);
> >
> > diff --git a/lib/libnetlink.c b/lib/libnetlink.c index
> > 00e6ce0c..f9be1c6d 100644
> > --- a/lib/libnetlink.c
> > +++ b/lib/libnetlink.c
> > @@ -24,6 +24,7 @@
> >  #include <sys/uio.h>
> >
> >  #include "libnetlink.h"
> > +#include "utils.h"
> >
> >  #ifndef SOL_NETLINK
> >  #define SOL_NETLINK 270
> > @@ -581,6 +582,10 @@ static void rtnl_talk_error(struct nlmsghdr *h,
> struct nlmsgerr *err,
> >  		strerror(-err->error));
> >  }
> >
> > +static struct iovec msg_iov[MSG_IOV_MAX]; int msg_iov_index; int
> > +batch_size = 1;
> > +
> >  static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
> >  		       struct nlmsghdr **answer,
> >  		       bool show_rtnl_err, nl_ext_ack_fn_t errfn) @@ -589,23
> > +594,34 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr
> *n,
> >  	unsigned int seq;
> >  	struct nlmsghdr *h;
> >  	struct sockaddr_nl nladdr = { .nl_family = AF_NETLINK };
> > -	struct iovec iov = {
> > -		.iov_base = n,
> > -		.iov_len = n->nlmsg_len
> > -	};
> > +	struct iovec *iov = &msg_iov[get_msg_iov_index()];
> > +	int index;
> > +	char *buf;
> > +
> > +	iov->iov_base = n;
> > +	iov->iov_len = n->nlmsg_len;
> > +
> > +	incr_msg_iov_index();
> >  	struct msghdr msg = {
> >  		.msg_name = &nladdr,
> >  		.msg_namelen = sizeof(nladdr),
> > -		.msg_iov = &iov,
> > -		.msg_iovlen = 1,
> > +		.msg_iov = msg_iov,
> > +		.msg_iovlen = get_msg_iov_index(),
> >  	};
> > -	char *buf;
> >
> >  	n->nlmsg_seq = seq = ++rtnl->seq;
> >
> >  	if (answer == NULL)
> >  		n->nlmsg_flags |= NLM_F_ACK;
> 
> Your real performance win is just not asking for ACK for every rule.
No. Even if batch_size > 1, we ack every rule. The real performance win is
to send multiple rules in one system call. If we are not asking for ACK for every rule,
the performance will be improved further.
> If you switched to pure streaming mode, then the batching wouldn't be
> necessary.
> 
> >
> > +	index = get_msg_iov_index() % get_batch_size();
> > +	if (index != 0 && get_batch_size() > 1 &&
> > +	    cmdlineno != getcmdlinetotal() &&
> > +	    (n->nlmsg_type == RTM_NEWTFILTER ||
> > +	    n->nlmsg_type == RTM_NEWACTION))
> > +		return 3;
> > +	set_msg_iov_index(index);
> > +
> >  	status = sendmsg(rtnl->fd, &msg, 0);
> >  	if (status < 0) {
> >  		perror("Cannot talk to rtnetlink"); diff --git a/lib/utils.c
> > b/lib/utils.c index 7ced8c06..53ca389f 100644
> > --- a/lib/utils.c
> > +++ b/lib/utils.c
> > @@ -1202,6 +1202,26 @@ ssize_t getcmdline(char **linep, size_t *lenp,
> FILE *in)
> >  	return cc;
> >  }
> >
> > +int cmdlinetotal;
> > +
> > +void setcmdlinetotal(const char *name) {
> > +	char *line = NULL;
> > +	size_t len = 0;
> > +
> > +	if (name && strcmp(name, "-") != 0) {
> > +		if (freopen(name, "r", stdin) == NULL) {
> > +			fprintf(stderr, "Cannot open file \"%s\" for
> reading: %s\n",
> > +				name, strerror(errno));
> > +			return;
> > +		}
> > +	}
> > +
> > +	cmdlinetotal = 0;
> > +	while (getcmdline(&line, &len, stdin) != -1)
> > +		cmdlinetotal++;
> > +}
> > +
> >  /* split command line into argument vector */  int makeargs(char
> > *line, char *argv[], int maxargs)  { diff --git a/man/man8/tc.8
> > b/man/man8/tc.8 index ff071b33..de137e16 100644
> > --- a/man/man8/tc.8
> > +++ b/man/man8/tc.8
> > @@ -601,6 +601,11 @@ must exist already.
> >  read commands from provided file or standard input and invoke them.
> >  First failure will cause termination of tc.
> >
> > +.TP
> > +.BR "\-bs", " \-bs size", " \-batchsize", " \-batchsize size"
> > +How many commands are accumulated before sending to kernel.
> > +By default, it is 1. It only takes effect in batch mode.
> > +
> >  .TP
> >  .BR "\-force"
> >  don't terminate tc on errors in batch mode.
> > diff --git a/tc/m_action.c b/tc/m_action.c index 13f942bf..574b78ca
> > 100644
> > --- a/tc/m_action.c
> > +++ b/tc/m_action.c
> > @@ -23,6 +23,7 @@
> >  #include <arpa/inet.h>
> >  #include <string.h>
> >  #include <dlfcn.h>
> > +#include <errno.h>
> >
> >  #include "utils.h"
> >  #include "tc_common.h"
> > @@ -546,33 +547,65 @@ bad_val:
> >  	return ret;
> >  }
> >
> > +typedef struct {
> > +	struct nlmsghdr		n;
> > +	struct tcamsg		t;
> > +	char			buf[MAX_MSG];
> > +} tc_action_req;
> > +
> > +static tc_action_req *action_reqs;
> > +
> > +void free_action_reqs(void)
> > +{
> > +	if (action_reqs)
> > +		free(action_reqs);
> > +}
> > +
> > +static tc_action_req *get_action_req(void) {
> > +	tc_action_req *req;
> > +
> > +	if (action_reqs == NULL) {
> > +		action_reqs = malloc(get_batch_size() * sizeof
> (tc_action_req));
> > +		if (action_reqs == NULL)
> > +			return NULL;
> > +	}
> > +	req = &action_reqs[get_msg_iov_index()];
> > +	memset(req, 0, sizeof (*req));
> > +
> > +	return req;
> > +}
> > +
> >  static int tc_action_modify(int cmd, unsigned int flags,
> >  			    int *argc_p, char ***argv_p)
> >  {
> >  	int argc = *argc_p;
> >  	char **argv = *argv_p;
> >  	int ret = 0;
> > -	struct {
> > -		struct nlmsghdr         n;
> > -		struct tcamsg           t;
> > -		char                    buf[MAX_MSG];
> > -	} req = {
> > -		.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcamsg)),
> > -		.n.nlmsg_flags = NLM_F_REQUEST | flags,
> > -		.n.nlmsg_type = cmd,
> > -		.t.tca_family = AF_UNSPEC,
> > -	};
> > -	struct rtattr *tail = NLMSG_TAIL(&req.n);
> > +	tc_action_req *req;
> > +
> > +	req = get_action_req();
> > +	if (req == NULL) {
> > +		fprintf(stderr, "get_action_req error: not enough buffer\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcamsg));
> > +	req->n.nlmsg_flags = NLM_F_REQUEST | flags;
> > +	req->n.nlmsg_type = cmd;
> > +	req->t.tca_family = AF_UNSPEC;
> > +	struct rtattr *tail = NLMSG_TAIL(&req->n);
> >
> >  	argc -= 1;
> >  	argv += 1;
> > -	if (parse_action(&argc, &argv, TCA_ACT_TAB, &req.n)) {
> > +	if (parse_action(&argc, &argv, TCA_ACT_TAB, &req->n)) {
> >  		fprintf(stderr, "Illegal \"action\"\n");
> >  		return -1;
> >  	}
> > -	tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail;
> > +	tail->rta_len = (void *) NLMSG_TAIL(&req->n) - (void *) tail;
> >
> > -	if (rtnl_talk(&rth, &req.n, NULL) < 0) {
> > +	ret = rtnl_talk(&rth, &req->n, NULL);
> > +	if (ret < 0) {
> >  		fprintf(stderr, "We have an error talking to the kernel\n");
> >  		ret = -1;
> >  	}
> > @@ -739,5 +772,5 @@ int do_action(int argc, char **argv)
> >  			return -1;
> >  	}
> >
> > -	return 0;
> > +	return ret;
> >  }
> > diff --git a/tc/tc.c b/tc/tc.c
> > index ad9f07e9..9c8e828b 100644
> > --- a/tc/tc.c
> > +++ b/tc/tc.c
> > @@ -189,7 +189,7 @@ static void usage(void)
> >  	fprintf(stderr, "Usage: tc [ OPTIONS ] OBJECT { COMMAND |
> help }\n"
> >  			"       tc [-force] -batch filename\n"
> >  			"where  OBJECT := { qdisc | class | filter | action |
> monitor | exec }\n"
> > -	                "       OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] |
> -b[atch] [filename] | -n[etns] name |\n"
> > +	                "       OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] |
> -b[atch] [filename] | -bs | -batchsize [size] | -n[etns] name |\n"
> >  			"                    -nm | -nam[es] | { -cf | -conf } path } | -
> j[son]\n");
> >  }
> >
> > @@ -223,6 +223,9 @@ static int batch(const char *name)
> >  	size_t len = 0;
> >  	int ret = 0;
> >
> > +	if (get_batch_size() > 1)
> > +		setcmdlinetotal(name);
> > +
> >  	batch_mode = 1;
> >  	if (name && strcmp(name, "-") != 0) {
> >  		if (freopen(name, "r", stdin) == NULL) { @@ -248,15 +251,22
> @@
> > static int batch(const char *name)
> >  		if (largc == 0)
> >  			continue;	/* blank line */
> >
> > -		if (do_cmd(largc, largv)) {
> > +		ret = do_cmd(largc, largv);
> > +		if (ret != 0 && ret != 3) {
> >  			fprintf(stderr, "Command failed %s:%d\n", name,
> cmdlineno);
> >  			ret = 1;
> >  			if (!force)
> >  				break;
> >  		}
> >  	}
> > +	if (ret == 3)
> > +		fprintf(stderr,
> > +			"Command is not sent to kernel due to internal
> error %s:%d\n",
> > +			name, cmdlineno);
> >  	if (line)
> >  		free(line);
> > +	free_filter_reqs();
> > +	free_action_reqs();
> >
> >  	rtnl_close(&rth);
> >  	return ret;
> > @@ -267,6 +277,7 @@ int main(int argc, char **argv)  {
> >  	int ret;
> >  	char *batch_file = NULL;
> > +	int size;
> >
> >  	while (argc > 1) {
> >  		if (argv[1][0] != '-')
> > @@ -297,6 +308,16 @@ int main(int argc, char **argv)
> >  			if (argc <= 1)
> >  				usage();
> >  			batch_file = argv[1];
> > +		} else if (matches(argv[1], "-batchsize") == 0 ||
> > +				matches(argv[1], "-bs") == 0) {
> > +			argc--;	argv++;
> > +			if (argc <= 1)
> > +				usage();
> > +			size = atoi(argv[1]);
> > +			if (size > MSG_IOV_MAX)
> > +				set_batch_size(MSG_IOV_MAX);
> > +			else
> > +				set_batch_size(size);
> >  		} else if (matches(argv[1], "-netns") == 0) {
> >  			NEXT_ARG();
> >  			if (netns_switch(argv[1]))
> > @@ -342,6 +363,8 @@ int main(int argc, char **argv)
> >  	}
> >
> >  	ret = do_cmd(argc-1, argv+1);
> > +	free_filter_reqs();
> > +	free_action_reqs();
> >  Exit:
> >  	rtnl_close(&rth);
> >
> > diff --git a/tc/tc_common.h b/tc/tc_common.h index 264fbdac..fde8db1b
> > 100644
> > --- a/tc/tc_common.h
> > +++ b/tc/tc_common.h
> > @@ -24,5 +24,8 @@ struct tc_sizespec;
> >  extern int parse_size_table(int *p_argc, char ***p_argv, struct
> > tc_sizespec *s);  extern int check_size_table_opts(struct tc_sizespec
> > *s);
> >
> > +extern void free_filter_reqs(void);
> > +extern void free_action_reqs(void);
> > +
> >  extern int show_graph;
> >  extern bool use_names;
> > diff --git a/tc/tc_filter.c b/tc/tc_filter.c index 545cc3a1..dc53c128
> > 100644
> > --- a/tc/tc_filter.c
> > +++ b/tc/tc_filter.c
> > @@ -19,6 +19,7 @@
> >  #include <arpa/inet.h>
> >  #include <string.h>
> >  #include <linux/if_ether.h>
> > +#include <errno.h>
> >
> >  #include "rt_names.h"
> >  #include "utils.h"
> > @@ -42,18 +43,51 @@ static void usage(void)
> >  		"OPTIONS := ... try tc filter add <desired FILTER_KIND>
> help\n");
> > }
> >
> > +typedef struct {
> > +	struct nlmsghdr		n;
> > +	struct tcmsg		t;
> > +	char			buf[MAX_MSG];
> > +} tc_filter_req;
> > +
> > +static tc_filter_req *filter_reqs;
> > +
> > +void free_filter_reqs(void)
> > +{
> > +	if (filter_reqs)
> > +		free(filter_reqs);
> > +}
> 
> You don't need to check for NULL when calling free.
> free(NULL) is a nop.
Done.

^ permalink raw reply

* [patch iproute2 v2] tc: add -bs option for batch mode
From: Chris Mi @ 2017-12-20  9:26 UTC (permalink / raw)
  To: netdev; +Cc: gerlitz.or

Currently in tc batch mode, only one command is read from the batch
file and sent to kernel to process. With this patch, we can accumulate
several commands before sending to kernel. The batch size is specified
using option -bs or -batchsize.

To accumulate the commands in tc, we allocate an array of struct iovec.
If batchsize is bigger than 1 and we haven't accumulated enough
commands, rtnl_talk() will return without actually sending the message.
One exception is that there is no more command in the batch file.

But please note that kernel still processes the requests one by one.
To process the requests in parallel in kernel is another effort.
The time we're saving in this patch is the user mode and kernel mode
context switch. So this patch works on top of the current kernel.

Using the following script in kernel, we can generate 1,000,000 rules.
        tools/testing/selftests/tc-testing/tdc_batch.py

Without this patch, 'tc -b $file' exection time is:

real    0m14.916s
user    0m6.808s
sys     0m8.046s

With this patch, 'tc -b $file -bs 10' exection time is:

real    0m12.286s
user    0m5.903s
sys     0m6.312s

The insertion rate is improved more than 10%.

Signed-off-by: Chris Mi <chrism@mellanox.com>
---
 include/libnetlink.h |  6 ++++
 include/utils.h      |  4 +++
 lib/libnetlink.c     | 25 ++++++++++-----
 lib/utils.c          | 20 ++++++++++++
 man/man8/tc.8        |  5 +++
 tc/m_action.c        | 62 +++++++++++++++++++++++++++---------
 tc/tc.c              | 24 ++++++++++++--
 tc/tc_common.h       |  3 ++
 tc/tc_filter.c       | 88 ++++++++++++++++++++++++++++++++++++----------------
 9 files changed, 186 insertions(+), 51 deletions(-)

diff --git a/include/libnetlink.h b/include/libnetlink.h
index a4d83b9e..775f830b 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -13,6 +13,8 @@
 #include <linux/netconf.h>
 #include <arpa/inet.h>
 
+#define MSG_IOV_MAX 256
+
 struct rtnl_handle {
 	int			fd;
 	struct sockaddr_nl	local;
@@ -93,6 +95,10 @@ int rtnl_dump_filter_nc(struct rtnl_handle *rth,
 			void *arg, __u16 nc_flags);
 #define rtnl_dump_filter(rth, filter, arg) \
 	rtnl_dump_filter_nc(rth, filter, arg, 0)
+
+extern int msg_iov_index;
+extern int batch_size;
+
 int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
 	      struct nlmsghdr **answer)
 	__attribute__((warn_unused_result));
diff --git a/include/utils.h b/include/utils.h
index d3895d56..113a8c31 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -235,6 +235,10 @@ void print_nlmsg_timestamp(FILE *fp, const struct nlmsghdr *n);
 
 extern int cmdlineno;
 ssize_t getcmdline(char **line, size_t *len, FILE *in);
+
+extern int cmdlinetotal;
+void setcmdlinetotal(const char *name);
+
 int makeargs(char *line, char *argv[], int maxargs);
 int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6);
 
diff --git a/lib/libnetlink.c b/lib/libnetlink.c
index 00e6ce0c..7ff32d64 100644
--- a/lib/libnetlink.c
+++ b/lib/libnetlink.c
@@ -24,6 +24,7 @@
 #include <sys/uio.h>
 
 #include "libnetlink.h"
+#include "utils.h"
 
 #ifndef SOL_NETLINK
 #define SOL_NETLINK 270
@@ -581,6 +582,10 @@ static void rtnl_talk_error(struct nlmsghdr *h, struct nlmsgerr *err,
 		strerror(-err->error));
 }
 
+static struct iovec msg_iov[MSG_IOV_MAX];
+int msg_iov_index;
+int batch_size = 1;
+
 static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
 		       struct nlmsghdr **answer,
 		       bool show_rtnl_err, nl_ext_ack_fn_t errfn)
@@ -589,23 +594,29 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
 	unsigned int seq;
 	struct nlmsghdr *h;
 	struct sockaddr_nl nladdr = { .nl_family = AF_NETLINK };
-	struct iovec iov = {
-		.iov_base = n,
-		.iov_len = n->nlmsg_len
-	};
+	struct iovec *iov = &msg_iov[msg_iov_index];
+	char *buf;
+
+	iov->iov_base = n;
+	iov->iov_len = n->nlmsg_len;
+
 	struct msghdr msg = {
 		.msg_name = &nladdr,
 		.msg_namelen = sizeof(nladdr),
-		.msg_iov = &iov,
-		.msg_iovlen = 1,
+		.msg_iov = msg_iov,
+		.msg_iovlen = ++msg_iov_index,
 	};
-	char *buf;
 
 	n->nlmsg_seq = seq = ++rtnl->seq;
 
 	if (answer == NULL)
 		n->nlmsg_flags |= NLM_F_ACK;
 
+	msg_iov_index %= batch_size;
+	if (msg_iov_index != 0 && batch_size > 1 && cmdlineno != cmdlinetotal &&
+	    (n->nlmsg_type == RTM_NEWTFILTER || n->nlmsg_type == RTM_NEWACTION))
+		return 3;
+
 	status = sendmsg(rtnl->fd, &msg, 0);
 	if (status < 0) {
 		perror("Cannot talk to rtnetlink");
diff --git a/lib/utils.c b/lib/utils.c
index 7ced8c06..53ca389f 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -1202,6 +1202,26 @@ ssize_t getcmdline(char **linep, size_t *lenp, FILE *in)
 	return cc;
 }
 
+int cmdlinetotal;
+
+void setcmdlinetotal(const char *name)
+{
+	char *line = NULL;
+	size_t len = 0;
+
+	if (name && strcmp(name, "-") != 0) {
+		if (freopen(name, "r", stdin) == NULL) {
+			fprintf(stderr, "Cannot open file \"%s\" for reading: %s\n",
+				name, strerror(errno));
+			return;
+		}
+	}
+
+	cmdlinetotal = 0;
+	while (getcmdline(&line, &len, stdin) != -1)
+		cmdlinetotal++;
+}
+
 /* split command line into argument vector */
 int makeargs(char *line, char *argv[], int maxargs)
 {
diff --git a/man/man8/tc.8 b/man/man8/tc.8
index ff071b33..de137e16 100644
--- a/man/man8/tc.8
+++ b/man/man8/tc.8
@@ -601,6 +601,11 @@ must exist already.
 read commands from provided file or standard input and invoke them.
 First failure will cause termination of tc.
 
+.TP
+.BR "\-bs", " \-bs size", " \-batchsize", " \-batchsize size"
+How many commands are accumulated before sending to kernel.
+By default, it is 1. It only takes effect in batch mode.
+
 .TP
 .BR "\-force"
 don't terminate tc on errors in batch mode.
diff --git a/tc/m_action.c b/tc/m_action.c
index 13f942bf..99c75da6 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -23,6 +23,7 @@
 #include <arpa/inet.h>
 #include <string.h>
 #include <dlfcn.h>
+#include <errno.h>
 
 #include "utils.h"
 #include "tc_common.h"
@@ -546,33 +547,64 @@ bad_val:
 	return ret;
 }
 
+typedef struct {
+	struct nlmsghdr		n;
+	struct tcamsg		t;
+	char			buf[MAX_MSG];
+} tc_action_req;
+
+static tc_action_req *action_reqs;
+
+void free_action_reqs(void)
+{
+	free(action_reqs);
+}
+
+static tc_action_req *get_action_req(void)
+{
+	tc_action_req *req;
+
+	if (action_reqs == NULL) {
+		action_reqs = malloc(batch_size * sizeof (tc_action_req));
+		if (action_reqs == NULL)
+			return NULL;
+	}
+	req = &action_reqs[msg_iov_index];
+	memset(req, 0, sizeof (*req));
+
+	return req;
+}
+
 static int tc_action_modify(int cmd, unsigned int flags,
 			    int *argc_p, char ***argv_p)
 {
 	int argc = *argc_p;
 	char **argv = *argv_p;
 	int ret = 0;
-	struct {
-		struct nlmsghdr         n;
-		struct tcamsg           t;
-		char                    buf[MAX_MSG];
-	} req = {
-		.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcamsg)),
-		.n.nlmsg_flags = NLM_F_REQUEST | flags,
-		.n.nlmsg_type = cmd,
-		.t.tca_family = AF_UNSPEC,
-	};
-	struct rtattr *tail = NLMSG_TAIL(&req.n);
+	tc_action_req *req;
+
+	req = get_action_req();
+	if (req == NULL) {
+		fprintf(stderr, "get_action_req error: not enough buffer\n");
+		return -ENOMEM;
+	}
+
+	req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcamsg));
+	req->n.nlmsg_flags = NLM_F_REQUEST | flags;
+	req->n.nlmsg_type = cmd;
+	req->t.tca_family = AF_UNSPEC;
+	struct rtattr *tail = NLMSG_TAIL(&req->n);
 
 	argc -= 1;
 	argv += 1;
-	if (parse_action(&argc, &argv, TCA_ACT_TAB, &req.n)) {
+	if (parse_action(&argc, &argv, TCA_ACT_TAB, &req->n)) {
 		fprintf(stderr, "Illegal \"action\"\n");
 		return -1;
 	}
-	tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail;
+	tail->rta_len = (void *) NLMSG_TAIL(&req->n) - (void *) tail;
 
-	if (rtnl_talk(&rth, &req.n, NULL) < 0) {
+	ret = rtnl_talk(&rth, &req->n, NULL);
+	if (ret < 0) {
 		fprintf(stderr, "We have an error talking to the kernel\n");
 		ret = -1;
 	}
@@ -739,5 +771,5 @@ int do_action(int argc, char **argv)
 			return -1;
 	}
 
-	return 0;
+	return ret;
 }
diff --git a/tc/tc.c b/tc/tc.c
index ad9f07e9..d63e7c03 100644
--- a/tc/tc.c
+++ b/tc/tc.c
@@ -189,7 +189,7 @@ static void usage(void)
 	fprintf(stderr, "Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }\n"
 			"       tc [-force] -batch filename\n"
 			"where  OBJECT := { qdisc | class | filter | action | monitor | exec }\n"
-	                "       OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] | -b[atch] [filename] | -n[etns] name |\n"
+	                "       OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] | -b[atch] [filename] | -bs | -batchsize [size] | -n[etns] name |\n"
 			"                    -nm | -nam[es] | { -cf | -conf } path } | -j[son]\n");
 }
 
@@ -223,6 +223,9 @@ static int batch(const char *name)
 	size_t len = 0;
 	int ret = 0;
 
+	if (batch_size > 1)
+		setcmdlinetotal(name);
+
 	batch_mode = 1;
 	if (name && strcmp(name, "-") != 0) {
 		if (freopen(name, "r", stdin) == NULL) {
@@ -248,15 +251,22 @@ static int batch(const char *name)
 		if (largc == 0)
 			continue;	/* blank line */
 
-		if (do_cmd(largc, largv)) {
+		ret = do_cmd(largc, largv);
+		if (ret < 0) {
 			fprintf(stderr, "Command failed %s:%d\n", name, cmdlineno);
 			ret = 1;
 			if (!force)
 				break;
 		}
 	}
+	if (batch_size > 1 && ret == 3)
+		fprintf(stderr,
+			"Command is not sent to kernel due to internal error %s:%d\n",
+			name, cmdlineno);
 	if (line)
 		free(line);
+	free_filter_reqs();
+	free_action_reqs();
 
 	rtnl_close(&rth);
 	return ret;
@@ -297,6 +307,14 @@ int main(int argc, char **argv)
 			if (argc <= 1)
 				usage();
 			batch_file = argv[1];
+		} else if (matches(argv[1], "-batchsize") == 0 ||
+				matches(argv[1], "-bs") == 0) {
+			argc--;	argv++;
+			if (argc <= 1)
+				usage();
+			batch_size = atoi(argv[1]);
+			if (batch_size > MSG_IOV_MAX)
+				batch_size = MSG_IOV_MAX;
 		} else if (matches(argv[1], "-netns") == 0) {
 			NEXT_ARG();
 			if (netns_switch(argv[1]))
@@ -342,6 +360,8 @@ int main(int argc, char **argv)
 	}
 
 	ret = do_cmd(argc-1, argv+1);
+	free_filter_reqs();
+	free_action_reqs();
 Exit:
 	rtnl_close(&rth);
 
diff --git a/tc/tc_common.h b/tc/tc_common.h
index 264fbdac..fde8db1b 100644
--- a/tc/tc_common.h
+++ b/tc/tc_common.h
@@ -24,5 +24,8 @@ struct tc_sizespec;
 extern int parse_size_table(int *p_argc, char ***p_argv, struct tc_sizespec *s);
 extern int check_size_table_opts(struct tc_sizespec *s);
 
+extern void free_filter_reqs(void);
+extern void free_action_reqs(void);
+
 extern int show_graph;
 extern bool use_names;
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index 545cc3a1..89ac4402 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -19,6 +19,7 @@
 #include <arpa/inet.h>
 #include <string.h>
 #include <linux/if_ether.h>
+#include <errno.h>
 
 #include "rt_names.h"
 #include "utils.h"
@@ -42,18 +43,50 @@ static void usage(void)
 		"OPTIONS := ... try tc filter add <desired FILTER_KIND> help\n");
 }
 
+typedef struct {
+	struct nlmsghdr		n;
+	struct tcmsg		t;
+	char			buf[MAX_MSG];
+} tc_filter_req;
+
+static tc_filter_req *filter_reqs;
+
+void free_filter_reqs(void)
+{
+	free(filter_reqs);
+}
+
+static tc_filter_req *get_filter_req(void)
+{
+	tc_filter_req *req;
+
+	if (filter_reqs == NULL) {
+		filter_reqs = malloc(batch_size * sizeof (tc_filter_req));
+		if (filter_reqs == NULL)
+			return NULL;
+	}
+	req = &filter_reqs[msg_iov_index];
+	memset(req, 0, sizeof (*req));
+
+	return req;
+}
+
 static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
 {
-	struct {
-		struct nlmsghdr	n;
-		struct tcmsg		t;
-		char			buf[MAX_MSG];
-	} req = {
-		.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
-		.n.nlmsg_flags = NLM_F_REQUEST | flags,
-		.n.nlmsg_type = cmd,
-		.t.tcm_family = AF_UNSPEC,
-	};
+	tc_filter_req *req;
+	int ret;
+
+	req = get_filter_req();
+	if (req == NULL) {
+		fprintf(stderr, "get_filter_req error: not enough buffer\n");
+		return -ENOMEM;
+	}
+
+	req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg));
+	req->n.nlmsg_flags = NLM_F_REQUEST | flags;
+	req->n.nlmsg_type = cmd;
+	req->t.tcm_family = AF_UNSPEC;
+
 	struct filter_util *q = NULL;
 	__u32 prio = 0;
 	__u32 protocol = 0;
@@ -75,37 +108,37 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
 				duparg("dev", *argv);
 			strncpy(d, *argv, sizeof(d)-1);
 		} else if (strcmp(*argv, "root") == 0) {
-			if (req.t.tcm_parent) {
+			if (req->t.tcm_parent) {
 				fprintf(stderr,
 					"Error: \"root\" is duplicate parent ID\n");
 				return -1;
 			}
-			req.t.tcm_parent = TC_H_ROOT;
+			req->t.tcm_parent = TC_H_ROOT;
 		} else if (strcmp(*argv, "ingress") == 0) {
-			if (req.t.tcm_parent) {
+			if (req->t.tcm_parent) {
 				fprintf(stderr,
 					"Error: \"ingress\" is duplicate parent ID\n");
 				return -1;
 			}
-			req.t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
+			req->t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
 						     TC_H_MIN_INGRESS);
 		} else if (strcmp(*argv, "egress") == 0) {
-			if (req.t.tcm_parent) {
+			if (req->t.tcm_parent) {
 				fprintf(stderr,
 					"Error: \"egress\" is duplicate parent ID\n");
 				return -1;
 			}
-			req.t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
+			req->t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
 						     TC_H_MIN_EGRESS);
 		} else if (strcmp(*argv, "parent") == 0) {
 			__u32 handle;
 
 			NEXT_ARG();
-			if (req.t.tcm_parent)
+			if (req->t.tcm_parent)
 				duparg("parent", *argv);
 			if (get_tc_classid(&handle, *argv))
 				invarg("Invalid parent ID", *argv);
-			req.t.tcm_parent = handle;
+			req->t.tcm_parent = handle;
 		} else if (strcmp(*argv, "handle") == 0) {
 			NEXT_ARG();
 			if (fhandle)
@@ -152,26 +185,26 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
 		argc--; argv++;
 	}
 
-	req.t.tcm_info = TC_H_MAKE(prio<<16, protocol);
+	req->t.tcm_info = TC_H_MAKE(prio<<16, protocol);
 
 	if (chain_index_set)
-		addattr32(&req.n, sizeof(req), TCA_CHAIN, chain_index);
+		addattr32(&req->n, sizeof(*req), TCA_CHAIN, chain_index);
 
 	if (k[0])
-		addattr_l(&req.n, sizeof(req), TCA_KIND, k, strlen(k)+1);
+		addattr_l(&req->n, sizeof(*req), TCA_KIND, k, strlen(k)+1);
 
 	if (d[0])  {
 		ll_init_map(&rth);
 
-		req.t.tcm_ifindex = ll_name_to_index(d);
-		if (req.t.tcm_ifindex == 0) {
+		req->t.tcm_ifindex = ll_name_to_index(d);
+		if (req->t.tcm_ifindex == 0) {
 			fprintf(stderr, "Cannot find device \"%s\"\n", d);
 			return 1;
 		}
 	}
 
 	if (q) {
-		if (q->parse_fopt(q, fhandle, argc, argv, &req.n))
+		if (q->parse_fopt(q, fhandle, argc, argv, &req->n))
 			return 1;
 	} else {
 		if (fhandle) {
@@ -190,14 +223,15 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
 	}
 
 	if (est.ewma_log)
-		addattr_l(&req.n, sizeof(req), TCA_RATE, &est, sizeof(est));
+		addattr_l(&req->n, sizeof(*req), TCA_RATE, &est, sizeof(est));
 
-	if (rtnl_talk(&rth, &req.n, NULL) < 0) {
+	ret = rtnl_talk(&rth, &req->n, NULL);
+	if (ret < 0) {
 		fprintf(stderr, "We have an error talking to the kernel\n");
 		return 2;
 	}
 
-	return 0;
+	return ret;
 }
 
 static __u32 filter_parent;
-- 
2.14.3

^ permalink raw reply related

* Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
From: Felipe Balbi @ 2017-12-20  9:46 UTC (permalink / raw)
  To: Joe Perches, linux-arm-kernel, linux-acpi, openipmi-developer,
	intel-gfx, linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: devel, linux-fbdev, linux-sh, dri-devel, linux-input, linux-media
In-Reply-To: <cover.1513706701.git.joe@perches.com>


Hi,

Joe Perches <joe@perches.com> writes:
>  drivers/usb/phy/phy-tahvo.c                        |  2 +-

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>

-- 
balbi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply

* [PATCH net 1/2] dt-bindings: net: mediatek: add condition to property mediatek,pctl
From: sean.wang @ 2017-12-20  9:47 UTC (permalink / raw)
  To: robh+dt, davem, mark.rutland
  Cc: matthias.bgg, john, nbd, nelson.chang, devicetree,
	linux-arm-kernel, netdev, linux-kernel, linux-mediatek, Sean Wang

From: Sean Wang <sean.wang@mediatek.com>

The property "mediatek,pctl" is only required for SoCs such as MT2701 and
MT7623, so adding a few words for stating the condition.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 Documentation/devicetree/bindings/net/mediatek-net.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/mediatek-net.txt b/Documentation/devicetree/bindings/net/mediatek-net.txt
index 214eaa9..53c13ee 100644
--- a/Documentation/devicetree/bindings/net/mediatek-net.txt
+++ b/Documentation/devicetree/bindings/net/mediatek-net.txt
@@ -28,7 +28,7 @@ Required properties:
 - mediatek,sgmiisys: phandle to the syscon node that handles the SGMII setup
 	which is required for those SoCs equipped with SGMII such as MT7622 SoC.
 - mediatek,pctl: phandle to the syscon node that handles the ports slew rate
-	and driver current
+	and driver current: only for MT2701 and MT7623 SoC
 
 Optional properties:
 - interrupt-parent: Should be the phandle for the interrupt controller
-- 
2.7.4

^ permalink raw reply related

* [PATCH net 2/2] net: mediatek: remove superfluous pin setup for MT7622 SoC
From: sean.wang @ 2017-12-20  9:47 UTC (permalink / raw)
  To: robh+dt, davem, mark.rutland
  Cc: matthias.bgg, john, nbd, nelson.chang, devicetree,
	linux-arm-kernel, netdev, linux-kernel, linux-mediatek, Sean Wang
In-Reply-To: <e366efc29985d3292c8a1afb1389b5eac57c9037.1513762066.git.sean.wang@mediatek.com>

From: Sean Wang <sean.wang@mediatek.com>

Remove superfluous pin setup to get out of accessing invalid I/O pin
registers because the way for pin configuring tends to be different from
various SoCs and thus it should be better being managed and controlled by
the pinctrl driver which MT7622 already can support.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 35 +++++++++++++++++------------
 drivers/net/ethernet/mediatek/mtk_eth_soc.h |  3 +++
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index fc67e35..29826dd 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1952,14 +1952,16 @@ static int mtk_hw_init(struct mtk_eth *eth)
 	}
 	regmap_write(eth->ethsys, ETHSYS_SYSCFG0, val);
 
-	/* Set GE2 driving and slew rate */
-	regmap_write(eth->pctl, GPIO_DRV_SEL10, 0xa00);
+	if (eth->pctl) {
+		/* Set GE2 driving and slew rate */
+		regmap_write(eth->pctl, GPIO_DRV_SEL10, 0xa00);
 
-	/* set GE2 TDSEL */
-	regmap_write(eth->pctl, GPIO_OD33_CTRL8, 0x5);
+		/* set GE2 TDSEL */
+		regmap_write(eth->pctl, GPIO_OD33_CTRL8, 0x5);
 
-	/* set GE2 TUNE */
-	regmap_write(eth->pctl, GPIO_BIAS_CTRL, 0x0);
+		/* set GE2 TUNE */
+		regmap_write(eth->pctl, GPIO_BIAS_CTRL, 0x0);
+	}
 
 	/* Set linkdown as the default for each GMAC. Its own MCR would be set
 	 * up with the more appropriate value when mtk_phy_link_adjust call is
@@ -2538,11 +2540,13 @@ static int mtk_probe(struct platform_device *pdev)
 		}
 	}
 
-	eth->pctl = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
-						    "mediatek,pctl");
-	if (IS_ERR(eth->pctl)) {
-		dev_err(&pdev->dev, "no pctl regmap found\n");
-		return PTR_ERR(eth->pctl);
+	if (eth->soc->required_pctl) {
+		eth->pctl = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+							    "mediatek,pctl");
+		if (IS_ERR(eth->pctl)) {
+			dev_err(&pdev->dev, "no pctl regmap found\n");
+			return PTR_ERR(eth->pctl);
+		}
 	}
 
 	for (i = 0; i < 3; i++) {
@@ -2668,17 +2672,20 @@ static int mtk_remove(struct platform_device *pdev)
 
 static const struct mtk_soc_data mt2701_data = {
 	.caps = MTK_GMAC1_TRGMII,
-	.required_clks = MT7623_CLKS_BITMAP
+	.required_clks = MT7623_CLKS_BITMAP,
+	.required_pctl = true,
 };
 
 static const struct mtk_soc_data mt7622_data = {
 	.caps = MTK_DUAL_GMAC_SHARED_SGMII | MTK_GMAC1_ESW,
-	.required_clks = MT7622_CLKS_BITMAP
+	.required_clks = MT7622_CLKS_BITMAP,
+	.required_pctl = false,
 };
 
 static const struct mtk_soc_data mt7623_data = {
 	.caps = MTK_GMAC1_TRGMII,
-	.required_clks = MT7623_CLKS_BITMAP
+	.required_clks = MT7623_CLKS_BITMAP,
+	.required_pctl = true,
 };
 
 const struct of_device_id of_mtk_match[] = {
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index a3af466..672b8c3 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -573,10 +573,13 @@ struct mtk_rx_ring {
  * @caps			Flags shown the extra capability for the SoC
  * @required_clks		Flags shown the bitmap for required clocks on
  *				the target SoC
+ * @required_pctl		A bool value to show whether the SoC requires
+ *				the extra setup for those pins used by GMAC.
  */
 struct mtk_soc_data {
 	u32		caps;
 	u32		required_clks;
+	bool		required_pctl;
 };
 
 /* currently no SoC has more than 2 macs */
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH v4 33/36] net: faraday add nds32 support.
From: kbuild test robot @ 2017-12-20  9:54 UTC (permalink / raw)
  To: Greentime Hu
  Cc: kbuild-all, greentime, linux-kernel, arnd, linux-arch, tglx,
	jason, marc.zyngier, robh+dt, netdev, deanbo422, devicetree, viro,
	dhowells, will.deacon, daniel.lezcano, linux-serial,
	geert.uytterhoeven, linus.walleij, mark.rutland, greg, ren_guo,
	pombredanne, green.hu
In-Reply-To: <95be78502aa406f106ecbe87e751a45333883b1f.1513577007.git.green.hu@gmail.com>

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

Hi Greentime,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/timers/core]
[cannot apply to linus/master v4.15-rc4 next-20171220]
[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/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_set_page':
>> drivers/net/ethernet/faraday/ftmac100.c:288:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     rxdes->rxdes3 = (unsigned int)page;
                     ^
   drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_get_page':
>> drivers/net/ethernet/faraday/ftmac100.c:293:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return (struct page *)rxdes->rxdes3;
            ^
   drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_txdes_set_skb':
   drivers/net/ethernet/faraday/ftmac100.c:548:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     txdes->txdes3 = (unsigned int)skb;
                     ^
   drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_txdes_get_skb':
   drivers/net/ethernet/faraday/ftmac100.c:553:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return (struct sk_buff *)txdes->txdes3;
            ^

vim +288 drivers/net/ethernet/faraday/ftmac100.c

8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  281  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  282  /*
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  283   * rxdes3 is not used by hardware. We use it to keep track of page.
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  284   * Since hardware does not touch it, we can skip cpu_to_le32()/le32_to_cpu().
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  285   */
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  286  static void ftmac100_rxdes_set_page(struct ftmac100_rxdes *rxdes, struct page *page)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  287  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @288  	rxdes->rxdes3 = (unsigned int)page;
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  289  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  290  
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  291  static struct page *ftmac100_rxdes_get_page(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  292  {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @293  	return (struct page *)rxdes->rxdes3;
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  294  }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28  295  

:::::: The code at line 288 was first introduced by commit
:::::: 8d77c036b57cf813d838f859e11b6a188acdb1fb net: add Faraday FTMAC100 10/100 Ethernet driver

:::::: TO: Po-Yu Chuang <ratbert@faraday-tech.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
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: 52104 bytes --]

^ permalink raw reply

* Re: [PATCH v4 33/36] net: faraday add nds32 support.
From: Geert Uytterhoeven @ 2017-12-20  9:58 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Greentime Hu, kbuild-all-JC7UmRfGjtg, Greentime,
	Linux Kernel Mailing List, Arnd Bergmann, Linux-Arch,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring,
	netdev-u79uwXL29TY76Z2rM5mHXA, Vincent Chen,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Al Viro, David Howells,
	Will Deacon, Daniel Lezcano, linux-serial-u79uwXL29TY76Z2rM5mHXA,
	Linus Walleij, Mark Rutland, Greg KH,
	ren_guo-Y+KPrCd2zL4AvxtiuMwx3w
In-Reply-To: <201712201744.gsBDa4yK%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Wed, Dec 20, 2017 at 10:54 AM, kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on tip/timers/core]
> [cannot apply to linus/master v4.15-rc4 next-20171220]
> [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/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
> config: sparc64-allyesconfig (attached as .config)
> compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=sparc64
>
> All warnings (new ones prefixed by >>):
>
>    drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_set_page':
>>> drivers/net/ethernet/faraday/ftmac100.c:288:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>      rxdes->rxdes3 = (unsigned int)page;
>                      ^

The proper way to casts pointer to integers is to cast to "uintptr_t".

However, the address is stored in a 32-bit descriptor, which means it can
not work on 64-bit platforms.

Please make the driver depend on "!64BIT || BROKEN"

Cfr. commit 15bfe05c8d6386f1 ("net: ethernet: xilinx: Mark XILINX_LL_TEMAC
broken on 64-bit")

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v5 3/6] perf: implement pmu perf_kprobe
From: Peter Zijlstra @ 2017-12-20 10:03 UTC (permalink / raw)
  To: Song Liu; +Cc: rostedt, mingo, davem, netdev, linux-kernel, daniel, kernel-team
In-Reply-To: <20171206224518.3598254-6-songliubraving@fb.com>

On Wed, Dec 06, 2017 at 02:45:15PM -0800, Song Liu wrote:
> @@ -8537,7 +8620,7 @@ static int perf_event_set_filter(struct perf_event *event, void __user *arg)
>  	char *filter_str;
>  	int ret = -EINVAL;
>  
> -	if ((event->attr.type != PERF_TYPE_TRACEPOINT ||
> +	if ((!perf_event_is_tracing(event) ||
>  	     !IS_ENABLED(CONFIG_EVENT_TRACING)) &&
>  	    !has_addr_filter(event))
>  		return -EINVAL;

You actually missed an instance later in this same function... fixing
that.

^ permalink raw reply

* [net  1/1] tipc: remove joining group member from congested list
From: Jon Maloy @ 2017-12-20 10:03 UTC (permalink / raw)
  To: davem, netdev
  Cc: mohan.krishna.ghanta.krishnamurthy, tung.q.nguyen, hoang.h.le,
	jon.maloy, canh.d.luu, ying.xue, tipc-discussion

When we receive a JOIN message from a peer member, the message may
contain an advertised window value ADV_IDLE that permits removing the
member in question from the tipc_group::congested list. However, since
the removal has been made conditional on that the advertised window is
*not* ADV_IDLE, we miss this case. This has the effect that a sender
sometimes may enter a state of permanent, false, broadcast congestion.

We fix this by unconditinally removing the member from the congested
list before calling tipc_member_update(), which might potentially sort
it into the list again.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
 net/tipc/group.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/tipc/group.c b/net/tipc/group.c
index bbc004e..7ebbdeb 100644
--- a/net/tipc/group.c
+++ b/net/tipc/group.c
@@ -689,10 +689,8 @@ void tipc_group_proto_rcv(struct tipc_group *grp, bool *usr_wakeup,
 			msg_set_grp_bc_seqno(ehdr, m->bc_syncpt);
 			__skb_queue_tail(inputq, m->event_msg);
 		}
-		if (m->window < ADV_IDLE)
-			tipc_group_update_member(m, 0);
-		else
-			list_del_init(&m->congested);
+		list_del_init(&m->congested);
+		tipc_group_update_member(m, 0);
 		return;
 	case GRP_LEAVE_MSG:
 		if (!m)
-- 
2.1.4

^ permalink raw reply related

* Re: [PATCH v3 net-next 0/6] tls: Add generic NIC offload infrastructure
From: Jiri Pirko @ 2017-12-20 10:08 UTC (permalink / raw)
  To: Boris Pismenny
  Cc: Ilya Lesokhin, netdev@vger.kernel.org, davem@davemloft.net,
	davejwatson@fb.com, tom@herbertland.com,
	hannes@stressinduktion.org, Aviad Yehezkel, Liran Liss
In-Reply-To: <HE1PR0501MB223554DC2840A95B594ED0D1B00C0@HE1PR0501MB2235.eurprd05.prod.outlook.com>

Wed, Dec 20, 2017 at 09:28:03AM CET, borisp@mellanox.com wrote:
>
>> Tue, Dec 19, 2017 at 01:10:10AM CET, jiri@resnulli.us wrote:
>> 
>> Mon, Dec 18, 2017 at 06:10:10PM CET, jiri@resnulli.us wrote:
>> >Mon, Dec 18, 2017 at 12:10:27PM CET, ilyal@mellanox.com wrote:
>> >>Changes from v2:
>> >>- Fix sk use after free and possible netdev use after free
>> >>- tls device now keeps a refernce on the offloading netdev
>> >>- tls device registers to the netdev notifer.
>> >>  Upon a NETDEV_DOWN event, offload is stopped and
>> >>  the reference on the netdev is dropped.
>> >>- SW fallback support for skb->ip_summed != CHECKSUM_PARTIAL
>> >>- Merged TLS patches are no longer part of this series.
>> >>
>> >>Changes from v1:
>> >>- Remove the binding of the socket to a specific netdev
>> >>  through sk->sk_bound_dev_if.
>> >>  Add a check in validate_xmit_skb to detect route changes
>> >>  and call SW fallback code to do the crypto in software.
>> >>- tls_get_record now returns the tls record sequence number.
>> >>  This is required to support connections with rcd_sn != iv.
>> >>- Bug fixes to the TLS code.
>> >>
>> >>This patchset adds a generic infrastructure to offload TLS crypto to a
>> >>network devices.
>> >>
>> >>patches 1-2 Export functions that we need patch 3 adds infrastructue
>> >>for offloaded socket fallback patches 4-5 add new NDOs and
>> >>capabilities.
>> >>patch 6 adds the TLS NIC offload infrastructure.
>> >>
>> >>Github with mlx5e TLS offload support:
>> >>https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
>> git
>> >>hub.com%2FMellanox%2Ftls-
>> offload%2Ftree%2Ftls_device_v3&data=02%7C01%7
>> >>Cborisp%40mellanox.com%7C5aebe81262554f40221908d546cb7c37%7Ca6
>> 52971c7d
>> >>2e4d9ba6a4d149256f461b%7C0%7C0%7C636492762141202894&sdata=gYY
>> DEmspNfBs
>> >>aQhefcEojl456L9eWqZnEEI7iPCT0NA%3D&reserved=0
>> >
>> >I don't get it. You are pushing infra but not the actual driver part
>> >who is consuming the infra? Why?
>> 
>> Okay. Since the driver that uses the API introduced by this patchset is
>> missing, this patchset should be marked as RFC.
>> 
>> Dave, I see that you were about to apply v2. I'm sure you missed this.
>> Thanks.
>
>Isn't this a chicken and egg problem, where something must come first,
>driver or infra. Unless we combine the infra patches with mlx5 driver
>code and submit both in a single pull request.

Yes, you should submit that in a single patchset. That is the usual way.
Thanks.


>Here, we assumed that the infra goes first, and we will submit the
>driver soon after. We could submit the driver first instead.

No. You cannot do that like this.


>
>Dave, would you prefer to get the driver patches that use this infra before
>the infra?
>
>

^ permalink raw reply

* Re: [PATCH v10 1/5] add infrastructure for tagging functions as error injectable
From: Daniel Borkmann @ 2017-12-20 10:09 UTC (permalink / raw)
  To: Masami Hiramatsu, Alexei Starovoitov
  Cc: Josef Bacik, rostedt, mingo, davem, netdev, linux-kernel, ast,
	kernel-team, linux-btrfs, darrick.wong, Josef Bacik
In-Reply-To: <20171220161342.44443047f186b7a62efdfe1a@kernel.org>

On 12/20/2017 08:13 AM, Masami Hiramatsu wrote:
> On Tue, 19 Dec 2017 18:14:17 -0800
> Alexei Starovoitov <ast@fb.com> wrote:
[...]
>> Please make your suggestion as patches based on top of bpf-next.
> 
> bpf-next seems already pick this series. Would you mean I revert it and
> write new patch?

No, please submit as follow-ups instead, thanks Masami!

^ permalink raw reply

* Re: [PATCH v4 01/36] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU
From: kbuild test robot @ 2017-12-20 10:09 UTC (permalink / raw)
  To: Greentime Hu
  Cc: kbuild-all, greentime, linux-kernel, arnd, linux-arch, tglx,
	jason, marc.zyngier, robh+dt, netdev, deanbo422, devicetree, viro,
	dhowells, will.deacon, daniel.lezcano, linux-serial,
	geert.uytterhoeven, linus.walleij, mark.rutland, greg, ren_guo,
	pombredanne, green.hu, Vincent Chen
In-Reply-To: <d25ea659bc370a6bb24c4d42416f890a34051df1.1513577007.git.green.hu@gmail.com>

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

Hi Greentime,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/timers/core]
[also build test ERROR on v4.15-rc4 next-20171220]
[cannot apply to linus/master]
[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/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: sparc-defconfig (attached as .config)
compiler: sparc-linux-gcc (GCC) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc 

All error/warnings (new ones prefixed by >>):

   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
>> arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror]
    #define ioremap_nocache(X,Y) ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   include/asm-generic/io.h:865:0: note: this is the location of the previous definition
    #define ioremap_nocache ioremap_nocache
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror]
    #define ioremap_wc(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   include/asm-generic/io.h:881:0: note: this is the location of the previous definition
    #define ioremap_wc ioremap_wc
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror]
    #define ioremap_wt(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from arch/sparc/kernel/kernel.h:4,
                    from arch/sparc/kernel/traps_32.c:30:
   include/asm-generic/io.h:889:0: note: this is the location of the previous definition
    #define ioremap_wt ioremap_wt
    
   cc1: all warnings being treated as errors
--
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
>> arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror]
    #define ioremap_nocache(X,Y) ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:865:0: note: this is the location of the previous definition
    #define ioremap_nocache ioremap_nocache
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror]
    #define ioremap_wc(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:881:0: note: this is the location of the previous definition
    #define ioremap_wc ioremap_wc
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror]
    #define ioremap_wt(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:889:0: note: this is the location of the previous definition
    #define ioremap_wt ioremap_wt
    
>> arch/sparc/kernel/ioport.c:124:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size)
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   In file included from include/linux/linkage.h:6:0,
                    from include/linux/kernel.h:6,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from arch/sparc/kernel/ioport.c:28:
   arch/sparc/kernel/ioport.c:131:15: error: conflicting types for 'ioremap'
    EXPORT_SYMBOL(ioremap);
                  ^
   include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^~~
>> arch/sparc/kernel/ioport.c:131:1: note: in expansion of macro 'EXPORT_SYMBOL'
    EXPORT_SYMBOL(ioremap);
    ^~~~~~~~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc/kernel/ioport.c:36:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   cc1: all warnings being treated as errors
--
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
>> arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror]
    #define ioremap_nocache(X,Y) ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   include/asm-generic/io.h:865:0: note: this is the location of the previous definition
    #define ioremap_nocache ioremap_nocache
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror]
    #define ioremap_wc(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   include/asm-generic/io.h:881:0: note: this is the location of the previous definition
    #define ioremap_wc ioremap_wc
    
   In file included from arch/sparc/include/asm/io.h:6:0,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror]
    #define ioremap_wt(X,Y)  ioremap((X),(Y))
    
   In file included from arch/sparc/include/asm/io_32.h:13:0,
                    from arch/sparc/include/asm/io.h:6,
                    from include/linux/io.h:25,
                    from include/linux/irq.h:24,
                    from include/asm-generic/hardirq.h:12,
                    from arch/sparc/include/asm/hardirq_32.h:10,
                    from arch/sparc/include/asm/hardirq.h:6,
                    from include/linux/hardirq.h:8,
                    from include/linux/interrupt.h:12,
                    from include/linux/pci.h:31,
                    from arch/sparc//kernel/ioport.c:36:
   include/asm-generic/io.h:889:0: note: this is the location of the previous definition
    #define ioremap_wt ioremap_wt
    
   arch/sparc//kernel/ioport.c:124:15: error: conflicting types for 'ioremap'
    void __iomem *ioremap(unsigned long offset, unsigned long size)
                  ^~~~~~~

vim +/ioremap +129 arch/sparc/include/asm/io_32.h

f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  124  
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  125  /*
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  126   * Bus number may be embedded in the higher bits of the physical address.
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  127   * This is why we have no bus number argument to ioremap().
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  128   */
f05a6865 arch/sparc/include/asm/io_32.h Sam Ravnborg    2014-05-16 @129  void __iomem *ioremap(unsigned long offset, unsigned long size);
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  130  #define ioremap_nocache(X,Y)	ioremap((X),(Y))
428695b8 include/asm-sparc/io_32.h      David S. Miller 2008-07-22  131  #define ioremap_wc(X,Y)		ioremap((X),(Y))
556269c1 arch/sparc/include/asm/io_32.h Toshi Kani      2015-06-04  132  #define ioremap_wt(X,Y)		ioremap((X),(Y))
f05a6865 arch/sparc/include/asm/io_32.h Sam Ravnborg    2014-05-16  133  void iounmap(volatile void __iomem *addr);
f5e706ad include/asm-sparc/io_32.h      Sam Ravnborg    2008-07-17  134  

:::::: The code at line 129 was first introduced by commit
:::::: f05a68653e56ca2f23bccf7e50be69486886f052 sparc: drop use of extern for prototypes in arch/sparc/include/asm

:::::: TO: Sam Ravnborg <sam@ravnborg.org>
:::::: CC: David S. Miller <davem@davemloft.net>

---
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: 12283 bytes --]

^ permalink raw reply

* Re: [PATCH v4 01/36] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU
From: kbuild test robot @ 2017-12-20 10:10 UTC (permalink / raw)
  To: Greentime Hu
  Cc: kbuild-all, greentime, linux-kernel, arnd, linux-arch, tglx,
	jason, marc.zyngier, robh+dt, netdev, deanbo422, devicetree, viro,
	dhowells, will.deacon, daniel.lezcano, linux-serial,
	geert.uytterhoeven, linus.walleij, mark.rutland, greg, ren_guo,
	pombredanne, green.hu, Vincent Chen
In-Reply-To: <d25ea659bc370a6bb24c4d42416f890a34051df1.1513577007.git.green.hu@gmail.com>

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

Hi Greentime,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/timers/core]
[also build test ERROR on v4.15-rc4 next-20171220]
[cannot apply to linus/master]
[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/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or1k-linux-gcc (GCC) 6.0.0 20160327 (experimental)
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=openrisc 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/io.h:25:0,
                    from arch/openrisc/kernel/asm-offsets.c:35:
>> arch/openrisc/include/asm/io.h:38:29: error: conflicting types for 'ioremap'
    static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
                                ^~~~~~~
   In file included from arch/openrisc/include/asm/io.h:32:0,
                    from include/linux/io.h:25,
                    from arch/openrisc/kernel/asm-offsets.c:35:
   include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
    void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
                  ^~~~~~~
   include/asm-generic/io.h:865:25: error: conflicting types for 'ioremap_nocache'
    #define ioremap_nocache ioremap_nocache
                            ^
>> arch/openrisc/include/asm/io.h:44:29: note: in expansion of macro 'ioremap_nocache'
    static inline void __iomem *ioremap_nocache(phys_addr_t offset,
                                ^~~~~~~~~~~~~~~
   include/asm-generic/io.h:865:25: note: previous definition of 'ioremap_nocache' was here
    #define ioremap_nocache ioremap_nocache
                            ^
   include/asm-generic/io.h:866:29: note: in expansion of macro 'ioremap_nocache'
    static inline void __iomem *ioremap_nocache(phys_addr_t offset, size_t size)
                                ^~~~~~~~~~~~~~~
   make[2]: *** [arch/openrisc/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +/ioremap +38 arch/openrisc/include/asm/io.h

58e0166a Jonas Bonn  2011-06-04  31  
58e0166a Jonas Bonn  2011-06-04 @32  #include <asm-generic/io.h>
9b04ebd1 James Hogan 2012-10-23  33  #include <asm/pgtable.h>
58e0166a Jonas Bonn  2011-06-04  34  
58e0166a Jonas Bonn  2011-06-04  35  extern void __iomem *__ioremap(phys_addr_t offset, unsigned long size,
58e0166a Jonas Bonn  2011-06-04  36  				pgprot_t prot);
58e0166a Jonas Bonn  2011-06-04  37  
58e0166a Jonas Bonn  2011-06-04 @38  static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
58e0166a Jonas Bonn  2011-06-04  39  {
58e0166a Jonas Bonn  2011-06-04  40  	return __ioremap(offset, size, PAGE_KERNEL);
58e0166a Jonas Bonn  2011-06-04  41  }
58e0166a Jonas Bonn  2011-06-04  42  
58e0166a Jonas Bonn  2011-06-04  43  /* #define _PAGE_CI       0x002 */
58e0166a Jonas Bonn  2011-06-04 @44  static inline void __iomem *ioremap_nocache(phys_addr_t offset,
58e0166a Jonas Bonn  2011-06-04  45  					     unsigned long size)
58e0166a Jonas Bonn  2011-06-04  46  {
58e0166a Jonas Bonn  2011-06-04  47  	return __ioremap(offset, size,
58e0166a Jonas Bonn  2011-06-04  48  			 __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI));
58e0166a Jonas Bonn  2011-06-04  49  }
58e0166a Jonas Bonn  2011-06-04  50  

:::::: The code at line 38 was first introduced by commit
:::::: 58e0166a4772aaeb10c9b0f6d59f19099d2047df OpenRISC: Headers

:::::: TO: Jonas Bonn <jonas@southpole.se>
:::::: CC: Jonas Bonn <jonas@southpole.se>

---
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: 7613 bytes --]

^ permalink raw reply

* Re: [PATCH v5 3/6] perf: implement pmu perf_kprobe
From: Peter Zijlstra @ 2017-12-20 10:14 UTC (permalink / raw)
  To: Song Liu; +Cc: rostedt, mingo, davem, netdev, linux-kernel, daniel, kernel-team
In-Reply-To: <20171220100301.bvacqfua4hj2onzq@hirez.programming.kicks-ass.net>

On Wed, Dec 20, 2017 at 11:03:01AM +0100, Peter Zijlstra wrote:
> On Wed, Dec 06, 2017 at 02:45:15PM -0800, Song Liu wrote:
> > @@ -8537,7 +8620,7 @@ static int perf_event_set_filter(struct perf_event *event, void __user *arg)
> >  	char *filter_str;
> >  	int ret = -EINVAL;
> >  
> > -	if ((event->attr.type != PERF_TYPE_TRACEPOINT ||
> > +	if ((!perf_event_is_tracing(event) ||
> >  	     !IS_ENABLED(CONFIG_EVENT_TRACING)) &&
> >  	    !has_addr_filter(event))
> >  		return -EINVAL;
> 
> You actually missed an instance later in this same function... fixing
> that.


@@ -8518,23 +8601,19 @@ perf_event_set_addr_filter(struct perf_e
 
 static int perf_event_set_filter(struct perf_event *event, void __user *arg)
 {
-	char *filter_str;
 	int ret = -EINVAL;
-
-	if ((event->attr.type != PERF_TYPE_TRACEPOINT ||
-	    !IS_ENABLED(CONFIG_EVENT_TRACING)) &&
-	    !has_addr_filter(event))
-		return -EINVAL;
+	char *filter_str;
 
 	filter_str = strndup_user(arg, PAGE_SIZE);
 	if (IS_ERR(filter_str))
 		return PTR_ERR(filter_str);
 
-	if (IS_ENABLED(CONFIG_EVENT_TRACING) &&
-	    event->attr.type == PERF_TYPE_TRACEPOINT)
-		ret = ftrace_profile_set_filter(event, event->attr.config,
-						filter_str);
-	else if (has_addr_filter(event))
+#ifdef CONFIG_EVENT_TRACING
+	if (perf_event_is_tracing(event))
+		ret = ftrace_profile_set_filter(event, event->attr.config, filter_str);
+	else
+#endif
+	if (has_addr_filter(event))
 		ret = perf_event_set_addr_filter(event, filter_str);
 
 	kfree(filter_str);



Is that right?

^ permalink raw reply

* Re: [PATCH v3 net-next 0/6] tls: Add generic NIC offload infrastructure
From: Or Gerlitz @ 2017-12-20 10:15 UTC (permalink / raw)
  To: Boris Pismenny
  Cc: Jiri Pirko, Ilya Lesokhin, netdev@vger.kernel.org,
	davem@davemloft.net, davejwatson@fb.com, tom@herbertland.com,
	hannes@stressinduktion.org, Aviad Yehezkel, Liran Liss
In-Reply-To: <HE1PR0501MB223554DC2840A95B594ED0D1B00C0@HE1PR0501MB2235.eurprd05.prod.outlook.com>

On Wed, Dec 20, 2017 at 10:28 AM, Boris Pismenny <borisp@mellanox.com> wrote:

> Isn't this a chicken and egg problem, where something must come first,
> driver or infra. Unless we combine the infra patches with mlx5 driver
> code and submit both in a single pull request.

why chicken and egg? you do the infra changes and apply them on the driver.

> Here, we assumed that the infra goes first, and we will submit the
> driver soon after. We could submit the driver first instead.

NOo Boris,

It is fundamental requirement to show a use-case along with infra-structure.

Or.

^ permalink raw reply

* Re: [PATCH bpf-next 6/8] bpf: offload: report device information for offloaded programs
From: Daniel Borkmann @ 2017-12-20 10:19 UTC (permalink / raw)
  To: Jakub Kicinski, netdev, alexei.starovoitov
  Cc: ktkhai, oss-drivers, Eric W . Biederman
In-Reply-To: <20171220041006.25629-7-jakub.kicinski@netronome.com>

On 12/20/2017 05:10 AM, Jakub Kicinski wrote:
> Report to the user ifindex and namespace information of offloaded
> programs.  If device has disappeared return -ENODEV.  Specify the
> namespace using dev/inode combination.
> 
> CC: Eric W. Biederman <ebiederm@xmission.com>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>

Eric, would be great if you have a chance to review the nsfs bits, thanks a lot!

> ---
>  fs/nsfs.c                      |  2 +-
>  include/linux/bpf.h            |  2 ++
>  include/linux/proc_ns.h        |  1 +
>  include/uapi/linux/bpf.h       |  3 +++
>  kernel/bpf/offload.c           | 39 +++++++++++++++++++++++++++++++++++++++
>  kernel/bpf/syscall.c           |  6 ++++++
>  tools/include/uapi/linux/bpf.h |  3 +++
>  7 files changed, 55 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nsfs.c b/fs/nsfs.c
> index 7c6f76d29f56..e50628675935 100644
> --- a/fs/nsfs.c
> +++ b/fs/nsfs.c
> @@ -51,7 +51,7 @@ static void nsfs_evict(struct inode *inode)
>  	ns->ops->put(ns);
>  }
>  
> -static void *__ns_get_path(struct path *path, struct ns_common *ns)
> +void *__ns_get_path(struct path *path, struct ns_common *ns)
>  {
>  	struct vfsmount *mnt = nsfs_mnt;
>  	struct dentry *dentry;
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 9a916ab34299..7810ae57b357 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -531,6 +531,8 @@ static inline struct bpf_prog *bpf_prog_get_type(u32 ufd,
>  
>  int bpf_prog_offload_compile(struct bpf_prog *prog);
>  void bpf_prog_offload_destroy(struct bpf_prog *prog);
> +int bpf_prog_offload_info_fill(struct bpf_prog_info *info,
> +			       struct bpf_prog *prog);
>  
>  #if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL)
>  int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr);
> diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
> index 2ff18c9840a7..1733359cf713 100644
> --- a/include/linux/proc_ns.h
> +++ b/include/linux/proc_ns.h
> @@ -76,6 +76,7 @@ static inline int ns_alloc_inum(struct ns_common *ns)
>  
>  extern struct file *proc_ns_fget(int fd);
>  #define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private)
> +extern void *__ns_get_path(struct path *path, struct ns_common *ns);
>  extern void *ns_get_path(struct path *path, struct task_struct *task,
>  			const struct proc_ns_operations *ns_ops);
>  
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index d01f1cb3cfc0..72b37fc3bc0c 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -921,6 +921,9 @@ struct bpf_prog_info {
>  	__u32 nr_map_ids;
>  	__aligned_u64 map_ids;
>  	char name[BPF_OBJ_NAME_LEN];
> +	__u32 ifindex;
> +	__u64 netns_dev;
> +	__u64 netns_ino;
>  } __attribute__((aligned(8)));
>  
>  struct bpf_map_info {
> diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c
> index 1af94cb4f815..0543f24542ae 100644
> --- a/kernel/bpf/offload.c
> +++ b/kernel/bpf/offload.c
> @@ -16,9 +16,11 @@
>  #include <linux/bpf.h>
>  #include <linux/bpf_verifier.h>
>  #include <linux/bug.h>
> +#include <linux/kdev_t.h>
>  #include <linux/list.h>
>  #include <linux/netdevice.h>
>  #include <linux/printk.h>
> +#include <linux/proc_ns.h>
>  #include <linux/rtnetlink.h>
>  #include <linux/rwsem.h>
>  
> @@ -174,6 +176,43 @@ int bpf_prog_offload_compile(struct bpf_prog *prog)
>  	return bpf_prog_offload_translate(prog);
>  }
>  
> +int bpf_prog_offload_info_fill(struct bpf_prog_info *info,
> +			       struct bpf_prog *prog)
> +{
> +	struct bpf_dev_offload *offload;
> +	struct inode *ns_inode;
> +	struct path ns_path;
> +	struct net *net;
> +	void *ptr;
> +
> +again:
> +	down_read(&bpf_devs_lock);
> +	offload = prog->aux->offload;
> +	if (!offload) {
> +		up_read(&bpf_devs_lock);
> +		return -ENODEV;
> +	}
> +
> +	net = dev_net(offload->netdev);
> +	get_net(net); /* __ns_get_path() drops the reference */
> +
> +	ptr = __ns_get_path(&ns_path, &net->ns);
> +	if (IS_ERR(ptr)) {
> +		up_read(&bpf_devs_lock);
> +		if (PTR_ERR(ptr) == -EAGAIN)
> +			goto again;
> +		return PTR_ERR(ptr);
> +	}
> +	ns_inode = ns_path.dentry->d_inode;
> +
> +	info->ifindex = offload->netdev->ifindex;
> +	info->netns_dev = new_encode_dev(ns_inode->i_sb->s_dev);
> +	info->netns_ino = ns_inode->i_ino;
> +	up_read(&bpf_devs_lock);
> +
> +	return 0;
> +}
> +
>  const struct bpf_prog_ops bpf_offload_prog_ops = {
>  };
>  
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 7d9f5b0f0e49..20444fd678d0 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -1624,6 +1624,12 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
>  			return -EFAULT;
>  	}
>  
> +	if (bpf_prog_is_dev_bound(prog->aux)) {
> +		err = bpf_prog_offload_info_fill(&info, prog);
> +		if (err)
> +			return err;
> +	}
> +
>  done:
>  	if (copy_to_user(uinfo, &info, info_len) ||
>  	    put_user(info_len, &uattr->info.info_len))
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index db1b0923a308..4e8c60acfa32 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -921,6 +921,9 @@ struct bpf_prog_info {
>  	__u32 nr_map_ids;
>  	__aligned_u64 map_ids;
>  	char name[BPF_OBJ_NAME_LEN];
> +	__u32 ifindex;
> +	__u64 netns_dev;
> +	__u64 netns_ino;
>  } __attribute__((aligned(8)));
>  
>  struct bpf_map_info {
> 

^ permalink raw reply

* [PATCH net] ipv6: Honor specified parameters in fibmatch lookup
From: Ido Schimmel @ 2017-12-20 10:28 UTC (permalink / raw)
  To: netdev; +Cc: davem, roopa, dsahern, mlxsw, Ido Schimmel

Currently, parameters such as oif and source address are not taken into
account during fibmatch lookup. Example (IPv4 for reference) before
patch:

$ ip -4 route show
192.0.2.0/24 dev dummy0 proto kernel scope link src 192.0.2.1
198.51.100.0/24 dev dummy1 proto kernel scope link src 198.51.100.1

$ ip -6 route show
2001:db8:1::/64 dev dummy0 proto kernel metric 256 pref medium
2001:db8:2::/64 dev dummy1 proto kernel metric 256 pref medium
fe80::/64 dev dummy0 proto kernel metric 256 pref medium
fe80::/64 dev dummy1 proto kernel metric 256 pref medium

$ ip -4 route get fibmatch 192.0.2.2 oif dummy0
192.0.2.0/24 dev dummy0 proto kernel scope link src 192.0.2.1
$ ip -4 route get fibmatch 192.0.2.2 oif dummy1
RTNETLINK answers: No route to host

$ ip -6 route get fibmatch 2001:db8:1::2 oif dummy0
2001:db8:1::/64 dev dummy0 proto kernel metric 256 pref medium
$ ip -6 route get fibmatch 2001:db8:1::2 oif dummy1
2001:db8:1::/64 dev dummy0 proto kernel metric 256 pref medium

After:

$ ip -6 route get fibmatch 2001:db8:1::2 oif dummy0
2001:db8:1::/64 dev dummy0 proto kernel metric 256 pref medium
$ ip -6 route get fibmatch 2001:db8:1::2 oif dummy1
RTNETLINK answers: Network is unreachable

The problem stems from the fact that the necessary route lookup flags
are not set based on these parameters.

Instead of duplicating the same logic for fibmatch, we can simply
resolve the original route from its copy and dump it instead.

Fixes: 18c3a61c4264 ("net: ipv6: RTM_GETROUTE: return matched fib result when requested")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 net/ipv6/route.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 2bc91c349273..0458b761f3c5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4298,19 +4298,13 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 		if (!ipv6_addr_any(&fl6.saddr))
 			flags |= RT6_LOOKUP_F_HAS_SADDR;
 
-		if (!fibmatch)
-			dst = ip6_route_input_lookup(net, dev, &fl6, flags);
-		else
-			dst = ip6_route_lookup(net, &fl6, 0);
+		dst = ip6_route_input_lookup(net, dev, &fl6, flags);
 
 		rcu_read_unlock();
 	} else {
 		fl6.flowi6_oif = oif;
 
-		if (!fibmatch)
-			dst = ip6_route_output(net, NULL, &fl6);
-		else
-			dst = ip6_route_lookup(net, &fl6, 0);
+		dst = ip6_route_output(net, NULL, &fl6);
 	}
 
 
@@ -4327,6 +4321,15 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 		goto errout;
 	}
 
+	if (fibmatch && rt->dst.from) {
+		struct rt6_info *ort = container_of(rt->dst.from,
+						    struct rt6_info, dst);
+
+		dst_hold(&ort->dst);
+		ip6_rt_put(rt);
+		rt = ort;
+	}
+
 	skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
 	if (!skb) {
 		ip6_rt_put(rt);
-- 
2.14.3

^ permalink raw reply related

* Re: [PATCH v3 net-next 0/6] tls: Add generic NIC offload infrastructure
From: Or Gerlitz @ 2017-12-20 10:31 UTC (permalink / raw)
  To: Boris Pismenny
  Cc: Jiri Pirko, Ilya Lesokhin, netdev@vger.kernel.org,
	davem@davemloft.net, davejwatson@fb.com, tom@herbertland.com,
	hannes@stressinduktion.org, Aviad Yehezkel, Liran Liss
In-Reply-To: <CAJ3xEMhFm_AXmU=j30J8BRViTCUTau0hRDRjRPYW9nyYuQ0=Mg@mail.gmail.com>

> It is fundamental requirement to show a use-case along with infra-structure.

To make it clear, sometimes you don't have yet the full HW/FW/FPGA solution
when you come to upstream the infra code. In that case you do the driver code
and submit it based on HW emulator run, this is common the netdev community
and done by few vendors among them us.

Or.

^ permalink raw reply

* Re: [PATCH v4 33/36] net: faraday add nds32 support.
From: Greentime Hu @ 2017-12-20 10:34 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: kbuild test robot, kbuild-all, Greentime,
	Linux Kernel Mailing List, Arnd Bergmann, Linux-Arch,
	Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, netdev,
	Vincent Chen, DTML, Al Viro, David Howells, Will Deacon,
	Daniel Lezcano, linux-serial, Linus Walleij, Mark Rutland,
	Greg KH
In-Reply-To: <CAMuHMdXp5b-Y79kaKgmDRshnpN2=VEd-f3v-6QW+6mUqv6YW-A@mail.gmail.com>

2017-12-20 17:58 GMT+08:00 Geert Uytterhoeven <geert@linux-m68k.org>:
> On Wed, Dec 20, 2017 at 10:54 AM, kbuild test robot <lkp@intel.com> wrote:
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on tip/timers/core]
>> [cannot apply to linus/master v4.15-rc4 next-20171220]
>> [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/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
>> config: sparc64-allyesconfig (attached as .config)
>> compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
>> reproduce:
>>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # save the attached .config to linux build tree
>>         make.cross ARCH=sparc64
>>
>> All warnings (new ones prefixed by >>):
>>
>>    drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_set_page':
>>>> drivers/net/ethernet/faraday/ftmac100.c:288:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>>      rxdes->rxdes3 = (unsigned int)page;
>>                      ^
>
> The proper way to casts pointer to integers is to cast to "uintptr_t".
>
> However, the address is stored in a 32-bit descriptor, which means it can
> not work on 64-bit platforms.
>
> Please make the driver depend on "!64BIT || BROKEN"
>
> Cfr. commit 15bfe05c8d6386f1 ("net: ethernet: xilinx: Mark XILINX_LL_TEMAC
> broken on 64-bit")
>
Thanks Geert.

I will apply it like this.

+++ b/drivers/net/ethernet/faraday/Kconfig
@@ -5,7 +5,7 @@
 config NET_VENDOR_FARADAY
        bool "Faraday devices"
        default y
-       depends on ARM
+       depends on ARM || NDS32 || COMPILE_TEST
        ---help---
          If you have a network (Ethernet) card belonging to this class, say Y.

@@ -18,7 +18,8 @@ if NET_VENDOR_FARADAY

 config FTMAC100
        tristate "Faraday FTMAC100 10/100 Ethernet support"
-       depends on ARM
+       depends on ARM || NDS32 || COMPILE_TEST
+       depends on !64BIT || BROKEN
        select MII
        ---help---
          This driver supports the FTMAC100 10/100 Ethernet controller
@@ -27,7 +28,8 @@ config FTMAC100

 config FTGMAC100
        tristate "Faraday FTGMAC100 Gigabit Ethernet support"
-       depends on ARM
+       depends on ARM || NDS32 || COMPILE_TEST
+       depends on !64BIT || BROKEN
        select PHYLIB
        ---help---
          This driver supports the FTGMAC100 Gigabit Ethernet controller

^ permalink raw reply

* Re: [RFC PATCH] virtio_net: Extend virtio to use VF datapath when available
From: Vitaly Kuznetsov @ 2017-12-20 10:51 UTC (permalink / raw)
  To: David Miller
  Cc: sridhar.samudrala, mst, netdev, alexander.duyck, virtualization,
	Stephen Hemminger
In-Reply-To: <20171219.132017.1652469595167726292.davem@davemloft.net>

David Miller <davem@davemloft.net> writes:

> From: "Samudrala, Sridhar" <sridhar.samudrala@intel.com>
> Date: Tue, 19 Dec 2017 09:41:39 -0800
>
>> This is based on netvsc implementation and here is the commit that
>> added this delay.  Not sure if this needs to be 100ms.
>> 
>> commit 6123c66854c174e4982f98195100c1d990f9e5e6
>> Author: stephen hemminger <stephen@networkplumber.org>
>> Date:   Wed Aug 9 17:46:03 2017 -0700
>> 
>>     netvsc: delay setup of VF device
>> 
>>     When VF device is discovered, delay bring it automatically up in
>>     order to allow userspace to some simple changes (like renaming).
>
> This is kind of bogus, I should have called this out when the patch
> was posted.
>
> Any delay is wrong, there needs to be tight synchronization if a
> userspace operation must occur before proceeding.  If something
> happens and userspace is delayed, this whole thing doesn't work.

Hyper-V's netvsc does exactly the same and when this was first discussed
I suggested to allow renaming of IFF_UP interfaces:
https://patchwork.kernel.org/patch/9890299/

but as far as I understand it was decided that it's too risky and not
worth it. Maybe we need to reconsider this, at least for slave
interfaces (as scripts are not supposed to operate on them).

-- 
  Vitaly

^ 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