Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next v2 0/6] nfp: devlink port implementation
From: Jiri Pirko @ 2017-05-26  8:25 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, oss-drivers
In-Reply-To: <20170526080336.32689-1-jakub.kicinski@netronome.com>

Fri, May 26, 2017 at 10:03:30AM CEST, jakub.kicinski@netronome.com wrote:
>Hi!
>
>This series adds basic devlink support.  The operations we can perform
>are port show and port split/unsplit.
>
>v2:
>Register devlink first, and then register all the ports.  Port {,un}split
>searches the port list, which is protected by a mutex.  If port split
>is requested before ports are registered we will simply not find the port
>and return -EINVAL.

Looks fine to me now. Thanks!


>
>Jakub Kicinski (5):
>  nfp: move mutex init out of net code
>  nfp: add helper for cleaning up vNICs
>  nfp: register ports as devlink ports
>  nfp: calculate total port lanes for split
>  nfp: support port splitting via devlink
>
>Simon Horman (1):
>  nfp: add devlink support
>
> drivers/net/ethernet/netronome/nfp/Makefile        |   1 +
> drivers/net/ethernet/netronome/nfp/nfp_devlink.c   | 181 +++++++++++++++++++++
> drivers/net/ethernet/netronome/nfp/nfp_main.c      |  28 +++-
> drivers/net/ethernet/netronome/nfp/nfp_main.h      |   3 +
> drivers/net/ethernet/netronome/nfp/nfp_net_main.c  |  61 ++++---
> drivers/net/ethernet/netronome/nfp/nfp_port.c      |  19 +++
> drivers/net/ethernet/netronome/nfp/nfp_port.h      |  12 ++
> .../net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h   |   3 +
> .../ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c   |  11 +-
> 9 files changed, 289 insertions(+), 30 deletions(-)
> create mode 100644 drivers/net/ethernet/netronome/nfp/nfp_devlink.c
>
>-- 
>2.11.0
>

^ permalink raw reply

* Re: [for-next 4/6] net/mlx5: FPGA, Add basic support for Innova
From: Saeed Mahameed @ 2017-05-26  8:29 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: Ilan Tayari, Alexei Starovoitov, Saeed Mahameed, David S. Miller,
	Doug Ledford, netdev@vger.kernel.org, linux-rdma@vger.kernel.org
In-Reply-To: <00716e5a-8b51-0b3f-a1b8-1bb7b346a66a@fb.com>

On Thu, May 25, 2017 at 11:48 PM, Jes Sorensen <jsorensen@fb.com> wrote:
> On 05/25/2017 06:40 AM, Saeed Mahameed wrote:
>>
>> On Thu, May 25, 2017 at 8:20 AM, Ilan Tayari <ilant@mellanox.com> wrote:
>>>>
>>>> -----Original Message-----
>>>> Can you put it into different driver? Dumping everything into by far
>>>> the biggest nic driver already is already huge headache in terms on
>>>> maintainability, debugging and back ports.
>>>> Look at how intel splits their drivers.
>>>> ixgb, ixgbe, ixgbevf are different drivers thought they have a lot in
>>>> common. On one side it's a bit of copy paste, but on the other side
>>
>>
>> I don't think the ixgb example is the same, simply  ixgb, ixgbe,
>> ixgbevf have different PCI IDs
>> and even different SW/FW interfaces. On the other hand, same mlx5
>> driver can support all of
>> ConnetX4/5/6 device IDs with the same code flows, same interfaces.
>>
>>>> it makes drivers much easier to develop and maintain independently.
>>>> ConnectX-6 code and any future hw support doesn't belong to
>>>> mlx5 driver at all.
>>
>>
>> Sorry i must disagree with you on this for the same reasons Ilan
>> mentioned.
>> We can perfectly achieve the same with modular driver design all under the
>> same .ko module, with some kconfig flags to reduce the amount of
>> code/features
>> this .ko provides.
>
>
> If I get this right, the FPGA is independent and could in theory be used for
> non network stuff. It really should have it's own driver in that case, and
> you should provide accessor functionality via the mlx5 driver.
>

Hi Jes,

No, It is clearly stated in the commit message :

"The FPGA is a bump-on-the-wire and thus affects operation of
the mlx5_core driver on the ConnectX ASIC."

Which means mlx5 FPGA user can only write logic which affects only
packets going in/out
A ConnectX chip - so it is only network stuff -.

> We have this with other devices in the kernel where a primary device driver
> provides an interface for an additional sub-driver to access another device
> behind it. Like bt-coexist in some of the wifi drivers allowing access to a
> bluetooth device behind it.
>

Blutooth over wifi or vise versa is a very good example to what you
are requesting.
But, it doesn't fit to what we are trying to do here. mlx5 FGPA is a
ConnectX card feature, not a new protocol.

> Jes

^ permalink raw reply

* Re: [patch net-next 01/18] bridge: Export VLAN filtering state
From: Nikolay Aleksandrov @ 2017-05-26  8:55 UTC (permalink / raw)
  To: Jiri Pirko, netdev; +Cc: davem, idosch, mlxsw, stephen
In-Reply-To: <20170526063740.8909-2-jiri@resnulli.us>

On 5/26/17 9:37 AM, Jiri Pirko wrote:
> From: Ido Schimmel <idosch@mellanox.com>
> 
> It's useful for drivers supporting bridge offload to be able to query
> the bridge's VLAN filtering state.
> 
> Currently, upon enslavement to a bridge master, the offloading driver
> will only learn about the bridge's VLAN filtering state after the bridge
> device was already linked with its slave.
> 
> Being able to query the bridge's VLAN filtering state allows such
> drivers to forbid enslavement in case resource couldn't be allocated for
> a VLAN-aware bridge and also choose the correct initialization routine
> for the enslaved port, which is dependent on the bridge type.
> 
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
>   include/linux/if_bridge.h | 9 +++++++++
>   net/bridge/br_if.c        | 2 +-
>   net/bridge/br_mdb.c       | 4 ++--
>   net/bridge/br_netlink.c   | 2 +-
>   net/bridge/br_private.h   | 9 ---------
>   net/bridge/br_vlan.c      | 8 ++++++++
>   6 files changed, 21 insertions(+), 13 deletions(-)
> 

I must say this bridge -> dev -> bridge looks weird from the bridge POV.
Since exports like this seem to be increasing I think it'd be nice to
make some API that can be queried instead of exporting symbols for each
bridge option or attribute. In this case maybe a simpler solution would've
been only a new exported symbol for external users.

The patch itself looks good to me.

Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

^ permalink raw reply

* Re: [patch net-next 02/18] bridge: Export multicast enabled state
From: Nikolay Aleksandrov @ 2017-05-26  8:56 UTC (permalink / raw)
  To: Jiri Pirko, netdev; +Cc: davem, idosch, mlxsw, stephen
In-Reply-To: <20170526063740.8909-3-jiri@resnulli.us>

On 5/26/17 9:37 AM, Jiri Pirko wrote:
> From: Ido Schimmel <idosch@mellanox.com>
> 
> During enslavement to a bridge, after the CHANGEUPPER is sent, the
> multicast enabled state of the bridge isn't propagated down to the
> offloading driver unless it's changed.
> 
> This patch allows such drivers to query the multicast enabled state from
> the bridge, so that they'll be able to correctly configure their flood
> tables during port enslavement.
> 
> In case multicast is disabled, unregistered multicast packets can be
> treated as broadcast and be flooded through all the bridge ports.
> 
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
>   include/linux/if_bridge.h | 5 +++++
>   net/bridge/br_multicast.c | 8 ++++++++
>   2 files changed, 13 insertions(+)
> 

Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

^ permalink raw reply

* Re: [for-next 4/6] net/mlx5: FPGA, Add basic support for Innova
From: Saeed Mahameed @ 2017-05-26  8:59 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Ilan Tayari, Saeed Mahameed, David S. Miller, Doug Ledford,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	jsorensen@fb.com
In-Reply-To: <20170526030701.du4345mbprhcwjyi@ast-mbp>

On Fri, May 26, 2017 at 6:07 AM, Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> On Thu, May 25, 2017 at 05:20:04AM +0000, Ilan Tayari wrote:
>>
>> If you do want this, then splitting some of the logic to a
>> separate kernel object will not gain anything useful (logic would stay
>> the same), and just pollute the exported symbol table and open up the door
>> for issues of inter-module compatibility and so on.
>
> in other words instead of properly designing inter-module api
> you just want to add everything into one giant 'driver'
> because it's easier to do so. Understandable, but it leads
> to unmaintainable device infrastructure long term.
>

What is wrong with giant 'driver'  ? :-)
BTW making the fpga a separate module is as easy as adding one line to
the make file
and moving the entry points functions (fpga_init/cleanup) form mlx5
init flow into a "mlx5_interface" instance and register it with the
mlx5_core.

But again i don't see a point of doing so, the code will still look
the same and sit in the same places.

so one giant ko file or small separate modules is basically the same,
from my point of view. modular design have nothing to do with the
compilation output binary, it should be considered regardless of the
compiler output.

Which we tried to not far a go to break the driver into sub-module
directories, each with its own responsibility, but it was too late for
that.

And for FPGA support, we did it correctly this time, all the new code
is under mlx5/core/fgpa ..
if you don't like core/fpga, ok just simply "CONFIG_MLX5_FPGA = no"
and all of that code/directory will disappear from your ko file and
will not be touched in compilation time, and the core code will still
look the same.

>> Furthermore, the next patchset will introduce IPSec offload capabilities
>> Which are declared in netdev->hw_features. Those cannot be modified
>> after the netdevice is created, so all the extra logic has to be
>> integrated into the mlx5 ethernet driver. This is another reason why
>> a separate driver is a bad idea.
>
> that increases my concerns even more.
> ipsec offload is a new feature for new hw, yet you're trying to
> hide it in the mlx5 'driver'.
>

Well, this is a well known dilemma, if one has a new feature and has no sandbox
area to put it in the first phase, it is better to start from the most
common place
for that feature which is the originating place, before defining
APIs/infrastructures,
until the feature is complete and every body is happy about it.

Same was done for GRO, XDP , you name it ..

nothing is being hidden here, we are adding new HW offloads, not that
different from
csum offloads, which no one can live without these days, and i believe
in few years IPSec and TLS and security offloads will be no less
important than csum offloads.

Someone has to start somewhere and we choose to start in our driver,
if you have a better IPSec generic interface that allows modular
module separation we are happy to hear about it.

> mlx5 already supports cx4/cx4-lx/cx5 and not even released cx6.

I will take this as a complement ;-), please see more info below.

> All of them have different feature sets.

Not different feature sets, but i expect some changes through out the
evolution of the ConnectX chip , and those changes can be:
1. internal bug fixes/internal improvements.
2. new extra features from the previous generation.

But the chip is the same chip, i.e same driver works on all of the
chips with the basic/standard feature set.

> The only common piece is driver/fw cmd interface and _some_ aspects
> of rx/tx descriptors. Everything else is different.

I can add more to the list.
basic offloads, steering management, eswitch, HW objects and semantics
QPs/RQs/SQs/CQs/EQs and their manipulation semantics, internal page
memory management, NIC initialization and teardown flows  are the same
and many more.


> cx4-lx doesn't have infiniband and rdma, yet there is a ton of code

although it doesn't have infinband support, cx4-lx have rdma support,
you can perfectly load mlx5_ib and work with RDMA over ethernet
(RoCE).
which is 99% of the mlx5_ib&mlx5_core code. (really !)
so the ton of code is still valid for cx4-lx.

> in the driver that deals with it.
> cx5 has fancy storage interfaces for nvme, etc I don't think they
> are part of the mlx5 'driver' yet. Are you going to dump them
> in there as well?
> Take a look at the simplest feature-wise cx4-lx. It has
> eswitch which is full l2 switch with mac table, drop policy,
> counters and such. Yet kernel knows nothing about it.
> Everything is hidden in mlx5 'driver' with its own special
> interfaces to manage it.

1. eswitch is a very integral steering feature of the ConnectX family
and is valid for all ConnectX4/lx/5/6 .. cards.
2. kenrel doesn't and can't know about it since in the early days of
SRIOV implementation (what the cool kids of switchdev mode call the
legacy sriov mode) is the responsibility of the device driver and it
is an internal arch of the HCA. so it is not our fault it is hidden in
mlx5, we just went with the flow..
3. I agree with you, device driver should be as transparent as
possible to the kernel, and should provide as much info as needed to
the stack.
4. switchdev mode came to solve this exact issue, and the kernel stack
even up to user space are perfectly aware of the nic eswitch
capabilities.

being said, even if the kernel is aware or not aware of the eswitch it
doesn't mean it should or shouldn't sit in the same mlx5 ko file.

> Now you want to hide fpga with custom logic behind mlx5 'driver'
> and manage it through mlx5 interfaces?
> That's not acceptable.
> mlx fpga got to have generic kernel representation that intel
> and other fpga vendors can use.
>

quoting Ilan from his commit message:

"The FPGA is a bump-on-the-wire and thus affects operation of
the mlx5_core driver on the ConnectX ASIC."

This is not a general purpose FPGA ! it even doesn't have a PCI Id or
it is own PCI function.
it simply allows the ConnectX Chip user to inspect/inject or run user
specif login on traffic going in/out of the chip.

But i agree with you some serious API brainstorming should be
considered, but not at this stage,
this patch only tells the ConnectX card (if you have FPGA, please enable it).

> mlx5 driver has to be modularized and since it's not too late
> cx6 support has to be removed from it.
>

I agree with you on the first part, Yes i would like to better
modularize the driver, i will even consider taking it to the extreme
and have separate module for each sub mlx5 module
e.g:

mlx5_core.ko
mlx5_eswitch.ko
mlx5_vxaln.ko
mlx5_vf_repreentor.ko
mlx5_ipoib.ko
...
even mlx5_xdp.ko ( not really ;-) )

If this what it takes to more logically and modularly break mlx5/core
into hierarchical design,
Please count me in. And i would like to hear Dave explicitly say i am
ok with this first.

But, re cx6 I am not sure i can agree on this for the simple fact:

it took 3 years to get mlx5 (Cx4/lx) driver to provide similar feature
set as mlx4 (Cx3).
and it literally took 0 lines of codes 1 day of regression to test
mlx5 driver over CX5 !
Now All we need is to add the new features of CX5 on top of the
already existing driver and i will be more than happy to hear about
exciting Ideas on how to modularly do that in the same driver,
and provide clear separation (beleive me it is is to do, if i am
allowed to split the driver into directories) but i can't do it in a
completely separate driver with a base code library, it is simply
wrong and non scalable (even if someone is not careful enough it could
make a lot of dependency mess between mlx5 modules)

> Thankfully only few cx6 pci ids were added to mlx5, but driver
> knows nothing about cx6 features, so we can properly design it.
>

> Since driver/fw interface is common between cx4+ this part
> can be moved into mlx_core.ko or done as library
> the way chelsio did it in libcxgb.
>

driver/fw interfaces are not the only common part, it is all basic
standard netdev/rdma and linux networkinng stuff are the same.

-Saeed.

^ permalink raw reply

* Re: [ISSUE: sky2 - rx error] Link stops working under heavy traffic load connected to a mv88e6176
From: Rafa Corvillo @ 2017-05-26 10:13 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: Stephen Hemminger, netdev
In-Reply-To: <591B267D.1030800@aoifes.com>

As modifying sky2 code I have not could get any solution, then I have 
modified some parameters on the ethernet interface and using a MTU = 
1503 and disabling TSO (TCP Segmentation Offload) mechanism all 
communication errors disappear, both the rx errors due to too long 
packets and tx timeout errors. I have performed iperf tests during 1 
hour (downstream and upstream) and the performance of the ethernet is 
stable. Furthermore, disabling SG (scatter-gather) improves the 
throughput of the ethernet interface with traffic upstream.

Is it possible that these offload mechanism don't work fine with the 
sky2 driver?

Thanks,

Rafa

^ permalink raw reply

* OFFIZIELLE GEWINNBENACHRITIGUNG
From: LOTTERIA LOTTERIA LOTTERIA @ 2017-05-26 17:13 UTC (permalink / raw)


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

INTERNATIONALE LOTTERIE-PROMOTION
ONLINE LOTTERIE-ABTEILUNG
Referenznummer: CCX-772-876-EM




                                          Gewinnbenachrichtigung



Wir sind verpflichtet, Ihnen mitteilen zu können das Ergebnis der gerechten abgeschlossen monatliche endgültig zieht der Internationale Online Lotterie Promotion und Ihre e-Mail unter den 20 glücklichen Gewinnern gewonnen €2.100,000.00 Euros

für Sicherheit Grund, Lesen Sie die Anlage in PDF Formant für weitere Informationen bezüglich Ihres Gewinns
 
Bitte kontaktieren Sie Herr Josef Feldrich über Ihren Gewinn auf feldrichjosef@gmail.com

Mit freundlichen Grüßen 

HEAD, ONLINE LOTTERY DEPARTMENT
INTERNATIONALE LOTTERY PROMOTIO



[-- Attachment #2: ACHTUNG GEWINNER.pdf --]
[-- Type: application/octet-stream, Size: 661474 bytes --]

^ permalink raw reply

* running an eBPF program
From: Adel Fuchs @ 2017-05-26 11:00 UTC (permalink / raw)
  To: netdev

Hi

I'm trying to run this eBPF program:

https://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git/tree/examples/bpf


and I get this error:


:~/iproute2/examples/bpf$sudo tc filter add dev enx00e11100329b parent
1: bpf obj bpf.o exp /tmp/bpf-uds flowid 1:1 action bpf obj bpf.o sec
action-mark            action bpf obj bpf.o sec action-rand ok

[sudo] password for adel:



Prog section 'classifier' rejected: Permission denied (13)!

- Type:         3

- Instructions: 218 (0 over limit)

- License:      GPL



Verifier analysis:



0: (bf) r6 = r1

1: (18) r9 = 0xffe0000e

3: (69) r0 = *(u16 *)(r6 +16)

invalid bpf_context access off=16 size=2



Error fetching program/map!

Failed to retrieve (e)BPF data!


Any suggestions?

Thanks,

Adel

^ permalink raw reply

* Re: [PATCH v2 net-next 1/3] perf, bpf: Add BPF support to all perf_event types
From: kbuild test robot @ 2017-05-26 11:04 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: kbuild-all, David S . Miller, Peter Zijlstra, Brendan Gregg,
	Daniel Borkmann, Teng Qin, netdev, linux-kernel
In-Reply-To: <20170526055549.557818-2-ast@fb.com>

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

Hi Teng,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Alexei-Starovoitov/bpf-Add-BPF-support-to-all-perf_event/20170526-171542
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/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=ia64 

All errors (new ones prefixed by >>):

   kernel//bpf/arraymap.c: In function 'perf_event_fd_array_get_ptr':
>> kernel//bpf/arraymap.c:466:11: error: 'struct perf_event' has no member named 'attach_state'
     if (event->attach_state & PERF_ATTACH_TASK)
              ^~

vim +466 kernel//bpf/arraymap.c

   460		if (IS_ERR(perf_file))
   461			return perf_file;
   462	
   463		event = perf_file->private_data;
   464		ee = ERR_PTR(-EINVAL);
   465		/* Per-task events are not supported */
 > 466		if (event->attach_state & PERF_ATTACH_TASK)
   467			goto err_out;
   468	
   469		attr = perf_event_attrs(event);

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

^ permalink raw reply

* Re: [for-next 5/6] net/mlx5: Bump driver version
From: Dennis Dalessandro @ 2017-05-26 12:56 UTC (permalink / raw)
  To: Saeed Mahameed, David S. Miller, Doug Ledford
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Ilan Tayari, Tariq Toukan
In-Reply-To: <20170523114404.20387-6-saeedm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On 5/23/2017 7:44 AM, Saeed Mahameed wrote:
> From: Tariq Toukan <tariqt-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Remove date and bump version for mlx5_core driver.
> 
> Signed-off-by: Tariq Toukan <tariqt-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Saeed Mahameed <saeedm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

So I just complained about the bnxt_re doing this. I guess I need to 
raise a flag here too. Now to be clear I'm not against doing this 
version stuff. I'm against using it for some internal tracking that is 
meaningless to the kernel community.

There is no detail in your commit message as to what this driver version 
is used for. Can you please explain how your use of driver version is 
valid while theirs is not?

I realize Dave has already pulled this and I'm not asking for it to be 
reverted but maybe some discussion will help guide future patch 
submissions which do this stuff.

-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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

* [PATCH net-next 0/2] ndisc.c minor clean and improvement
From: yuan linyu @ 2017-05-26 13:21 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Joe Perches, David Ahern, yuan linyu

From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>

1. fix part of checkpatch issue which I like to fix
2. __ndisc_fill_addr_option() clean

yuan linyu (2):
  net: ndisc.c: fix coding style issue
  net: ndisc.c: minor code improvement

 net/ipv6/ndisc.c | 139 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 70 insertions(+), 69 deletions(-)

-- 
2.7.4

^ permalink raw reply

* [PATCH net-next 1/2] net: ndisc.c: fix coding style issue
From: yuan linyu @ 2017-05-26 13:23 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Joe Perches, David Ahern, yuan linyu

From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>

Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
---
 net/ipv6/ndisc.c | 109 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 55 insertions(+), 54 deletions(-)

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d310dc4..292c827 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -99,7 +99,6 @@ static const struct neigh_ops ndisc_hh_ops = {
 	.connected_output =	neigh_resolve_output,
 };
 
-
 static const struct neigh_ops ndisc_direct_ops = {
 	.family =		AF_INET6,
 	.output =		neigh_direct_output,
@@ -147,13 +146,13 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data,
 	u8 *opt = skb_put(skb, space);
 
 	opt[0] = type;
-	opt[1] = space>>3;
+	opt[1] = space >> 3;
 
 	memset(opt + 2, 0, pad);
 	opt   += pad;
 	space -= pad;
 
-	memcpy(opt+2, data, data_len);
+	memcpy(opt + 2, data, data_len);
 	data_len += 2;
 	opt += data_len;
 	space -= data_len;
@@ -182,6 +181,7 @@ static struct nd_opt_hdr *ndisc_next_option(struct nd_opt_hdr *cur,
 					    struct nd_opt_hdr *end)
 {
 	int type;
+
 	if (!cur || !end || cur >= end)
 		return NULL;
 	type = cur->nd_opt_type;
@@ -222,6 +222,7 @@ struct ndisc_options *ndisc_parse_options(const struct net_device *dev,
 	memset(ndopts, 0, sizeof(*ndopts));
 	while (opt_len) {
 		int l;
+
 		if (opt_len < sizeof(struct nd_opt_hdr))
 			return NULL;
 		l = nd_opt->nd_opt_len << 3;
@@ -327,9 +328,8 @@ static int ndisc_constructor(struct neighbour *neigh)
 	bool is_multicast = ipv6_addr_is_multicast(addr);
 
 	in6_dev = in6_dev_get(dev);
-	if (!in6_dev) {
+	if (!in6_dev)
 		return -EINVAL;
-	}
 
 	parms = in6_dev->nd_parms;
 	__neigh_parms_put(neigh->parms);
@@ -344,12 +344,12 @@ static int ndisc_constructor(struct neighbour *neigh)
 		if (is_multicast) {
 			neigh->nud_state = NUD_NOARP;
 			ndisc_mc_map(addr, neigh->ha, dev, 1);
-		} else if (dev->flags&(IFF_NOARP|IFF_LOOPBACK)) {
+		} else if (dev->flags & (IFF_NOARP | IFF_LOOPBACK)) {
 			neigh->nud_state = NUD_NOARP;
 			memcpy(neigh->ha, dev->dev_addr, dev->addr_len);
-			if (dev->flags&IFF_LOOPBACK)
+			if (dev->flags & IFF_LOOPBACK)
 				neigh->type = RTN_LOCAL;
-		} else if (dev->flags&IFF_POINTOPOINT) {
+		} else if (dev->flags & IFF_POINTOPOINT) {
 			neigh->nud_state = NUD_NOARP;
 			memcpy(neigh->ha, dev->broadcast, dev->addr_len);
 		}
@@ -357,7 +357,7 @@ static int ndisc_constructor(struct neighbour *neigh)
 			neigh->ops = &ndisc_hh_ops;
 		else
 			neigh->ops = &ndisc_generic_ops;
-		if (neigh->nud_state&NUD_VALID)
+		if (neigh->nud_state & NUD_VALID)
 			neigh->output = neigh->ops->connected_output;
 		else
 			neigh->output = neigh->ops->output;
@@ -580,7 +580,7 @@ void ndisc_send_ns(struct net_device *dev, const struct in6_addr *solicit,
 
 	if (!saddr) {
 		if (ipv6_get_lladdr(dev, &addr_buf,
-				   (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)))
+				   (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC)))
 			return;
 		saddr = &addr_buf;
 	}
@@ -641,9 +641,8 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
 		struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev_net(dev), saddr,
 							   dev, 1);
 		if (ifp) {
-			if (ifp->flags & IFA_F_OPTIMISTIC)  {
+			if (ifp->flags & IFA_F_OPTIMISTIC)
 				send_sllao = 0;
-			}
 			in6_ifa_put(ifp);
 		} else {
 			send_sllao = 0;
@@ -672,7 +671,6 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
 	ndisc_send_skb(skb, daddr, saddr);
 }
 
-
 static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb)
 {
 	/*
@@ -695,7 +693,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
 
 	if (skb && ipv6_chk_addr_and_flags(dev_net(dev), &ipv6_hdr(skb)->saddr,
 					   dev, 1,
-					   IFA_F_TENTATIVE|IFA_F_OPTIMISTIC))
+					   IFA_F_TENTATIVE | IFA_F_OPTIMISTIC))
 		saddr = &ipv6_hdr(skb)->saddr;
 	probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES);
 	if (probes < 0) {
@@ -806,7 +804,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 	ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1);
 	if (ifp) {
 have_ifp:
-		if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) {
+		if (ifp->flags & (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC)) {
 			if (dad) {
 				if (nonce != 0 && ifp->dad_nonce == nonce) {
 					u8 *np = (u8 *)&nonce;
@@ -824,16 +822,15 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 				 */
 				addrconf_dad_failure(ifp);
 				return;
-			} else {
-				/*
-				 * This is not a dad solicitation.
-				 * If we are an optimistic node,
-				 * we should respond.
-				 * Otherwise, we should ignore it.
-				 */
-				if (!(ifp->flags & IFA_F_OPTIMISTIC))
-					goto out;
 			}
+			/*
+			 * This is not a dad solicitation.
+			 * If we are an optimistic node,
+			 * we should respond.
+			 * Otherwise, we should ignore it.
+			 */
+			if (!(ifp->flags & IFA_F_OPTIMISTIC))
+				goto out;
 		}
 
 		idev = ifp->idev;
@@ -874,6 +871,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 				 * (RFC2461) -- yoshfuji
 				 */
 				struct sk_buff *n = skb_clone(skb, GFP_ATOMIC);
+
 				if (n)
 					pneigh_enqueue(&nd_tbl, idev->nd_parms, n);
 				goto out;
@@ -904,7 +902,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 			       !inc || lladdr || !dev->addr_len);
 	if (neigh)
 		ndisc_update(dev, neigh, lladdr, NUD_STALE,
-			     NEIGH_UPDATE_F_WEAK_OVERRIDE|
+			     NEIGH_UPDATE_F_WEAK_OVERRIDE |
 			     NEIGH_UPDATE_F_OVERRIDE,
 			     NDISC_NEIGHBOUR_SOLICITATION, &ndopts);
 	if (neigh || !dev->header_ops) {
@@ -973,10 +971,10 @@ static void ndisc_recv_na(struct sk_buff *skb)
 	}
 	ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1);
 	if (ifp) {
-		if (skb->pkt_type != PACKET_LOOPBACK
-		    && (ifp->flags & IFA_F_TENTATIVE)) {
-				addrconf_dad_failure(ifp);
-				return;
+		if (skb->pkt_type != PACKET_LOOPBACK &&
+		    (ifp->flags & IFA_F_TENTATIVE)) {
+			addrconf_dad_failure(ifp);
+			return;
 		}
 		/* What should we make now? The advertisement
 		   is invalid, but ndisc specs say nothing
@@ -1081,8 +1079,8 @@ static void ndisc_recv_rs(struct sk_buff *skb)
 	neigh = __neigh_lookup(&nd_tbl, saddr, skb->dev, 1);
 	if (neigh) {
 		ndisc_update(skb->dev, neigh, lladdr, NUD_STALE,
-			     NEIGH_UPDATE_F_WEAK_OVERRIDE|
-			     NEIGH_UPDATE_F_OVERRIDE|
+			     NEIGH_UPDATE_F_WEAK_OVERRIDE |
+			     NEIGH_UPDATE_F_OVERRIDE |
 			     NEIGH_UPDATE_F_OVERRIDE_ISROUTER,
 			     NDISC_ROUTER_SOLICITATION, &ndopts);
 		neigh_release(neigh);
@@ -1110,9 +1108,8 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
 	}
 
 	nlh = nlmsg_put(skb, 0, 0, RTM_NEWNDUSEROPT, base_size, 0);
-	if (!nlh) {
+	if (!nlh)
 		goto nla_put_failure;
-	}
 
 	ndmsg = nlmsg_data(nlh);
 	ndmsg->nduseropt_family = AF_INET6;
@@ -1325,21 +1322,21 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	if (in6_dev->nd_parms) {
 		unsigned long rtime = ntohl(ra_msg->retrans_timer);
 
-		if (rtime && rtime/1000 < MAX_SCHEDULE_TIMEOUT/HZ) {
-			rtime = (rtime*HZ)/1000;
-			if (rtime < HZ/10)
-				rtime = HZ/10;
+		if (rtime && rtime / 1000 < MAX_SCHEDULE_TIMEOUT / HZ) {
+			rtime = (rtime * HZ) / 1000;
+			if (rtime < HZ / 10)
+				rtime = HZ / 10;
 			NEIGH_VAR_SET(in6_dev->nd_parms, RETRANS_TIME, rtime);
 			in6_dev->tstamp = jiffies;
 			send_ifinfo_notify = true;
 		}
 
 		rtime = ntohl(ra_msg->reachable_time);
-		if (rtime && rtime/1000 < MAX_SCHEDULE_TIMEOUT/(3*HZ)) {
-			rtime = (rtime*HZ)/1000;
+		if (rtime && rtime / 1000 < MAX_SCHEDULE_TIMEOUT / (3 * HZ)) {
+			rtime = (rtime * HZ) / 1000;
 
-			if (rtime < HZ/10)
-				rtime = HZ/10;
+			if (rtime < HZ / 10)
+				rtime = HZ / 10;
 
 			if (rtime != NEIGH_VAR(in6_dev->nd_parms, BASE_REACHABLE_TIME)) {
 				NEIGH_VAR_SET(in6_dev->nd_parms,
@@ -1370,6 +1367,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 				       skb->dev, 1);
 	if (neigh) {
 		u8 *lladdr = NULL;
+
 		if (ndopts.nd_opts_src_lladdr) {
 			lladdr = ndisc_opt_addr_data(ndopts.nd_opts_src_lladdr,
 						     skb->dev);
@@ -1380,9 +1378,9 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 			}
 		}
 		ndisc_update(skb->dev, neigh, lladdr, NUD_STALE,
-			     NEIGH_UPDATE_F_WEAK_OVERRIDE|
-			     NEIGH_UPDATE_F_OVERRIDE|
-			     NEIGH_UPDATE_F_OVERRIDE_ISROUTER|
+			     NEIGH_UPDATE_F_WEAK_OVERRIDE |
+			     NEIGH_UPDATE_F_OVERRIDE |
+			     NEIGH_UPDATE_F_OVERRIDE_ISROUTER |
 			     NEIGH_UPDATE_F_ISROUTER,
 			     NDISC_ROUTER_ADVERTISEMENT, &ndopts);
 	}
@@ -1406,6 +1404,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 
 	if (in6_dev->cnf.accept_ra_rtr_pref && ndopts.nd_opts_ri) {
 		struct nd_opt_hdr *p;
+
 		for (p = ndopts.nd_opts_ri;
 		     p;
 		     p = ndisc_next_option(p, ndopts.nd_opts_ri_end)) {
@@ -1442,6 +1441,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 
 	if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) {
 		struct nd_opt_hdr *p;
+
 		for (p = ndopts.nd_opts_pi;
 		     p;
 		     p = ndisc_next_option(p, ndopts.nd_opts_pi_end)) {
@@ -1455,7 +1455,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 		__be32 n;
 		u32 mtu;
 
-		memcpy(&n, ((u8 *)(ndopts.nd_opts_mtu+1))+2, sizeof(mtu));
+		memcpy(&n, ((u8 *)(ndopts.nd_opts_mtu + 1)) + 2, sizeof(mtu));
 		mtu = ntohl(n);
 
 		if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu) {
@@ -1472,6 +1472,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 
 	if (ndopts.nd_useropts) {
 		struct nd_opt_hdr *p;
+
 		for (p = ndopts.nd_useropts;
 		     p;
 		     p = ndisc_next_useropt(skb->dev, p,
@@ -1480,9 +1481,8 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 		}
 	}
 
-	if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh) {
+	if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh)
 		ND_PRINTK(2, warn, "RA: invalid RA options\n");
-	}
 out:
 	ip6_rt_put(rt);
 	if (neigh)
@@ -1518,7 +1518,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
 
 	if (!ndopts.nd_opts_rh) {
 		ip6_redirect_no_header(skb, dev_net(skb->dev),
-					skb->dev->ifindex, 0);
+				       skb->dev->ifindex, 0);
 		return;
 	}
 
@@ -1569,7 +1569,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 	}
 
 	if (!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, target) &&
-	    ipv6_addr_type(target) != (IPV6_ADDR_UNICAST|IPV6_ADDR_LINKLOCAL)) {
+	    ipv6_addr_type(target) != (IPV6_ADDR_UNICAST | IPV6_ADDR_LINKLOCAL)) {
 		ND_PRINTK(2, warn,
 			  "Redirect: target address is not link-local unicast\n");
 		return;
@@ -1587,7 +1587,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 	if (IS_ERR(dst))
 		return;
 
-	rt = (struct rt6_info *) dst;
+	rt = (struct rt6_info *)dst;
 
 	if (rt->rt6i_flags & RTF_GATEWAY) {
 		ND_PRINTK(2, warn,
@@ -1595,7 +1595,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 		goto release;
 	}
 	peer = inet_getpeer_v6(net->ipv6.peers, &ipv6_hdr(skb)->saddr, 1);
-	ret = inet_peer_xrlim_allow(peer, 1*HZ);
+	ret = inet_peer_xrlim_allow(peer, 1 * HZ);
 	if (peer)
 		inet_putpeer(peer);
 	if (!ret)
@@ -1603,6 +1603,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 
 	if (dev->addr_len) {
 		struct neighbour *neigh = dst_neigh_lookup(skb_dst(skb), target);
+
 		if (!neigh) {
 			ND_PRINTK(2, warn,
 				  "Redirect: no neigh for target address\n");
@@ -1787,6 +1788,7 @@ static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl,
 {
 	static char warncomm[TASK_COMM_LEN];
 	static int warned;
+
 	if (strcmp(warncomm, current->comm) && warned < 5) {
 		strcpy(warncomm, current->comm);
 		pr_warn("process `%s' is using deprecated sysctl (%s) net.ipv6.neigh.%s.%s - use net.ipv6.neigh.%s.%s_ms instead\n",
@@ -1797,7 +1799,8 @@ static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl,
 	}
 }
 
-int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
+			       void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	struct net_device *dev = ctl->extra1;
 	struct inet6_dev *idev;
@@ -1831,8 +1834,6 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *bu
 	}
 	return ret;
 }
-
-
 #endif
 
 static int __net_init ndisc_net_init(struct net *net)
-- 
2.7.4

^ permalink raw reply related

* [PATCH net-next 2/2] net: ndisc.c: minor code improvement
From: yuan linyu @ 2017-05-26 13:24 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Joe Perches, David Ahern, yuan linyu

From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>

on x86_64, text size decrease 80 bytes

Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
---
 net/ipv6/ndisc.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 292c827..ee9b12c 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -147,17 +147,16 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data,
 
 	opt[0] = type;
 	opt[1] = space >> 3;
+	opt   += 2;
 
-	memset(opt + 2, 0, pad);
+	memset(opt, 0, pad);
 	opt   += pad;
 	space -= pad;
 
-	memcpy(opt + 2, data, data_len);
-	data_len += 2;
+	memcpy(opt, data, data_len);
 	opt += data_len;
 	space -= data_len;
-	if (space > 0)
-		memset(opt, 0, space);
+	memset(opt, 0, space);
 }
 EXPORT_SYMBOL_GPL(__ndisc_fill_addr_option);
 
@@ -997,6 +996,7 @@ static void ndisc_recv_na(struct sk_buff *skb)
 	if (neigh) {
 		u8 old_flags = neigh->flags;
 		struct net *net = dev_net(dev);
+		u32 flags;
 
 		if (neigh->nud_state & NUD_FAILED)
 			goto out;
@@ -1013,13 +1013,14 @@ static void ndisc_recv_na(struct sk_buff *skb)
 			goto out;
 		}
 
+		flags = NEIGH_UPDATE_F_WEAK_OVERRIDE | NEIGH_UPDATE_F_OVERRIDE_ISROUTER;
+		if (msg->icmph.icmp6_override)
+			flags |= NEIGH_UPDATE_F_OVERRIDE;
+		if (msg->icmph.icmp6_router)
+			flags |= NEIGH_UPDATE_F_ISROUTER;
 		ndisc_update(dev, neigh, lladdr,
 			     msg->icmph.icmp6_solicited ? NUD_REACHABLE : NUD_STALE,
-			     NEIGH_UPDATE_F_WEAK_OVERRIDE|
-			     (msg->icmph.icmp6_override ? NEIGH_UPDATE_F_OVERRIDE : 0)|
-			     NEIGH_UPDATE_F_OVERRIDE_ISROUTER|
-			     (msg->icmph.icmp6_router ? NEIGH_UPDATE_F_ISROUTER : 0),
-			     NDISC_NEIGHBOUR_ADVERTISEMENT, &ndopts);
+			     flags, NDISC_NEIGHBOUR_ADVERTISEMENT, &ndopts);
 
 		if ((old_flags & ~neigh->flags) & NTF_ROUTER) {
 			/*
@@ -1217,12 +1218,11 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	 * received RA message (RFC 2462) -- yoshfuji
 	 */
 	old_if_flags = in6_dev->if_flags;
-	in6_dev->if_flags = (in6_dev->if_flags & ~(IF_RA_MANAGED |
-				IF_RA_OTHERCONF)) |
-				(ra_msg->icmph.icmp6_addrconf_managed ?
-					IF_RA_MANAGED : 0) |
-				(ra_msg->icmph.icmp6_addrconf_other ?
-					IF_RA_OTHERCONF : 0);
+	in6_dev->if_flags &= ~(IF_RA_MANAGED | IF_RA_OTHERCONF);
+	if (ra_msg->icmph.icmp6_addrconf_managed)
+		in6_dev->if_flags |= IF_RA_MANAGED;
+	if (ra_msg->icmph.icmp6_addrconf_other)
+		in6_dev->if_flags |= IF_RA_OTHERCONF;
 
 	if (old_if_flags != in6_dev->if_flags)
 		send_ifinfo_notify = true;
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH v3 2/2] dt-bindings: net: Add Cortina device tree bindings
From: Andrew Lunn @ 2017-05-26 13:35 UTC (permalink / raw)
  To: Bogdan Purcareata
  Cc: f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1495785519-1468-3-git-send-email-bogdan.purcareata-3arQi8VN3Tc@public.gmane.org>

> +		cs4340_phy@1 {
> +			compatible = "ethernet-phy-id13e5.1002";
> +			reg = <0x10>;

The @1 and the reg value should be the same. Please change it to
cs4340_phy@10.

    Andrew
--
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 v3 2/2] dt-bindings: net: Add Cortina device tree bindings
From: Bogdan Purcareata @ 2017-05-26 13:41 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: f.fainelli@gmail.com, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20170526133554.GD31389@lunn.ch>

> -----Original Message-----
> From: Andrew Lunn [mailto:andrew@lunn.ch]
> Sent: Friday, May 26, 2017 4:36 PM
> To: Bogdan Purcareata <bogdan.purcareata@nxp.com>
> Cc: f.fainelli@gmail.com; netdev@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v3 2/2] dt-bindings: net: Add Cortina device tree
> bindings
> 
> > +		cs4340_phy@1 {
> > +			compatible = "ethernet-phy-id13e5.1002";
> > +			reg = <0x10>;
> 
> The @1 and the reg value should be the same. Please change it to
> cs4340_phy@10.

Will do, thanks!
Bogdan

^ permalink raw reply

* Re: [PATCH net-next 1/2] net: ndisc.c: fix coding style issue
From: 吉藤英明 @ 2017-05-26 13:45 UTC (permalink / raw)
  To: yuan linyu
  Cc: network dev, David S . Miller, Joe Perches, David Ahern,
	yuan linyu, YOSHIFUJI Hideaki
In-Reply-To: <1495805019-2919-1-git-send-email-cugyly@163.com>

Hi,

2017-05-26 22:23 GMT+09:00 yuan linyu <cugyly@163.com>:
> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
>
> Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> ---
>  net/ipv6/ndisc.c | 109 ++++++++++++++++++++++++++++---------------------------
>  1 file changed, 55 insertions(+), 54 deletions(-)

Sorry, I don't think this kind of change for style is good
bacause this makes effort of  backport more difficult.

--yoshfuji

>
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index d310dc4..292c827 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -99,7 +99,6 @@ static const struct neigh_ops ndisc_hh_ops = {
>         .connected_output =     neigh_resolve_output,
>  };
>
> -
>  static const struct neigh_ops ndisc_direct_ops = {
>         .family =               AF_INET6,
>         .output =               neigh_direct_output,
> @@ -147,13 +146,13 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data,
>         u8 *opt = skb_put(skb, space);
>
>         opt[0] = type;
> -       opt[1] = space>>3;
> +       opt[1] = space >> 3;
>
>         memset(opt + 2, 0, pad);
>         opt   += pad;
>         space -= pad;
>
> -       memcpy(opt+2, data, data_len);
> +       memcpy(opt + 2, data, data_len);
>         data_len += 2;
>         opt += data_len;
>         space -= data_len;
> @@ -182,6 +181,7 @@ static struct nd_opt_hdr *ndisc_next_option(struct nd_opt_hdr *cur,
>                                             struct nd_opt_hdr *end)
>  {
>         int type;
> +
>         if (!cur || !end || cur >= end)
>                 return NULL;
>         type = cur->nd_opt_type;
> @@ -222,6 +222,7 @@ struct ndisc_options *ndisc_parse_options(const struct net_device *dev,
>         memset(ndopts, 0, sizeof(*ndopts));
>         while (opt_len) {
>                 int l;
> +
>                 if (opt_len < sizeof(struct nd_opt_hdr))
>                         return NULL;
>                 l = nd_opt->nd_opt_len << 3;
> @@ -327,9 +328,8 @@ static int ndisc_constructor(struct neighbour *neigh)
>         bool is_multicast = ipv6_addr_is_multicast(addr);
>
>         in6_dev = in6_dev_get(dev);
> -       if (!in6_dev) {
> +       if (!in6_dev)
>                 return -EINVAL;
> -       }
>
>         parms = in6_dev->nd_parms;
>         __neigh_parms_put(neigh->parms);
> @@ -344,12 +344,12 @@ static int ndisc_constructor(struct neighbour *neigh)
>                 if (is_multicast) {
>                         neigh->nud_state = NUD_NOARP;
>                         ndisc_mc_map(addr, neigh->ha, dev, 1);
> -               } else if (dev->flags&(IFF_NOARP|IFF_LOOPBACK)) {
> +               } else if (dev->flags & (IFF_NOARP | IFF_LOOPBACK)) {
>                         neigh->nud_state = NUD_NOARP;
>                         memcpy(neigh->ha, dev->dev_addr, dev->addr_len);
> -                       if (dev->flags&IFF_LOOPBACK)
> +                       if (dev->flags & IFF_LOOPBACK)
>                                 neigh->type = RTN_LOCAL;
> -               } else if (dev->flags&IFF_POINTOPOINT) {
> +               } else if (dev->flags & IFF_POINTOPOINT) {
>                         neigh->nud_state = NUD_NOARP;
>                         memcpy(neigh->ha, dev->broadcast, dev->addr_len);
>                 }
> @@ -357,7 +357,7 @@ static int ndisc_constructor(struct neighbour *neigh)
>                         neigh->ops = &ndisc_hh_ops;
>                 else
>                         neigh->ops = &ndisc_generic_ops;
> -               if (neigh->nud_state&NUD_VALID)
> +               if (neigh->nud_state & NUD_VALID)
>                         neigh->output = neigh->ops->connected_output;
>                 else
>                         neigh->output = neigh->ops->output;
> @@ -580,7 +580,7 @@ void ndisc_send_ns(struct net_device *dev, const struct in6_addr *solicit,
>
>         if (!saddr) {
>                 if (ipv6_get_lladdr(dev, &addr_buf,
> -                                  (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)))
> +                                  (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC)))
>                         return;
>                 saddr = &addr_buf;
>         }
> @@ -641,9 +641,8 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
>                 struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev_net(dev), saddr,
>                                                            dev, 1);
>                 if (ifp) {
> -                       if (ifp->flags & IFA_F_OPTIMISTIC)  {
> +                       if (ifp->flags & IFA_F_OPTIMISTIC)
>                                 send_sllao = 0;
> -                       }
>                         in6_ifa_put(ifp);
>                 } else {
>                         send_sllao = 0;
> @@ -672,7 +671,6 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
>         ndisc_send_skb(skb, daddr, saddr);
>  }
>
> -
>  static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb)
>  {
>         /*
> @@ -695,7 +693,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
>
>         if (skb && ipv6_chk_addr_and_flags(dev_net(dev), &ipv6_hdr(skb)->saddr,
>                                            dev, 1,
> -                                          IFA_F_TENTATIVE|IFA_F_OPTIMISTIC))
> +                                          IFA_F_TENTATIVE | IFA_F_OPTIMISTIC))
>                 saddr = &ipv6_hdr(skb)->saddr;
>         probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES);
>         if (probes < 0) {
> @@ -806,7 +804,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
>         ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1);
>         if (ifp) {
>  have_ifp:
> -               if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) {
> +               if (ifp->flags & (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC)) {
>                         if (dad) {
>                                 if (nonce != 0 && ifp->dad_nonce == nonce) {
>                                         u8 *np = (u8 *)&nonce;
> @@ -824,16 +822,15 @@ static void ndisc_recv_ns(struct sk_buff *skb)
>                                  */
>                                 addrconf_dad_failure(ifp);
>                                 return;
> -                       } else {
> -                               /*
> -                                * This is not a dad solicitation.
> -                                * If we are an optimistic node,
> -                                * we should respond.
> -                                * Otherwise, we should ignore it.
> -                                */
> -                               if (!(ifp->flags & IFA_F_OPTIMISTIC))
> -                                       goto out;
>                         }
> +                       /*
> +                        * This is not a dad solicitation.
> +                        * If we are an optimistic node,
> +                        * we should respond.
> +                        * Otherwise, we should ignore it.
> +                        */
> +                       if (!(ifp->flags & IFA_F_OPTIMISTIC))
> +                               goto out;
>                 }
>
>                 idev = ifp->idev;
> @@ -874,6 +871,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
>                                  * (RFC2461) -- yoshfuji
>                                  */
>                                 struct sk_buff *n = skb_clone(skb, GFP_ATOMIC);
> +
>                                 if (n)
>                                         pneigh_enqueue(&nd_tbl, idev->nd_parms, n);
>                                 goto out;
> @@ -904,7 +902,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
>                                !inc || lladdr || !dev->addr_len);
>         if (neigh)
>                 ndisc_update(dev, neigh, lladdr, NUD_STALE,
> -                            NEIGH_UPDATE_F_WEAK_OVERRIDE|
> +                            NEIGH_UPDATE_F_WEAK_OVERRIDE |
>                              NEIGH_UPDATE_F_OVERRIDE,
>                              NDISC_NEIGHBOUR_SOLICITATION, &ndopts);
>         if (neigh || !dev->header_ops) {
> @@ -973,10 +971,10 @@ static void ndisc_recv_na(struct sk_buff *skb)
>         }
>         ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1);
>         if (ifp) {
> -               if (skb->pkt_type != PACKET_LOOPBACK
> -                   && (ifp->flags & IFA_F_TENTATIVE)) {
> -                               addrconf_dad_failure(ifp);
> -                               return;
> +               if (skb->pkt_type != PACKET_LOOPBACK &&
> +                   (ifp->flags & IFA_F_TENTATIVE)) {
> +                       addrconf_dad_failure(ifp);
> +                       return;
>                 }
>                 /* What should we make now? The advertisement
>                    is invalid, but ndisc specs say nothing
> @@ -1081,8 +1079,8 @@ static void ndisc_recv_rs(struct sk_buff *skb)
>         neigh = __neigh_lookup(&nd_tbl, saddr, skb->dev, 1);
>         if (neigh) {
>                 ndisc_update(skb->dev, neigh, lladdr, NUD_STALE,
> -                            NEIGH_UPDATE_F_WEAK_OVERRIDE|
> -                            NEIGH_UPDATE_F_OVERRIDE|
> +                            NEIGH_UPDATE_F_WEAK_OVERRIDE |
> +                            NEIGH_UPDATE_F_OVERRIDE |
>                              NEIGH_UPDATE_F_OVERRIDE_ISROUTER,
>                              NDISC_ROUTER_SOLICITATION, &ndopts);
>                 neigh_release(neigh);
> @@ -1110,9 +1108,8 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
>         }
>
>         nlh = nlmsg_put(skb, 0, 0, RTM_NEWNDUSEROPT, base_size, 0);
> -       if (!nlh) {
> +       if (!nlh)
>                 goto nla_put_failure;
> -       }
>
>         ndmsg = nlmsg_data(nlh);
>         ndmsg->nduseropt_family = AF_INET6;
> @@ -1325,21 +1322,21 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>         if (in6_dev->nd_parms) {
>                 unsigned long rtime = ntohl(ra_msg->retrans_timer);
>
> -               if (rtime && rtime/1000 < MAX_SCHEDULE_TIMEOUT/HZ) {
> -                       rtime = (rtime*HZ)/1000;
> -                       if (rtime < HZ/10)
> -                               rtime = HZ/10;
> +               if (rtime && rtime / 1000 < MAX_SCHEDULE_TIMEOUT / HZ) {
> +                       rtime = (rtime * HZ) / 1000;
> +                       if (rtime < HZ / 10)
> +                               rtime = HZ / 10;
>                         NEIGH_VAR_SET(in6_dev->nd_parms, RETRANS_TIME, rtime);
>                         in6_dev->tstamp = jiffies;
>                         send_ifinfo_notify = true;
>                 }
>
>                 rtime = ntohl(ra_msg->reachable_time);
> -               if (rtime && rtime/1000 < MAX_SCHEDULE_TIMEOUT/(3*HZ)) {
> -                       rtime = (rtime*HZ)/1000;
> +               if (rtime && rtime / 1000 < MAX_SCHEDULE_TIMEOUT / (3 * HZ)) {
> +                       rtime = (rtime * HZ) / 1000;
>
> -                       if (rtime < HZ/10)
> -                               rtime = HZ/10;
> +                       if (rtime < HZ / 10)
> +                               rtime = HZ / 10;
>
>                         if (rtime != NEIGH_VAR(in6_dev->nd_parms, BASE_REACHABLE_TIME)) {
>                                 NEIGH_VAR_SET(in6_dev->nd_parms,
> @@ -1370,6 +1367,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>                                        skb->dev, 1);
>         if (neigh) {
>                 u8 *lladdr = NULL;
> +
>                 if (ndopts.nd_opts_src_lladdr) {
>                         lladdr = ndisc_opt_addr_data(ndopts.nd_opts_src_lladdr,
>                                                      skb->dev);
> @@ -1380,9 +1378,9 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>                         }
>                 }
>                 ndisc_update(skb->dev, neigh, lladdr, NUD_STALE,
> -                            NEIGH_UPDATE_F_WEAK_OVERRIDE|
> -                            NEIGH_UPDATE_F_OVERRIDE|
> -                            NEIGH_UPDATE_F_OVERRIDE_ISROUTER|
> +                            NEIGH_UPDATE_F_WEAK_OVERRIDE |
> +                            NEIGH_UPDATE_F_OVERRIDE |
> +                            NEIGH_UPDATE_F_OVERRIDE_ISROUTER |
>                              NEIGH_UPDATE_F_ISROUTER,
>                              NDISC_ROUTER_ADVERTISEMENT, &ndopts);
>         }
> @@ -1406,6 +1404,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>
>         if (in6_dev->cnf.accept_ra_rtr_pref && ndopts.nd_opts_ri) {
>                 struct nd_opt_hdr *p;
> +
>                 for (p = ndopts.nd_opts_ri;
>                      p;
>                      p = ndisc_next_option(p, ndopts.nd_opts_ri_end)) {
> @@ -1442,6 +1441,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>
>         if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) {
>                 struct nd_opt_hdr *p;
> +
>                 for (p = ndopts.nd_opts_pi;
>                      p;
>                      p = ndisc_next_option(p, ndopts.nd_opts_pi_end)) {
> @@ -1455,7 +1455,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>                 __be32 n;
>                 u32 mtu;
>
> -               memcpy(&n, ((u8 *)(ndopts.nd_opts_mtu+1))+2, sizeof(mtu));
> +               memcpy(&n, ((u8 *)(ndopts.nd_opts_mtu + 1)) + 2, sizeof(mtu));
>                 mtu = ntohl(n);
>
>                 if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu) {
> @@ -1472,6 +1472,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>
>         if (ndopts.nd_useropts) {
>                 struct nd_opt_hdr *p;
> +
>                 for (p = ndopts.nd_useropts;
>                      p;
>                      p = ndisc_next_useropt(skb->dev, p,
> @@ -1480,9 +1481,8 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>                 }
>         }
>
> -       if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh) {
> +       if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh)
>                 ND_PRINTK(2, warn, "RA: invalid RA options\n");
> -       }
>  out:
>         ip6_rt_put(rt);
>         if (neigh)
> @@ -1518,7 +1518,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
>
>         if (!ndopts.nd_opts_rh) {
>                 ip6_redirect_no_header(skb, dev_net(skb->dev),
> -                                       skb->dev->ifindex, 0);
> +                                      skb->dev->ifindex, 0);
>                 return;
>         }
>
> @@ -1569,7 +1569,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
>         }
>
>         if (!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, target) &&
> -           ipv6_addr_type(target) != (IPV6_ADDR_UNICAST|IPV6_ADDR_LINKLOCAL)) {
> +           ipv6_addr_type(target) != (IPV6_ADDR_UNICAST | IPV6_ADDR_LINKLOCAL)) {
>                 ND_PRINTK(2, warn,
>                           "Redirect: target address is not link-local unicast\n");
>                 return;
> @@ -1587,7 +1587,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
>         if (IS_ERR(dst))
>                 return;
>
> -       rt = (struct rt6_info *) dst;
> +       rt = (struct rt6_info *)dst;
>
>         if (rt->rt6i_flags & RTF_GATEWAY) {
>                 ND_PRINTK(2, warn,
> @@ -1595,7 +1595,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
>                 goto release;
>         }
>         peer = inet_getpeer_v6(net->ipv6.peers, &ipv6_hdr(skb)->saddr, 1);
> -       ret = inet_peer_xrlim_allow(peer, 1*HZ);
> +       ret = inet_peer_xrlim_allow(peer, 1 * HZ);
>         if (peer)
>                 inet_putpeer(peer);
>         if (!ret)
> @@ -1603,6 +1603,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
>
>         if (dev->addr_len) {
>                 struct neighbour *neigh = dst_neigh_lookup(skb_dst(skb), target);
> +
>                 if (!neigh) {
>                         ND_PRINTK(2, warn,
>                                   "Redirect: no neigh for target address\n");
> @@ -1787,6 +1788,7 @@ static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl,
>  {
>         static char warncomm[TASK_COMM_LEN];
>         static int warned;
> +
>         if (strcmp(warncomm, current->comm) && warned < 5) {
>                 strcpy(warncomm, current->comm);
>                 pr_warn("process `%s' is using deprecated sysctl (%s) net.ipv6.neigh.%s.%s - use net.ipv6.neigh.%s.%s_ms instead\n",
> @@ -1797,7 +1799,8 @@ static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl,
>         }
>  }
>
> -int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
> +int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
> +                              void __user *buffer, size_t *lenp, loff_t *ppos)
>  {
>         struct net_device *dev = ctl->extra1;
>         struct inet6_dev *idev;
> @@ -1831,8 +1834,6 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *bu
>         }
>         return ret;
>  }
> -
> -
>  #endif
>
>  static int __net_init ndisc_net_init(struct net *net)
> --
> 2.7.4
>
>

^ permalink raw reply

* [PATCH net-next v1 0/2] ndisc.c minor clean and improvement
From: yuan linyu @ 2017-05-26 13:46 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Joe Perches, David Ahern, yuan linyu

From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>

1. fix part of checkpatch issue which I like to fix
2. __ndisc_fill_addr_option() clean

v1:
correct space value

yuan linyu (2):
  net: ndisc.c: fix coding style issue
  net: ndisc.c: minor code improvement

 net/ipv6/ndisc.c | 141 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 72 insertions(+), 69 deletions(-)

-- 
2.7.4

^ permalink raw reply

* [PATCH net-next v1 1/2] net: ndisc.c: fix coding style issue
From: yuan linyu @ 2017-05-26 13:47 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Joe Perches, David Ahern, yuan linyu

From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>

Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
---
 net/ipv6/ndisc.c | 109 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 55 insertions(+), 54 deletions(-)

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d310dc4..292c827 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -99,7 +99,6 @@ static const struct neigh_ops ndisc_hh_ops = {
 	.connected_output =	neigh_resolve_output,
 };
 
-
 static const struct neigh_ops ndisc_direct_ops = {
 	.family =		AF_INET6,
 	.output =		neigh_direct_output,
@@ -147,13 +146,13 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data,
 	u8 *opt = skb_put(skb, space);
 
 	opt[0] = type;
-	opt[1] = space>>3;
+	opt[1] = space >> 3;
 
 	memset(opt + 2, 0, pad);
 	opt   += pad;
 	space -= pad;
 
-	memcpy(opt+2, data, data_len);
+	memcpy(opt + 2, data, data_len);
 	data_len += 2;
 	opt += data_len;
 	space -= data_len;
@@ -182,6 +181,7 @@ static struct nd_opt_hdr *ndisc_next_option(struct nd_opt_hdr *cur,
 					    struct nd_opt_hdr *end)
 {
 	int type;
+
 	if (!cur || !end || cur >= end)
 		return NULL;
 	type = cur->nd_opt_type;
@@ -222,6 +222,7 @@ struct ndisc_options *ndisc_parse_options(const struct net_device *dev,
 	memset(ndopts, 0, sizeof(*ndopts));
 	while (opt_len) {
 		int l;
+
 		if (opt_len < sizeof(struct nd_opt_hdr))
 			return NULL;
 		l = nd_opt->nd_opt_len << 3;
@@ -327,9 +328,8 @@ static int ndisc_constructor(struct neighbour *neigh)
 	bool is_multicast = ipv6_addr_is_multicast(addr);
 
 	in6_dev = in6_dev_get(dev);
-	if (!in6_dev) {
+	if (!in6_dev)
 		return -EINVAL;
-	}
 
 	parms = in6_dev->nd_parms;
 	__neigh_parms_put(neigh->parms);
@@ -344,12 +344,12 @@ static int ndisc_constructor(struct neighbour *neigh)
 		if (is_multicast) {
 			neigh->nud_state = NUD_NOARP;
 			ndisc_mc_map(addr, neigh->ha, dev, 1);
-		} else if (dev->flags&(IFF_NOARP|IFF_LOOPBACK)) {
+		} else if (dev->flags & (IFF_NOARP | IFF_LOOPBACK)) {
 			neigh->nud_state = NUD_NOARP;
 			memcpy(neigh->ha, dev->dev_addr, dev->addr_len);
-			if (dev->flags&IFF_LOOPBACK)
+			if (dev->flags & IFF_LOOPBACK)
 				neigh->type = RTN_LOCAL;
-		} else if (dev->flags&IFF_POINTOPOINT) {
+		} else if (dev->flags & IFF_POINTOPOINT) {
 			neigh->nud_state = NUD_NOARP;
 			memcpy(neigh->ha, dev->broadcast, dev->addr_len);
 		}
@@ -357,7 +357,7 @@ static int ndisc_constructor(struct neighbour *neigh)
 			neigh->ops = &ndisc_hh_ops;
 		else
 			neigh->ops = &ndisc_generic_ops;
-		if (neigh->nud_state&NUD_VALID)
+		if (neigh->nud_state & NUD_VALID)
 			neigh->output = neigh->ops->connected_output;
 		else
 			neigh->output = neigh->ops->output;
@@ -580,7 +580,7 @@ void ndisc_send_ns(struct net_device *dev, const struct in6_addr *solicit,
 
 	if (!saddr) {
 		if (ipv6_get_lladdr(dev, &addr_buf,
-				   (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)))
+				   (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC)))
 			return;
 		saddr = &addr_buf;
 	}
@@ -641,9 +641,8 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
 		struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev_net(dev), saddr,
 							   dev, 1);
 		if (ifp) {
-			if (ifp->flags & IFA_F_OPTIMISTIC)  {
+			if (ifp->flags & IFA_F_OPTIMISTIC)
 				send_sllao = 0;
-			}
 			in6_ifa_put(ifp);
 		} else {
 			send_sllao = 0;
@@ -672,7 +671,6 @@ void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
 	ndisc_send_skb(skb, daddr, saddr);
 }
 
-
 static void ndisc_error_report(struct neighbour *neigh, struct sk_buff *skb)
 {
 	/*
@@ -695,7 +693,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
 
 	if (skb && ipv6_chk_addr_and_flags(dev_net(dev), &ipv6_hdr(skb)->saddr,
 					   dev, 1,
-					   IFA_F_TENTATIVE|IFA_F_OPTIMISTIC))
+					   IFA_F_TENTATIVE | IFA_F_OPTIMISTIC))
 		saddr = &ipv6_hdr(skb)->saddr;
 	probes -= NEIGH_VAR(neigh->parms, UCAST_PROBES);
 	if (probes < 0) {
@@ -806,7 +804,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 	ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1);
 	if (ifp) {
 have_ifp:
-		if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) {
+		if (ifp->flags & (IFA_F_TENTATIVE | IFA_F_OPTIMISTIC)) {
 			if (dad) {
 				if (nonce != 0 && ifp->dad_nonce == nonce) {
 					u8 *np = (u8 *)&nonce;
@@ -824,16 +822,15 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 				 */
 				addrconf_dad_failure(ifp);
 				return;
-			} else {
-				/*
-				 * This is not a dad solicitation.
-				 * If we are an optimistic node,
-				 * we should respond.
-				 * Otherwise, we should ignore it.
-				 */
-				if (!(ifp->flags & IFA_F_OPTIMISTIC))
-					goto out;
 			}
+			/*
+			 * This is not a dad solicitation.
+			 * If we are an optimistic node,
+			 * we should respond.
+			 * Otherwise, we should ignore it.
+			 */
+			if (!(ifp->flags & IFA_F_OPTIMISTIC))
+				goto out;
 		}
 
 		idev = ifp->idev;
@@ -874,6 +871,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 				 * (RFC2461) -- yoshfuji
 				 */
 				struct sk_buff *n = skb_clone(skb, GFP_ATOMIC);
+
 				if (n)
 					pneigh_enqueue(&nd_tbl, idev->nd_parms, n);
 				goto out;
@@ -904,7 +902,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 			       !inc || lladdr || !dev->addr_len);
 	if (neigh)
 		ndisc_update(dev, neigh, lladdr, NUD_STALE,
-			     NEIGH_UPDATE_F_WEAK_OVERRIDE|
+			     NEIGH_UPDATE_F_WEAK_OVERRIDE |
 			     NEIGH_UPDATE_F_OVERRIDE,
 			     NDISC_NEIGHBOUR_SOLICITATION, &ndopts);
 	if (neigh || !dev->header_ops) {
@@ -973,10 +971,10 @@ static void ndisc_recv_na(struct sk_buff *skb)
 	}
 	ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1);
 	if (ifp) {
-		if (skb->pkt_type != PACKET_LOOPBACK
-		    && (ifp->flags & IFA_F_TENTATIVE)) {
-				addrconf_dad_failure(ifp);
-				return;
+		if (skb->pkt_type != PACKET_LOOPBACK &&
+		    (ifp->flags & IFA_F_TENTATIVE)) {
+			addrconf_dad_failure(ifp);
+			return;
 		}
 		/* What should we make now? The advertisement
 		   is invalid, but ndisc specs say nothing
@@ -1081,8 +1079,8 @@ static void ndisc_recv_rs(struct sk_buff *skb)
 	neigh = __neigh_lookup(&nd_tbl, saddr, skb->dev, 1);
 	if (neigh) {
 		ndisc_update(skb->dev, neigh, lladdr, NUD_STALE,
-			     NEIGH_UPDATE_F_WEAK_OVERRIDE|
-			     NEIGH_UPDATE_F_OVERRIDE|
+			     NEIGH_UPDATE_F_WEAK_OVERRIDE |
+			     NEIGH_UPDATE_F_OVERRIDE |
 			     NEIGH_UPDATE_F_OVERRIDE_ISROUTER,
 			     NDISC_ROUTER_SOLICITATION, &ndopts);
 		neigh_release(neigh);
@@ -1110,9 +1108,8 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
 	}
 
 	nlh = nlmsg_put(skb, 0, 0, RTM_NEWNDUSEROPT, base_size, 0);
-	if (!nlh) {
+	if (!nlh)
 		goto nla_put_failure;
-	}
 
 	ndmsg = nlmsg_data(nlh);
 	ndmsg->nduseropt_family = AF_INET6;
@@ -1325,21 +1322,21 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	if (in6_dev->nd_parms) {
 		unsigned long rtime = ntohl(ra_msg->retrans_timer);
 
-		if (rtime && rtime/1000 < MAX_SCHEDULE_TIMEOUT/HZ) {
-			rtime = (rtime*HZ)/1000;
-			if (rtime < HZ/10)
-				rtime = HZ/10;
+		if (rtime && rtime / 1000 < MAX_SCHEDULE_TIMEOUT / HZ) {
+			rtime = (rtime * HZ) / 1000;
+			if (rtime < HZ / 10)
+				rtime = HZ / 10;
 			NEIGH_VAR_SET(in6_dev->nd_parms, RETRANS_TIME, rtime);
 			in6_dev->tstamp = jiffies;
 			send_ifinfo_notify = true;
 		}
 
 		rtime = ntohl(ra_msg->reachable_time);
-		if (rtime && rtime/1000 < MAX_SCHEDULE_TIMEOUT/(3*HZ)) {
-			rtime = (rtime*HZ)/1000;
+		if (rtime && rtime / 1000 < MAX_SCHEDULE_TIMEOUT / (3 * HZ)) {
+			rtime = (rtime * HZ) / 1000;
 
-			if (rtime < HZ/10)
-				rtime = HZ/10;
+			if (rtime < HZ / 10)
+				rtime = HZ / 10;
 
 			if (rtime != NEIGH_VAR(in6_dev->nd_parms, BASE_REACHABLE_TIME)) {
 				NEIGH_VAR_SET(in6_dev->nd_parms,
@@ -1370,6 +1367,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 				       skb->dev, 1);
 	if (neigh) {
 		u8 *lladdr = NULL;
+
 		if (ndopts.nd_opts_src_lladdr) {
 			lladdr = ndisc_opt_addr_data(ndopts.nd_opts_src_lladdr,
 						     skb->dev);
@@ -1380,9 +1378,9 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 			}
 		}
 		ndisc_update(skb->dev, neigh, lladdr, NUD_STALE,
-			     NEIGH_UPDATE_F_WEAK_OVERRIDE|
-			     NEIGH_UPDATE_F_OVERRIDE|
-			     NEIGH_UPDATE_F_OVERRIDE_ISROUTER|
+			     NEIGH_UPDATE_F_WEAK_OVERRIDE |
+			     NEIGH_UPDATE_F_OVERRIDE |
+			     NEIGH_UPDATE_F_OVERRIDE_ISROUTER |
 			     NEIGH_UPDATE_F_ISROUTER,
 			     NDISC_ROUTER_ADVERTISEMENT, &ndopts);
 	}
@@ -1406,6 +1404,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 
 	if (in6_dev->cnf.accept_ra_rtr_pref && ndopts.nd_opts_ri) {
 		struct nd_opt_hdr *p;
+
 		for (p = ndopts.nd_opts_ri;
 		     p;
 		     p = ndisc_next_option(p, ndopts.nd_opts_ri_end)) {
@@ -1442,6 +1441,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 
 	if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) {
 		struct nd_opt_hdr *p;
+
 		for (p = ndopts.nd_opts_pi;
 		     p;
 		     p = ndisc_next_option(p, ndopts.nd_opts_pi_end)) {
@@ -1455,7 +1455,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 		__be32 n;
 		u32 mtu;
 
-		memcpy(&n, ((u8 *)(ndopts.nd_opts_mtu+1))+2, sizeof(mtu));
+		memcpy(&n, ((u8 *)(ndopts.nd_opts_mtu + 1)) + 2, sizeof(mtu));
 		mtu = ntohl(n);
 
 		if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu) {
@@ -1472,6 +1472,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 
 	if (ndopts.nd_useropts) {
 		struct nd_opt_hdr *p;
+
 		for (p = ndopts.nd_useropts;
 		     p;
 		     p = ndisc_next_useropt(skb->dev, p,
@@ -1480,9 +1481,8 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 		}
 	}
 
-	if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh) {
+	if (ndopts.nd_opts_tgt_lladdr || ndopts.nd_opts_rh)
 		ND_PRINTK(2, warn, "RA: invalid RA options\n");
-	}
 out:
 	ip6_rt_put(rt);
 	if (neigh)
@@ -1518,7 +1518,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
 
 	if (!ndopts.nd_opts_rh) {
 		ip6_redirect_no_header(skb, dev_net(skb->dev),
-					skb->dev->ifindex, 0);
+				       skb->dev->ifindex, 0);
 		return;
 	}
 
@@ -1569,7 +1569,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 	}
 
 	if (!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, target) &&
-	    ipv6_addr_type(target) != (IPV6_ADDR_UNICAST|IPV6_ADDR_LINKLOCAL)) {
+	    ipv6_addr_type(target) != (IPV6_ADDR_UNICAST | IPV6_ADDR_LINKLOCAL)) {
 		ND_PRINTK(2, warn,
 			  "Redirect: target address is not link-local unicast\n");
 		return;
@@ -1587,7 +1587,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 	if (IS_ERR(dst))
 		return;
 
-	rt = (struct rt6_info *) dst;
+	rt = (struct rt6_info *)dst;
 
 	if (rt->rt6i_flags & RTF_GATEWAY) {
 		ND_PRINTK(2, warn,
@@ -1595,7 +1595,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 		goto release;
 	}
 	peer = inet_getpeer_v6(net->ipv6.peers, &ipv6_hdr(skb)->saddr, 1);
-	ret = inet_peer_xrlim_allow(peer, 1*HZ);
+	ret = inet_peer_xrlim_allow(peer, 1 * HZ);
 	if (peer)
 		inet_putpeer(peer);
 	if (!ret)
@@ -1603,6 +1603,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
 
 	if (dev->addr_len) {
 		struct neighbour *neigh = dst_neigh_lookup(skb_dst(skb), target);
+
 		if (!neigh) {
 			ND_PRINTK(2, warn,
 				  "Redirect: no neigh for target address\n");
@@ -1787,6 +1788,7 @@ static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl,
 {
 	static char warncomm[TASK_COMM_LEN];
 	static int warned;
+
 	if (strcmp(warncomm, current->comm) && warned < 5) {
 		strcpy(warncomm, current->comm);
 		pr_warn("process `%s' is using deprecated sysctl (%s) net.ipv6.neigh.%s.%s - use net.ipv6.neigh.%s.%s_ms instead\n",
@@ -1797,7 +1799,8 @@ static void ndisc_warn_deprecated_sysctl(struct ctl_table *ctl,
 	}
 }
 
-int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
+int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
+			       void __user *buffer, size_t *lenp, loff_t *ppos)
 {
 	struct net_device *dev = ctl->extra1;
 	struct inet6_dev *idev;
@@ -1831,8 +1834,6 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, void __user *bu
 	}
 	return ret;
 }
-
-
 #endif
 
 static int __net_init ndisc_net_init(struct net *net)
-- 
2.7.4

^ permalink raw reply related

* [PATCH net-next v1 2/2] net: ndisc.c: minor code improvement
From: yuan linyu @ 2017-05-26 13:48 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, Joe Perches, David Ahern, yuan linyu

From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>

on x86_64, text size decrease 64 bytes

Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
---
 net/ipv6/ndisc.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 292c827..8051b46 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -147,17 +147,18 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data,
 
 	opt[0] = type;
 	opt[1] = space >> 3;
+	opt   += 2;
+	space -= 2;
 
-	memset(opt + 2, 0, pad);
+	memset(opt, 0, pad);
 	opt   += pad;
 	space -= pad;
 
-	memcpy(opt + 2, data, data_len);
-	data_len += 2;
+	memcpy(opt, data, data_len);
 	opt += data_len;
 	space -= data_len;
-	if (space > 0)
-		memset(opt, 0, space);
+
+	memset(opt, 0, space);
 }
 EXPORT_SYMBOL_GPL(__ndisc_fill_addr_option);
 
@@ -997,6 +998,7 @@ static void ndisc_recv_na(struct sk_buff *skb)
 	if (neigh) {
 		u8 old_flags = neigh->flags;
 		struct net *net = dev_net(dev);
+		u32 flags;
 
 		if (neigh->nud_state & NUD_FAILED)
 			goto out;
@@ -1013,13 +1015,14 @@ static void ndisc_recv_na(struct sk_buff *skb)
 			goto out;
 		}
 
+		flags = NEIGH_UPDATE_F_WEAK_OVERRIDE | NEIGH_UPDATE_F_OVERRIDE_ISROUTER;
+		if (msg->icmph.icmp6_override)
+			flags |= NEIGH_UPDATE_F_OVERRIDE;
+		if (msg->icmph.icmp6_router)
+			flags |= NEIGH_UPDATE_F_ISROUTER;
 		ndisc_update(dev, neigh, lladdr,
 			     msg->icmph.icmp6_solicited ? NUD_REACHABLE : NUD_STALE,
-			     NEIGH_UPDATE_F_WEAK_OVERRIDE|
-			     (msg->icmph.icmp6_override ? NEIGH_UPDATE_F_OVERRIDE : 0)|
-			     NEIGH_UPDATE_F_OVERRIDE_ISROUTER|
-			     (msg->icmph.icmp6_router ? NEIGH_UPDATE_F_ISROUTER : 0),
-			     NDISC_NEIGHBOUR_ADVERTISEMENT, &ndopts);
+			     flags, NDISC_NEIGHBOUR_ADVERTISEMENT, &ndopts);
 
 		if ((old_flags & ~neigh->flags) & NTF_ROUTER) {
 			/*
@@ -1217,12 +1220,11 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 	 * received RA message (RFC 2462) -- yoshfuji
 	 */
 	old_if_flags = in6_dev->if_flags;
-	in6_dev->if_flags = (in6_dev->if_flags & ~(IF_RA_MANAGED |
-				IF_RA_OTHERCONF)) |
-				(ra_msg->icmph.icmp6_addrconf_managed ?
-					IF_RA_MANAGED : 0) |
-				(ra_msg->icmph.icmp6_addrconf_other ?
-					IF_RA_OTHERCONF : 0);
+	in6_dev->if_flags &= ~(IF_RA_MANAGED | IF_RA_OTHERCONF);
+	if (ra_msg->icmph.icmp6_addrconf_managed)
+		in6_dev->if_flags |= IF_RA_MANAGED;
+	if (ra_msg->icmph.icmp6_addrconf_other)
+		in6_dev->if_flags |= IF_RA_OTHERCONF;
 
 	if (old_if_flags != in6_dev->if_flags)
 		send_ifinfo_notify = true;
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH net-next 1/2] net: ndisc.c: fix coding style issue
From: yuan linyu @ 2017-05-26 13:55 UTC (permalink / raw)
  To: 吉藤英明
  Cc: network dev, David S . Miller, Joe Perches, David Ahern,
	yuan linyu, YOSHIFUJI Hideaki
In-Reply-To: <CAPA1RqDqyZicNWM8arSvMfQjmy_A=LLEjtTwH8KTza4WwQ_dsg@mail.gmail.com>

On 五, 2017-05-26 at 22:45 +0900, 吉藤英明 wrote:
> Hi,
> 
> 2017-05-26 22:23 GMT+09:00 yuan linyu <cugyly@163.com>:
> > 
> > From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > 
> > Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> > ---
> >  net/ipv6/ndisc.c | 109 ++++++++++++++++++++++++++++---------------------------
> >  1 file changed, 55 insertions(+), 54 deletions(-)
> Sorry, I don't think this kind of change for style is good
> bacause this makes effort of  backport more difficult.
hi, i can't understand. 
if any change of this code you decide to backport, it need effort,
not only important fix.

do I miss your point ?
> 
> --yoshfuji
> 

^ permalink raw reply

* Re: [patch net-next 01/18] bridge: Export VLAN filtering state
From: Ido Schimmel @ 2017-05-26 14:02 UTC (permalink / raw)
  To: Nikolay Aleksandrov; +Cc: Jiri Pirko, netdev, davem, mlxsw, stephen
In-Reply-To: <b2edc91e-d7cf-a667-2b00-5722ed09a2a6@cumulusnetworks.com>

Hi Nik,

On Fri, May 26, 2017 at 11:55:18AM +0300, Nikolay Aleksandrov wrote:
> On 5/26/17 9:37 AM, Jiri Pirko wrote:
> > From: Ido Schimmel <idosch@mellanox.com>
> > 
> > It's useful for drivers supporting bridge offload to be able to query
> > the bridge's VLAN filtering state.
> > 
> > Currently, upon enslavement to a bridge master, the offloading driver
> > will only learn about the bridge's VLAN filtering state after the bridge
> > device was already linked with its slave.
> > 
> > Being able to query the bridge's VLAN filtering state allows such
> > drivers to forbid enslavement in case resource couldn't be allocated for
> > a VLAN-aware bridge and also choose the correct initialization routine
> > for the enslaved port, which is dependent on the bridge type.
> > 
> > Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> > Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> > ---
> >   include/linux/if_bridge.h | 9 +++++++++
> >   net/bridge/br_if.c        | 2 +-
> >   net/bridge/br_mdb.c       | 4 ++--
> >   net/bridge/br_netlink.c   | 2 +-
> >   net/bridge/br_private.h   | 9 ---------
> >   net/bridge/br_vlan.c      | 8 ++++++++
> >   6 files changed, 21 insertions(+), 13 deletions(-)
> > 
> 
> I must say this bridge -> dev -> bridge looks weird from the bridge POV.
> Since exports like this seem to be increasing I think it'd be nice to
> make some API that can be queried instead of exporting symbols for each
> bridge option or attribute. In this case maybe a simpler solution would've
> been only a new exported symbol for external users.

It seemed more logical to me to export the existing function, but I can
instead leave it as-is and introduce a new symbol. I'll wait for more
comments and send a v2 if deemed necessary.

> The patch itself looks good to me.
> 
> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

Thanks for reviewing!

^ permalink raw reply

* Re: [PATCH net-next 2/2] net: ndisc.c: minor code improvement
From: Joe Perches @ 2017-05-26 14:05 UTC (permalink / raw)
  To: yuan linyu, netdev; +Cc: David S . Miller, David Ahern, yuan linyu
In-Reply-To: <1495805052-2974-1-git-send-email-cugyly@163.com>

On Fri, 2017-05-26 at 21:24 +0800, yuan linyu wrote:
> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> 
> on x86_64, text size decrease 80 bytes

You are sending whitespace and code reduction changes.

Please send the object code size reduction changes
as a separate patch from the whitespace only changes.

> Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> ---
>  net/ipv6/ndisc.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index 292c827..ee9b12c 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -147,17 +147,16 @@ void __ndisc_fill_addr_option(struct sk_buff *skb, int type, void *data,
>  
>  	opt[0] = type;
>  	opt[1] = space >> 3;
> +	opt   += 2;
>  
> -	memset(opt + 2, 0, pad);
> +	memset(opt, 0, pad);
>  	opt   += pad;
>  	space -= pad;
>  
> -	memcpy(opt + 2, data, data_len);
> -	data_len += 2;
> +	memcpy(opt, data, data_len);
>  	opt += data_len;
>  	space -= data_len;
> -	if (space > 0)
> -		memset(opt, 0, space);
> +	memset(opt, 0, space);
>  }
>  EXPORT_SYMBOL_GPL(__ndisc_fill_addr_option);
>  
> @@ -997,6 +996,7 @@ static void ndisc_recv_na(struct sk_buff *skb)
>  	if (neigh) {
>  		u8 old_flags = neigh->flags;
>  		struct net *net = dev_net(dev);
> +		u32 flags;
>  
>  		if (neigh->nud_state & NUD_FAILED)
>  			goto out;
> @@ -1013,13 +1013,14 @@ static void ndisc_recv_na(struct sk_buff *skb)
>  			goto out;
>  		}
>  
> +		flags = NEIGH_UPDATE_F_WEAK_OVERRIDE | NEIGH_UPDATE_F_OVERRIDE_ISROUTER;
> +		if (msg->icmph.icmp6_override)
> +			flags |= NEIGH_UPDATE_F_OVERRIDE;
> +		if (msg->icmph.icmp6_router)
> +			flags |= NEIGH_UPDATE_F_ISROUTER;
>  		ndisc_update(dev, neigh, lladdr,
>  			     msg->icmph.icmp6_solicited ? NUD_REACHABLE : NUD_STALE,
> -			     NEIGH_UPDATE_F_WEAK_OVERRIDE|
> -			     (msg->icmph.icmp6_override ? NEIGH_UPDATE_F_OVERRIDE : 0)|
> -			     NEIGH_UPDATE_F_OVERRIDE_ISROUTER|
> -			     (msg->icmph.icmp6_router ? NEIGH_UPDATE_F_ISROUTER : 0),
> -			     NDISC_NEIGHBOUR_ADVERTISEMENT, &ndopts);
> +			     flags, NDISC_NEIGHBOUR_ADVERTISEMENT, &ndopts);
>  
>  		if ((old_flags & ~neigh->flags) & NTF_ROUTER) {
>  			/*
> @@ -1217,12 +1218,11 @@ static void ndisc_router_discovery(struct sk_buff *skb)
>  	 * received RA message (RFC 2462) -- yoshfuji
>  	 */
>  	old_if_flags = in6_dev->if_flags;
> -	in6_dev->if_flags = (in6_dev->if_flags & ~(IF_RA_MANAGED |
> -				IF_RA_OTHERCONF)) |
> -				(ra_msg->icmph.icmp6_addrconf_managed ?
> -					IF_RA_MANAGED : 0) |
> -				(ra_msg->icmph.icmp6_addrconf_other ?
> -					IF_RA_OTHERCONF : 0);
> +	in6_dev->if_flags &= ~(IF_RA_MANAGED | IF_RA_OTHERCONF);
> +	if (ra_msg->icmph.icmp6_addrconf_managed)
> +		in6_dev->if_flags |= IF_RA_MANAGED;
> +	if (ra_msg->icmph.icmp6_addrconf_other)
> +		in6_dev->if_flags |= IF_RA_OTHERCONF;
>  
>  	if (old_if_flags != in6_dev->if_flags)
>  		send_ifinfo_notify = true;

^ permalink raw reply

* Re: [PATCH net-next 3/4] tls: kernel TLS support
From: Eric Dumazet @ 2017-05-26 14:16 UTC (permalink / raw)
  To: Dave Watson
  Cc: Ilya Lesokhin, Aviad Yehezkel, Boris Pismenny, Liran Liss,
	Matan Barak, David Miller, netdev, Tom Herbert, herbert,
	linux-crypto, Hannes Frederic Sowa, Alexei Starovoitov, nmav,
	fridolin.pokorny
In-Reply-To: <20170524162708.GA24215@davejwatson-mba.local>

On Wed, 2017-05-24 at 09:27 -0700, Dave Watson wrote:
> Software implementation of transport layer security, implemented using ULP
> infrastructure.  tcp proto_ops are replaced with tls equivalents of sendmsg and
> sendpage.

...

> +
> +int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
> +{
	...
> +
> +	lock_sock(sk);
> +
> +	/* Only one writer at a time is allowed */
> +	if (sk->sk_write_pending)
> +		return -EBUSY;

Ouch...

^ permalink raw reply

* Re: [PATCH v3 1/2] net: phy: Add Cortina CS4340 driver (fwd)
From: Julia Lawall @ 2017-05-26 14:31 UTC (permalink / raw)
  To: Bogdan Purcareata
  Cc: andrew-g2DYL2Zd6BY, f.fainelli-Re5JQEeQqe8AvxtiuMwx3w,
	netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, kbuild-all-JC7UmRfGjtg

The u32 values on lines 73 and 79 will not be less than 0.

julia

---------- Forwarded message ----------
Date: Fri, 26 May 2017 19:31:28 +0800
From: kbuild test robot <fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: kbuild-JC7UmRfGjtg@public.gmane.org
Cc: Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>
Subject: Re: [PATCH v3 1/2] net: phy: Add Cortina CS4340 driver

CC: kbuild-all-JC7UmRfGjtg@public.gmane.org
In-Reply-To: <1495785519-1468-2-git-send-email-bogdan.purcareata-3arQi8VN3Tc@public.gmane.org>
TO: Bogdan Purcareata <bogdan.purcareata-3arQi8VN3Tc@public.gmane.org>
CC: andrew-g2DYL2Zd6BY@public.gmane.org, f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
CC:

Hi Bogdan,

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.12-rc2 next-20170526]
[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/Bogdan-Purcareata/net-phy-Add-Cortina-CS4340-driver/20170526-170949
:::::: branch date: 2 hours ago
:::::: commit date: 2 hours ago

>> drivers/net/phy/cortina.c:73:5-11: WARNING: Unsigned expression compared with zero: id_lsb < 0
>> drivers/net/phy/cortina.c:79:5-11: WARNING: Unsigned expression compared with zero: id_msb < 0

git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 84281ef4be227acc6a2f638da7a6842f7f55348d
vim +73 drivers/net/phy/cortina.c

84281ef4 Bogdan Purcareata 2017-05-26  67  static int cortina_probe(struct phy_device *phydev)
84281ef4 Bogdan Purcareata 2017-05-26  68  {
84281ef4 Bogdan Purcareata 2017-05-26  69  	u32 phy_id = 0, id_lsb, id_msb;
84281ef4 Bogdan Purcareata 2017-05-26  70
84281ef4 Bogdan Purcareata 2017-05-26  71  	/* Read device id from phy registers. */
84281ef4 Bogdan Purcareata 2017-05-26  72  	id_lsb = cortina_read_reg(phydev, VILLA_GLOBAL_CHIP_ID_LSB);
84281ef4 Bogdan Purcareata 2017-05-26 @73  	if (id_lsb < 0)
84281ef4 Bogdan Purcareata 2017-05-26  74  		return -ENXIO;
84281ef4 Bogdan Purcareata 2017-05-26  75
84281ef4 Bogdan Purcareata 2017-05-26  76  	phy_id = id_lsb << 16;
84281ef4 Bogdan Purcareata 2017-05-26  77
84281ef4 Bogdan Purcareata 2017-05-26  78  	id_msb = cortina_read_reg(phydev, VILLA_GLOBAL_CHIP_ID_MSB);
84281ef4 Bogdan Purcareata 2017-05-26 @79  	if (id_msb < 0)
84281ef4 Bogdan Purcareata 2017-05-26  80  		return -ENXIO;
84281ef4 Bogdan Purcareata 2017-05-26  81
84281ef4 Bogdan Purcareata 2017-05-26  82  	phy_id |= id_msb;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
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 v3 1/2] net: phy: Add Cortina CS4340 driver (fwd)
From: Bogdan Purcareata @ 2017-05-26 14:35 UTC (permalink / raw)
  To: Julia Lawall
  Cc: andrew@lunn.ch, f.fainelli@gmail.com, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	kbuild-all@01.org
In-Reply-To: <alpine.DEB.2.20.1705261631020.2950@hadrien>

> -----Original Message-----
> From: Julia Lawall [mailto:julia.lawall@lip6.fr]
> Sent: Friday, May 26, 2017 5:32 PM
> To: Bogdan Purcareata <bogdan.purcareata@nxp.com>
> Cc: andrew@lunn.ch; f.fainelli@gmail.com; netdev@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; kbuild-all@01.org
> Subject: Re: [PATCH v3 1/2] net: phy: Add Cortina CS4340 driver (fwd)
> 
> The u32 values on lines 73 and 79 will not be less than 0.

Will change to int for proper error checking.

Thanks!
Bogdan P.

^ 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