* Re: 100% CPU load when generating traffic to destination network that nexthop is not reachable
From: Eric Dumazet @ 2017-08-15 19:11 UTC (permalink / raw)
To: Paweł Staszewski; +Cc: Linux Kernel Network Developers
In-Reply-To: <baa1807d-cc00-0182-4b34-4d986d62ebcb@itcare.pl>
On Tue, 2017-08-15 at 19:42 +0200, Paweł Staszewski wrote:
> # To display the perf.data header info, please use
> --header/--header-only options.
> #
> #
> # Total Lost Samples: 0
> #
> # Samples: 2M of event 'cycles'
> # Event count (approx.): 1585571545969
> #
> # Children Self Command Shared Object Symbol
> # ........ ........ .............. ....................
> ..............................................
> #
> 1.82% 0.00% ksoftirqd/43 [kernel.vmlinux] [k]
> __softirqentry_text_start
> |
> --1.82%--__softirqentry_text_start
> |
> --1.82%--net_rx_action
> |
> --1.82%--mlx5e_napi_poll
> |
> --1.81%--mlx5e_poll_rx_cq
> |
> --1.81%--mlx5e_handle_rx_cqe
> |
> --1.79%--napi_gro_receive
> |
> --1.78%--netif_receive_skb_internal
> |
> --1.78%--__netif_receive_skb
> |
> --1.78%--__netif_receive_skb_core
> |
> --1.78%--ip_rcv
> |
> --1.78%--ip_rcv_finish
> |
> --1.76%--ip_forward
> |
> --1.76%--ip_forward_finish
> |
> --1.76%--ip_output
> |
> --1.76%--ip_finish_output
> |
> --1.76%--ip_finish_output2
> |
> --1.73%--neigh_resolve_output
> |
> --1.73%--neigh_event_send
> |
> --1.73%--__neigh_event_send
> |
> --1.70%--_raw_write_lock_bh
> queued_write_lock
> queued_write_lock_slowpath
> |
> --1.67%--queued_spin_lock_slowpath
>
>
Please try this :
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 16a1a4c4eb57fa1147f230916e2e62e18ef89562..95e0d7702029b583de8229e3c3eb923f6395b072 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -991,14 +991,18 @@ static void neigh_timer_handler(unsigned long arg)
int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
{
- int rc;
bool immediate_probe = false;
+ int rc;
+
+ /* We _should_ test this under write_lock_bh(&neigh->lock),
+ * but this is too costly.
+ */
+ if (READ_ONCE(neigh->nud_state) & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE))
+ return 0;
write_lock_bh(&neigh->lock);
rc = 0;
- if (neigh->nud_state & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE))
- goto out_unlock_bh;
if (neigh->dead)
goto out_dead;
^ permalink raw reply related
* Re: [PATCH net] datagram: When peeking datagrams with offset < 0 don't skip empty skbs
From: Paolo Abeni @ 2017-08-15 18:17 UTC (permalink / raw)
To: Willem de Bruijn; +Cc: Matthew Dawson, Network Development, Macieira, Thiago
In-Reply-To: <CAF=yD-Lacw9T7G0XZBdHZwEb6HgRuaBoyUN1oTvWixu4a0Fy6Q@mail.gmail.com>
On Tue, 2017-08-15 at 12:45 -0400, Willem de Bruijn wrote:
> On Tue, Aug 15, 2017 at 11:40 AM, Paolo Abeni <pabeni@redhat.com> wrote:
> > For the record, I thought something like the following (uncomplete,
> > does not even compile):
> > ---
> > diff --git a/include/linux/socket.h b/include/linux/socket.h
> > index 8b13db5163cc..5085cf003b88 100644
> > --- a/include/linux/socket.h
> > +++ b/include/linux/socket.h
> > @@ -286,6 +286,7 @@ struct ucred {
> > #define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */
> > #define MSG_BATCH 0x40000 /* sendmmsg(): more messages coming */
> > #define MSG_EOF MSG_FIN
> > +#define MSG_PEEK_OFF 0x80000
>
> Yes, that also works well.
>
> I'm afraid about exhausting the MSG_* flag space here for a
> feature that is not exposed to userspace. We don't have many flags
> left. We could shadow an existing flag that is unused in this context.
That was my concern, too. Fortunately there are a bunch of flags
defined but apparently unused (MSG_FIN, MSG_SYN, MSG_RST) since long
time (if I'm not too low on coffee).
We can shadow one of them (and ev. drop the above define, if really
unused).
I think that the MSG_PEEK_OFF should be explicitly cleared in
sk_peek_offset() when the 'sk_peek_off' is negative, to avoid beeing
fooled by stray bits into the 'flags' argument.
I'll try to scatch-up something tomorrow.
Thanks,
Paolo
^ permalink raw reply
* Re: [PATCH net-next 4/4] mlx4: sizeof style usage
From: Leon Romanovsky @ 2017-08-15 18:13 UTC (permalink / raw)
To: Stephen Hemminger
Cc: mlindner-eYqpPyKDWXRBDgjK7y7TUQ, mst-H+wXaHxf7aLQT0dZR+AlfA,
jasowang-H+wXaHxf7aLQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
virtualization-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
Stephen Hemminger
In-Reply-To: <20170815172919.26153-5-sthemmin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1461 bytes --]
On Tue, Aug 15, 2017 at 10:29:19AM -0700, Stephen Hemminger wrote:
> The kernel coding style is to treat sizeof as a function
> (ie. with parenthesis) not as an operator.
>
> Also use kcalloc and kmalloc_array
>
> Signed-off-by: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
> ---
> drivers/net/ethernet/mellanox/mlx4/alloc.c | 2 +-
> drivers/net/ethernet/mellanox/mlx4/cmd.c | 4 ++--
> drivers/net/ethernet/mellanox/mlx4/en_resources.c | 2 +-
> drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +-
> drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 +-
> drivers/net/ethernet/mellanox/mlx4/eq.c | 20 +++++++++---------
> drivers/net/ethernet/mellanox/mlx4/fw.c | 2 +-
> drivers/net/ethernet/mellanox/mlx4/icm.c | 2 +-
> drivers/net/ethernet/mellanox/mlx4/icm.h | 4 ++--
> drivers/net/ethernet/mellanox/mlx4/intf.c | 2 +-
> drivers/net/ethernet/mellanox/mlx4/main.c | 12 +++++------
> drivers/net/ethernet/mellanox/mlx4/mcg.c | 12 +++++------
> drivers/net/ethernet/mellanox/mlx4/mr.c | 10 ++++-----
> drivers/net/ethernet/mellanox/mlx4/qp.c | 12 +++++------
> .../net/ethernet/mellanox/mlx4/resource_tracker.c | 24 +++++++++++-----------
> 15 files changed, 56 insertions(+), 56 deletions(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH v2 net-next] bpf/verifier: track liveness for pruning
From: Edward Cree via iovisor-dev @ 2017-08-15 18:06 UTC (permalink / raw)
To: Daniel Borkmann, davem-fT/PcQaiUtIeIZ0/mPfg9Q, Alexei Starovoitov,
Alexei Starovoitov
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, iovisor-dev,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <5993226A.9010704-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>
On 15/08/17 17:33, Daniel Borkmann wrote:
> On 08/15/2017 03:53 PM, Edward Cree wrote:
>> State of a register doesn't matter if it wasn't read in reaching an exit;
>> a write screens off all reads downstream of it from all explored_states
>> upstream of it.
>> This allows us to prune many more branches; here are some processed insn
>> counts for some Cilium programs:
>> Program before after
>> bpf_lb_opt_-DLB_L3.o 6515 3361
>> bpf_lb_opt_-DLB_L4.o 8976 5176
>> bpf_lb_opt_-DUNKNOWN.o 2960 1137
>> bpf_lxc_opt_-DDROP_ALL.o 95412 48537
>> bpf_lxc_opt_-DUNKNOWN.o 141706 78718
>> bpf_netdev.o 24251 17995
>> bpf_overlay.o 10999 9385
>>
>> The runtime is also improved; here are 'time' results in ms:
>> Program before after
>> bpf_lb_opt_-DLB_L3.o 24 6
>> bpf_lb_opt_-DLB_L4.o 26 11
>> bpf_lb_opt_-DUNKNOWN.o 11 2
>> bpf_lxc_opt_-DDROP_ALL.o 1288 139
>> bpf_lxc_opt_-DUNKNOWN.o 1768 234
>> bpf_netdev.o 62 31
>> bpf_overlay.o 15 13
>>
>> Signed-off-by: Edward Cree <ecree-s/n/eUQHGBpZroRs9YW3xA@public.gmane.org>
> [...]
>> @@ -1639,10 +1675,13 @@ static int check_call(struct bpf_verifier_env *env, int func_id, int insn_idx)
>> }
>>
>> /* reset caller saved regs */
>> - for (i = 0; i < CALLER_SAVED_REGS; i++)
>> + for (i = 0; i < CALLER_SAVED_REGS; i++) {
>> mark_reg_not_init(regs, caller_saved[i]);
>> + check_reg_arg(env, i, DST_OP_NO_MARK);
>
> Ah, I oversaw that earlier, this needs to be: s/i/caller_saved[i]/
So it does. Of course testing didn't spot this, because
caller_saved[i] == i currently.
>> + }
>>
>> /* update return register */
>> + check_reg_arg(env, BPF_REG_0, DST_OP_NO_MARK);
>
> We could leave this for clarity, but ...
Yeah, I'll replace it with a comment, like the other one.
Thanks for review :)
-Ed
^ permalink raw reply
* Re: [PATCH 1/2] mlx4: remove unnecessary pci_set_drvdata()
From: Leon Romanovsky @ 2017-08-15 18:00 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Zhu Yanjun, saeedm-VPRAkNaXOzVWk0Htik3J/w,
matanb-VPRAkNaXOzVWk0Htik3J/w, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA
In-Reply-To: <20170815172149.GC15171-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]
On Tue, Aug 15, 2017 at 11:21:49AM -0600, Jason Gunthorpe wrote:
> On Tue, Aug 15, 2017 at 10:13:36AM +0300, Leon Romanovsky wrote:
> > On Tue, Aug 15, 2017 at 02:33:05AM -0400, Zhu Yanjun wrote:
> > > The driver core clears the driver data to NULL after device_release
> > > or on probe failure. Thus, it is not necessary to manually clear the
> > > device driver data to NULL.
> > >
> >
> > It makes sense and I'm pretty sure that you are right, but I'm failing
> > to find the function in device core which sets it to NULL. Can you help
> > me and present the actual call stack to that code place?
>
> http://elixir.free-electrons.com/linux/v4.13-rc1/source/drivers/base/dd.c#L840
>
> The call to the remove callback is on line 833.
>
> This is done after dropping devres, so you could allocate the drv data
> inside a devm object and everything would unwind correctly.
Thanks for the pointer. Will it be called in case of failure during
initialization too?
>
> In this case, the kfree is explicit, so I would advocate for still putting
> the null near the kfree to minimize the time where a free'd pointer is
> present - eg incase a devm callback or some other bug accidently
> touches it.
>
> Jason
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 00/12] s390/net: updates for 4.14
From: David Miller @ 2017-08-15 18:00 UTC (permalink / raw)
To: jwi; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, raspl, ubraun
In-Reply-To: <20170815150250.67158-1-jwi@linux.vnet.ibm.com>
From: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Date: Tue, 15 Aug 2017 17:02:38 +0200
> a mixed bag of minor fixes, cleanups and refactors for net-next. Please apply.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH] Adding-Agile-SD-TCP-module-and-modifying-Kconfig-and-makefile
From: Randy Dunlap @ 2017-08-15 17:50 UTC (permalink / raw)
To: David Miller
Cc: ncardwell, mohamed.a.alrshah, netdev, torvalds, linux-kernel,
mothman, borhan, zurinamh
In-Reply-To: <20170815.103651.1877616739706523154.davem@davemloft.net>
On 08/15/2017 10:36 AM, David Miller wrote:
> From: Randy Dunlap <rdunlap@infradead.org>
> Date: Tue, 15 Aug 2017 09:41:53 -0700
>
>> On 08/15/2017 06:51 AM, Neal Cardwell wrote:
>>> On Tue, Aug 15, 2017 at 9:08 AM, mohamedalrshah
>>> <mohamed.a.alrshah@ieee.org> wrote:
>>>
>>>> +static void agilesdtcp_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
>>>> +{
>>>> + struct tcp_sock *tp = tcp_sk(sk);
>>>> + struct agilesdtcp *ca = inet_csk_ca(sk);
>>>> + u32 inc_factor;
>>>> + u32 ca_inc;
>>>> + u32 current_gap, total_gap;
>>>
>>> For coding style, please order local variable declarations from
>>> longest to shortest line, also know as Reverse Christmas Tree Format.
>>
>> Per what coding style, please? This is not in current coding style nor in the
>> netdev-FAQ exceptions.
>
> It is the established practice, documented or not, and I enforce this for all
> networking code submissions.
I see. Thanks for clarifying that.
--
~Randy
^ permalink raw reply
* Re: [PATCH v4 iproute2 2/7] rdma: Add dev object
From: Leon Romanovsky @ 2017-08-15 17:46 UTC (permalink / raw)
To: David Laight
Cc: 'Stephen Hemminger', Doug Ledford,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Dennis Dalessandro, Jason Gunthorpe, Jiri Pirko, Ariel Almog,
Linux Netdev
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD005613D-VkEWCZq2GCInGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1944 bytes --]
On Tue, Aug 15, 2017 at 05:00:54PM +0000, David Laight wrote:
> From: Leon Romanovsky
> > Sent: 15 August 2017 17:47
> > On Tue, Aug 15, 2017 at 04:23:11PM +0000, David Laight wrote:
> > > From: Stephen Hemminger
> > > > Sent: 15 August 2017 17:12
> > > > On Tue, 15 Aug 2017 16:00:15 +0300
> > > > Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> > > >
> > > > > +
> > > > > +static const char *dev_caps_to_str(uint32_t idx)
> > > > > +{
> > > > > + uint64_t cap = 1 << idx;
> > > > > +
> > > > > + switch (cap) {
> > > > > + case RDMA_DEV_RESIZE_MAX_WR: return "RESIZE_MAX_WR";
> > > > > + case RDMA_DEV_BAD_PKEY_CNTR: return "BAD_PKEY_CNTR";
> > > ...
> > > > > + case RDMA_DEV_RAW_SCATTER_FCS: return "RAW_SCATTER_FCS";
> > > > > + case RDMA_DEV_RDMA_NETDEV_OPA_VNIC: return "RDMA_NETDEV_OPA_VNIC";
> > > > > + default: return "UNKNOWN";
> > > > > + }
> > > >
> > > > Could this be a table in future versions?
> > >
> > > Potentially you could define the constants using some pre-processor
> > > 'magic' that would create the table for you.
> > > Something like (but not compiled):
> > >
> > > #define RDMA_DEV_FLAGS(x) \
> > > x(RESIZE_MAX_WR, 0) \
> > > x(BAD_PKEY_CNTR, 1) \
> > > (continue for all the bits)
> > >
> > > #define RDMA_DEV_ENUM(name, bit_no) RDMA_DEV_##name = BIT(bit_no),
> > > enum {RDMA_DEV_FLAGS(RDMA_DEV_ENUM)};
> > > #undef RDMA_DEV_ENUM
> > >
> > > #define RDMA_DEV_NAMES(name, bit_no) [bit_no] = #name,
> > > static const char rdma_dev_names[] = {RDMA_DEV_FLAGS(RDMA_DEV_NAMES)};
> I missed the #undef
> > >
> >
> > David,
> >
> > How should I handle "uknown" fields without names?
>
> The function that accesses rdma_dev_names[] checks ARRAY_SIZE()
> and for a NULL pointer.
Thanks, I'll definitely try it.
>
> WRT the other comment, the spare pointers consume far less space than
> the code for your switch statement.
I don't think that space is matter for this tool.
>
> David
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: 100% CPU load when generating traffic to destination network that nexthop is not reachable
From: Paweł Staszewski @ 2017-08-15 17:42 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Linux Kernel Network Developers
In-Reply-To: <1502816253.4936.85.camel@edumazet-glaptop3.roam.corp.google.com>
# To display the perf.data header info, please use
--header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 2M of event 'cycles'
# Event count (approx.): 1585571545969
#
# Children Self Command Shared Object Symbol
# ........ ........ .............. ....................
..............................................
#
1.82% 0.00% ksoftirqd/43 [kernel.vmlinux] [k]
__softirqentry_text_start
|
--1.82%--__softirqentry_text_start
|
--1.82%--net_rx_action
|
--1.82%--mlx5e_napi_poll
|
--1.81%--mlx5e_poll_rx_cq
|
--1.81%--mlx5e_handle_rx_cqe
|
--1.79%--napi_gro_receive
|
--1.78%--netif_receive_skb_internal
|
--1.78%--__netif_receive_skb
|
--1.78%--__netif_receive_skb_core
|
--1.78%--ip_rcv
|
--1.78%--ip_rcv_finish
|
--1.76%--ip_forward
|
--1.76%--ip_forward_finish
|
--1.76%--ip_output
|
--1.76%--ip_finish_output
|
--1.76%--ip_finish_output2
|
--1.73%--neigh_resolve_output
|
--1.73%--neigh_event_send
|
--1.73%--__neigh_event_send
|
--1.70%--_raw_write_lock_bh
queued_write_lock
queued_write_lock_slowpath
|
--1.67%--queued_spin_lock_slowpath
W dniu 2017-08-15 o 18:57, Eric Dumazet pisze:
> On Tue, 2017-08-15 at 18:30 +0200, Paweł Staszewski wrote:
>> Hi
>>
>>
>> Doing some tests i discovered that when traffic is send by pktgen to
>> forwarding host where nexthop for destination network on forwarding
>> router is not reachable i have 100% cpu on all cores and perf top show
>> mostly:
>>
>> 77.19% [kernel] [k] queued_spin_lock_slowpath
>> 10.20% [kernel] [k] acpi_processor_ffh_cstate_enter
>> 1.41% [kernel] [k] queued_write_lock_slowpath
>>
> To the rescue (for us to help)
>
> perf record -a -g sleep 10
>
> perf report --stdio
>
>
>
>
^ permalink raw reply
* Re: [PATCH net-next 11/11] net: dsa: debugfs: add port vlan
From: Florian Fainelli @ 2017-08-15 17:41 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
Egil Hjelmeland, John Crispin, Woojung Huh, Sean Wang,
Volodymyr Bendiuga, Nikita Yushchenko, Maxime Hadjinlian,
Chris Healy, Maxim Uvarov, Stefan Eichenberger, Jason Cobham,
Juergen Borleis, Tobias Waldekranz
In-Reply-To: <20170814222242.10643-12-vivien.didelot@savoirfairelinux.com>
On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> Add a debug filesystem "vlan" entry to query a port's hardware VLAN
> entries through the .port_vlan_dump switch operation.
>
> This is really convenient to query directly the hardware or inspect DSA
> or CPU links, since these ports are not exposed to userspace.
>
> Here are the VLAN entries for a CPU port:
>
> # cat port5/vlan
> vid 1
> vid 42 pvid
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> net/dsa/debugfs.c | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/net/dsa/debugfs.c b/net/dsa/debugfs.c
> index 98c5068d20da..b00942368d29 100644
> --- a/net/dsa/debugfs.c
> +++ b/net/dsa/debugfs.c
> @@ -286,6 +286,34 @@ static const struct dsa_debugfs_ops dsa_debugfs_tree_ops = {
> .read = dsa_debugfs_tree_read,
> };
>
> +static int dsa_debugfs_vlan_dump_cb(u16 vid, bool pvid, bool untagged,
> + void *data)
> +{
> + struct seq_file *seq = data;
> +
> + seq_printf(seq, "vid %d", vid);
> + if (pvid)
> + seq_puts(seq, " pvid");
> + if (untagged)
> + seq_puts(seq, " untagged");
Personal preference: could we just specify something like:
vid 1 (t)
vid 42 (u) pvid
to clearly show which VLAN is tagged/untagged?
Other than that:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next 10/11] net: dsa: restore VLAN dump
From: Florian Fainelli @ 2017-08-15 17:39 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
Egil Hjelmeland, John Crispin, Woojung Huh, Sean Wang,
Volodymyr Bendiuga, Nikita Yushchenko, Maxime Hadjinlian,
Chris Healy, Maxim Uvarov, Stefan Eichenberger, Jason Cobham,
Juergen Borleis, Tobias Waldekranz
In-Reply-To: <20170814222242.10643-11-vivien.didelot@savoirfairelinux.com>
On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> This commit defines a dsa_vlan_dump_cb_t callback, similar to the FDB
> dump callback and partly reverts commit a0b6b8c9fa3c ("net: dsa: Remove
> support for vlan dump from DSA's drivers") to restore the DSA drivers
> VLAN dump operations.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next 09/11] net: dsa: debugfs: add port mdb
From: Florian Fainelli @ 2017-08-15 17:38 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
Egil Hjelmeland, John Crispin, Woojung Huh, Sean Wang,
Volodymyr Bendiuga, Nikita Yushchenko, Maxime Hadjinlian,
Chris Healy, Maxim Uvarov, Stefan Eichenberger, Jason Cobham,
Juergen Borleis, Tobias Waldekranz
In-Reply-To: <20170814222242.10643-10-vivien.didelot@savoirfairelinux.com>
On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> Add a debug filesystem "mdb" entry to query a port's hardware MDB
> entries through the .port_mdb_dump switch operation.
>
> This is really convenient to query directly the hardware or inspect DSA
> or CPU links, since these ports are not exposed to userspace.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next 08/11] net: dsa: restore mdb dump
From: Florian Fainelli @ 2017-08-15 17:38 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
Egil Hjelmeland, John Crispin, Woojung Huh, Sean Wang,
Volodymyr Bendiuga, Nikita Yushchenko, Maxime Hadjinlian,
Chris Healy, Maxim Uvarov, Stefan Eichenberger, Jason Cobham,
Juergen Borleis, Tobias Waldekranz
In-Reply-To: <20170814222242.10643-9-vivien.didelot@savoirfairelinux.com>
On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> The same dsa_fdb_dump_cb_t callback is used since there is no
> distinction to do between FDB and MDB entries at this layer.
>
> Implement mv88e6xxx_port_mdb_dump so that multicast addresses associated
> to a switch port can be dumped.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> drivers/net/dsa/mv88e6xxx/chip.c | 33 +++++++++++++++++++++++++--------
> include/net/dsa.h | 3 +++
> 2 files changed, 28 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index 918d8f0fe091..2ad32734b6f6 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -1380,7 +1380,7 @@ static int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port,
> }
>
> static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip,
> - u16 fid, u16 vid, int port,
> + u16 fid, u16 vid, int port, bool mc,
> dsa_fdb_dump_cb_t *cb, void *data)
> {
> struct mv88e6xxx_atu_entry addr;
> @@ -1401,11 +1401,14 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip,
> if (addr.trunk || (addr.portvec & BIT(port)) == 0)
> continue;
>
> - if (!is_unicast_ether_addr(addr.mac))
> + if ((is_unicast_ether_addr(addr.mac) && mc) ||
Should not this remain:
if (!is_unicast_ether_addr(addr.mac) && mc) ||
(is_multicast_ether_addr(addr.mac) && !mc)
here, being:
- if this is an *not* an unicast address and MC dump is requested or
- if this is a multicast address and MC dump is not requested
--
Florian
^ permalink raw reply
* Re: [PATCH] Adding-Agile-SD-TCP-module-and-modifying-Kconfig-and-makefile
From: David Miller @ 2017-08-15 17:36 UTC (permalink / raw)
To: rdunlap
Cc: ncardwell, mohamed.a.alrshah, netdev, torvalds, linux-kernel,
mothman, borhan, zurinamh
In-Reply-To: <5fac1100-c7d3-85ed-8230-53e6ffb3df0a@infradead.org>
From: Randy Dunlap <rdunlap@infradead.org>
Date: Tue, 15 Aug 2017 09:41:53 -0700
> On 08/15/2017 06:51 AM, Neal Cardwell wrote:
>> On Tue, Aug 15, 2017 at 9:08 AM, mohamedalrshah
>> <mohamed.a.alrshah@ieee.org> wrote:
>>
>>> +static void agilesdtcp_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
>>> +{
>>> + struct tcp_sock *tp = tcp_sk(sk);
>>> + struct agilesdtcp *ca = inet_csk_ca(sk);
>>> + u32 inc_factor;
>>> + u32 ca_inc;
>>> + u32 current_gap, total_gap;
>>
>> For coding style, please order local variable declarations from
>> longest to shortest line, also know as Reverse Christmas Tree Format.
>
> Per what coding style, please? This is not in current coding style nor in the
> netdev-FAQ exceptions.
It is the established practice, documented or not, and I enforce this for all
networking code submissions.
^ permalink raw reply
* Re: [PATCH net-next 07/11] net: dsa: debugfs: add port fdb
From: Florian Fainelli @ 2017-08-15 17:35 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
Egil Hjelmeland, John Crispin, Woojung Huh, Sean Wang,
Volodymyr Bendiuga, Nikita Yushchenko, Maxime Hadjinlian,
Chris Healy, Maxim Uvarov, Stefan Eichenberger, Jason Cobham,
Juergen Borleis, Tobias Waldekranz
In-Reply-To: <20170814222242.10643-8-vivien.didelot@savoirfairelinux.com>
On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> Add a debug filesystem "fdb" entry to query a port's hardware FDB
> entries through the .port_fdb_dump switch operation.
>
> This is really convenient to query directly the hardware or inspect DSA
> or CPU links, since these ports are not exposed to userspace.
>
> # cat port1/fdb
> vid 0 12:34:56:78:90:ab static unicast
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> net/dsa/debugfs.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/net/dsa/debugfs.c b/net/dsa/debugfs.c
> index 012fcf466cc1..8204c62dc9c1 100644
> --- a/net/dsa/debugfs.c
> +++ b/net/dsa/debugfs.c
> @@ -10,6 +10,7 @@
> */
>
> #include <linux/debugfs.h>
> +#include <linux/etherdevice.h>
> #include <linux/seq_file.h>
>
> #include "dsa_priv.h"
> @@ -109,6 +110,36 @@ static int dsa_debugfs_create_file(struct dsa_switch *ds, struct dentry *dir,
> return 0;
> }
>
> +static int dsa_debugfs_fdb_dump_cb(const unsigned char *addr, u16 vid,
> + bool is_static, void *data)
> +{
> + struct seq_file *seq = data;
> + int i;
unsigned int i?
> +
> + seq_printf(seq, "vid %d", vid);
> + for (i = 0; i < ETH_ALEN; i++)
> + seq_printf(seq, "%s%02x", i ? ":" : " ", addr[i]);
Too bad we can use %pM here, or can we?
Other than that:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next 06/11] net: dsa: debugfs: add port registers
From: Florian Fainelli @ 2017-08-15 17:34 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
Egil Hjelmeland, John Crispin, Woojung Huh, Sean Wang,
Volodymyr Bendiuga, Nikita Yushchenko, Maxime Hadjinlian,
Chris Healy, Maxim Uvarov, Stefan Eichenberger, Jason Cobham,
Juergen Borleis, Tobias Waldekranz
In-Reply-To: <20170814222242.10643-7-vivien.didelot@savoirfairelinux.com>
On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> Add a debug filesystem "regs" entry to query a port's hardware registers
> through the .get_regs_len and .get_regs_len switch operations.
>
> This is very convenient because it allows one to dump the registers of
> DSA links, which are not exposed to userspace.
>
> Here are the registers of a zii-rev-b CPU and DSA ports:
>
> # pr -mt switch0/port{5,6}/regs
> 0: 4e07 0: 4d04
> 1: 403e 1: 003d
> 2: 0000 2: 0000
> 3: 3521 3: 3521
> 4: 0533 4: 373f
> 5: 8000 5: 0000
> 6: 005f 6: 003f
> 7: 002a 7: 002a
> 8: 2080 8: 2080
> 9: 0001 9: 0001
> 10: 0000 10: 0000
> 11: 0020 11: 0000
> 12: 0000 12: 0000
> 13: 0000 13: 0000
> 14: 0000 14: 0000
> 15: 9100 15: dada
> 16: 0000 16: 0000
> 17: 0000 17: 0000
> 18: 0000 18: 0000
> 19: 0000 19: 00d8
> 20: 0000 20: 0000
> 21: 0000 21: 0000
> 22: 0022 22: 0000
> 23: 0000 23: 0000
> 24: 3210 24: 3210
> 25: 7654 25: 7654
> 26: 0000 26: 0000
> 27: 8000 27: 8000
> 28: 0000 28: 0000
> 29: 0000 29: 0000
> 30: 0000 30: 0000
> 31: 0000 31: 0000
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next 05/11] net: dsa: debugfs: add port stats
From: Florian Fainelli @ 2017-08-15 17:34 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
Egil Hjelmeland, John Crispin, Woojung Huh, Sean Wang,
Volodymyr Bendiuga, Nikita Yushchenko, Maxime Hadjinlian,
Chris Healy, Maxim Uvarov, Stefan Eichenberger, Jason Cobham,
Juergen Borleis, Tobias Waldekranz
In-Reply-To: <20170814222242.10643-6-vivien.didelot@savoirfairelinux.com>
On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> Add a debug filesystem "stats" entry to query a port's hardware
> statistics through the DSA switch .get_sset_count, .get_strings and
> .get_ethtool_stats operations.
>
> This allows one to get statistics about DSA links interconnecting
> switches, which is very convenient because this kind of port is not
> exposed to userspace.
>
> Here are the stats of a zii-rev-b DSA and CPU ports:
>
> # pr -mt switch0/port{5,6}/stats
> in_good_octets : 0 in_good_octets : 13824
> in_bad_octets : 0 in_bad_octets : 0
> in_unicast : 0 in_unicast : 0
> in_broadcasts : 0 in_broadcasts : 216
> in_multicasts : 0 in_multicasts : 0
> in_pause : 0 in_pause : 0
> in_undersize : 0 in_undersize : 0
> in_fragments : 0 in_fragments : 0
> in_oversize : 0 in_oversize : 0
> in_jabber : 0 in_jabber : 0
> in_rx_error : 0 in_rx_error : 0
> in_fcs_error : 0 in_fcs_error : 0
> out_octets : 9216 out_octets : 0
> out_unicast : 0 out_unicast : 0
> out_broadcasts : 144 out_broadcasts : 0
> out_multicasts : 0 out_multicasts : 0
> out_pause : 0 out_pause : 0
> excessive : 0 excessive : 0
> collisions : 0 collisions : 0
> deferred : 0 deferred : 0
> single : 0 single : 0
> multiple : 0 multiple : 0
> out_fcs_error : 0 out_fcs_error : 0
> late : 0 late : 0
> hist_64bytes : 0 hist_64bytes : 0
> hist_65_127bytes : 0 hist_65_127bytes : 0
> hist_128_255bytes : 0 hist_128_255bytes : 0
> hist_256_511bytes : 0 hist_256_511bytes : 0
> hist_512_1023bytes : 0 hist_512_1023bytes : 0
> hist_1024_max_bytes : 0 hist_1024_max_bytes : 0
> sw_in_discards : 0 sw_in_discards : 0
> sw_in_filtered : 0 sw_in_filtered : 0
> sw_out_filtered : 0 sw_out_filtered : 216
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next 04/11] net: dsa: debugfs: add tag_protocol
From: Florian Fainelli @ 2017-08-15 17:31 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
Egil Hjelmeland, John Crispin, Woojung Huh, Sean Wang,
Volodymyr Bendiuga, Nikita Yushchenko, Maxime Hadjinlian,
Chris Healy, Maxim Uvarov, Stefan Eichenberger, Jason Cobham,
Juergen Borleis, Tobias Waldekranz
In-Reply-To: <20170814222242.10643-5-vivien.didelot@savoirfairelinux.com>
On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> Add a debug filesystem "tag_protocol" entry to query the switch tagging
> protocol through the .get_tag_protocol operation.
>
> # cat switch1/tag_protocol
> EDSA
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> net/dsa/debugfs.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 54 insertions(+)
>
> diff --git a/net/dsa/debugfs.c b/net/dsa/debugfs.c
> index 5607efdb924d..30a732e86161 100644
> --- a/net/dsa/debugfs.c
> +++ b/net/dsa/debugfs.c
> @@ -109,6 +109,55 @@ static int dsa_debugfs_create_file(struct dsa_switch *ds, struct dentry *dir,
> return 0;
> }
>
> +static int dsa_debugfs_tag_protocol_read(struct dsa_switch *ds, int id,
> + struct seq_file *seq)
> +{
> + enum dsa_tag_protocol proto;
> +
> + if (!ds->ops->get_tag_protocol)
> + return -EOPNOTSUPP;
> +
> + proto = ds->ops->get_tag_protocol(ds);
> +
> + switch (proto) {
> + case DSA_TAG_PROTO_NONE:
> + seq_puts(seq, "NONE\n");
Might be worth adding a helper function: does dsa_tag_protocol_to_str()
which is in include/net/dsa.h so it's easy to keep in sync when new
taggers are added, then you can just do:
seq_puts(seq, dsa_tag_protocol_to_str(proto));
and/or use a temporary buffer for adding the trailing newline.
--
Florian
^ permalink raw reply
* [PATCH net-next 4/4] mlx4: sizeof style usage
From: Stephen Hemminger @ 2017-08-15 17:29 UTC (permalink / raw)
To: mlindner, stephen, mst, jasowang
Cc: netdev, linux-rdma, virtualization, Stephen Hemminger
In-Reply-To: <20170815172919.26153-1-sthemmin@microsoft.com>
The kernel coding style is to treat sizeof as a function
(ie. with parenthesis) not as an operator.
Also use kcalloc and kmalloc_array
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ethernet/mellanox/mlx4/alloc.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/cmd.c | 4 ++--
drivers/net/ethernet/mellanox/mlx4/en_resources.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/eq.c | 20 +++++++++---------
drivers/net/ethernet/mellanox/mlx4/fw.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/icm.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/icm.h | 4 ++--
drivers/net/ethernet/mellanox/mlx4/intf.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/main.c | 12 +++++------
drivers/net/ethernet/mellanox/mlx4/mcg.c | 12 +++++------
drivers/net/ethernet/mellanox/mlx4/mr.c | 10 ++++-----
drivers/net/ethernet/mellanox/mlx4/qp.c | 12 +++++------
.../net/ethernet/mellanox/mlx4/resource_tracker.c | 24 +++++++++++-----------
15 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c
index b651c1210555..6dabd983e7e0 100644
--- a/drivers/net/ethernet/mellanox/mlx4/alloc.c
+++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c
@@ -186,7 +186,7 @@ int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, u32 num, u32 mask,
bitmap->effective_len = bitmap->avail;
spin_lock_init(&bitmap->lock);
bitmap->table = kzalloc(BITS_TO_LONGS(bitmap->max) *
- sizeof (long), GFP_KERNEL);
+ sizeof(long), GFP_KERNEL);
if (!bitmap->table)
return -ENOMEM;
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 674773b28b2e..97aed30ead21 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -2637,7 +2637,7 @@ int mlx4_cmd_use_events(struct mlx4_dev *dev)
int err = 0;
priv->cmd.context = kmalloc(priv->cmd.max_cmds *
- sizeof (struct mlx4_cmd_context),
+ sizeof(struct mlx4_cmd_context),
GFP_KERNEL);
if (!priv->cmd.context)
return -ENOMEM;
@@ -2695,7 +2695,7 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
{
struct mlx4_cmd_mailbox *mailbox;
- mailbox = kmalloc(sizeof *mailbox, GFP_KERNEL);
+ mailbox = kmalloc(sizeof(*mailbox), GFP_KERNEL);
if (!mailbox)
return ERR_PTR(-ENOMEM);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_resources.c b/drivers/net/ethernet/mellanox/mlx4/en_resources.c
index 86d2d42d658d..5a47f9669621 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_resources.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_resources.c
@@ -44,7 +44,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride,
struct mlx4_en_dev *mdev = priv->mdev;
struct net_device *dev = priv->dev;
- memset(context, 0, sizeof *context);
+ memset(context, 0, sizeof(*context));
context->flags = cpu_to_be32(7 << 16 | rss << MLX4_RSS_QPC_FLAG_OFFSET);
context->pd = cpu_to_be32(mdev->priv_pdn);
context->mtu_msgmax = 0xff;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index bf1638044a7a..dcb8f8f84a97 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -1056,7 +1056,7 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
}
qp->event = mlx4_en_sqp_event;
- memset(context, 0, sizeof *context);
+ memset(context, 0, sizeof(*context));
mlx4_en_fill_qp_context(priv, ring->actual_size, ring->stride, 0, 0,
qpn, ring->cqn, -1, context);
context->db_rec_addr = cpu_to_be64(ring->wqres.db.dma);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 73faa3d77921..bcf422efd3b8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -643,7 +643,7 @@ static void build_inline_wqe(struct mlx4_en_tx_desc *tx_desc,
void *fragptr)
{
struct mlx4_wqe_inline_seg *inl = &tx_desc->inl;
- int spc = MLX4_INLINE_ALIGN - CTRL_SIZE - sizeof *inl;
+ int spc = MLX4_INLINE_ALIGN - CTRL_SIZE - sizeof(*inl);
unsigned int hlen = skb_headlen(skb);
if (skb->len <= spc) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 07406cf2eacd..b98698bf75dd 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -259,7 +259,7 @@ int mlx4_gen_pkey_eqe(struct mlx4_dev *dev, int slave, u8 port)
if (!s_slave->active)
return 0;
- memset(&eqe, 0, sizeof eqe);
+ memset(&eqe, 0, sizeof(eqe));
eqe.type = MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT;
eqe.subtype = MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE;
@@ -276,7 +276,7 @@ int mlx4_gen_guid_change_eqe(struct mlx4_dev *dev, int slave, u8 port)
/*don't send if we don't have the that slave */
if (dev->persist->num_vfs < slave)
return 0;
- memset(&eqe, 0, sizeof eqe);
+ memset(&eqe, 0, sizeof(eqe));
eqe.type = MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT;
eqe.subtype = MLX4_DEV_PMC_SUBTYPE_GUID_INFO;
@@ -295,7 +295,7 @@ int mlx4_gen_port_state_change_eqe(struct mlx4_dev *dev, int slave, u8 port,
/*don't send if we don't have the that slave */
if (dev->persist->num_vfs < slave)
return 0;
- memset(&eqe, 0, sizeof eqe);
+ memset(&eqe, 0, sizeof(eqe));
eqe.type = MLX4_EVENT_TYPE_PORT_CHANGE;
eqe.subtype = port_subtype_change;
@@ -432,7 +432,7 @@ int mlx4_gen_slaves_port_mgt_ev(struct mlx4_dev *dev, u8 port, int attr)
{
struct mlx4_eqe eqe;
- memset(&eqe, 0, sizeof eqe);
+ memset(&eqe, 0, sizeof(eqe));
eqe.type = MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT;
eqe.subtype = MLX4_DEV_PMC_SUBTYPE_PORT_INFO;
@@ -726,7 +726,7 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
}
memcpy(&priv->mfunc.master.comm_arm_bit_vector,
eqe->event.comm_channel_arm.bit_vec,
- sizeof eqe->event.comm_channel_arm.bit_vec);
+ sizeof(eqe)->event.comm_channel_arm.bit_vec);
queue_work(priv->mfunc.master.comm_wq,
&priv->mfunc.master.comm_work);
break;
@@ -984,15 +984,15 @@ static int mlx4_create_eq(struct mlx4_dev *dev, int nent,
*/
npages = PAGE_ALIGN(eq->nent * dev->caps.eqe_size) / PAGE_SIZE;
- eq->page_list = kmalloc(npages * sizeof *eq->page_list,
- GFP_KERNEL);
+ eq->page_list = kmalloc_array(npages, sizeof(*eq->page_list),
+ GFP_KERNEL);
if (!eq->page_list)
goto err_out;
for (i = 0; i < npages; ++i)
eq->page_list[i].buf = NULL;
- dma_list = kmalloc(npages * sizeof *dma_list, GFP_KERNEL);
+ dma_list = kmalloc_array(npages, sizeof(*dma_list), GFP_KERNEL);
if (!dma_list)
goto err_out_free;
@@ -1161,7 +1161,7 @@ int mlx4_alloc_eq_table(struct mlx4_dev *dev)
struct mlx4_priv *priv = mlx4_priv(dev);
priv->eq_table.eq = kcalloc(dev->caps.num_eqs - dev->caps.reserved_eqs,
- sizeof *priv->eq_table.eq, GFP_KERNEL);
+ sizeof(*priv->eq_table.eq), GFP_KERNEL);
if (!priv->eq_table.eq)
return -ENOMEM;
@@ -1180,7 +1180,7 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
int i;
priv->eq_table.uar_map = kcalloc(mlx4_num_eq_uar(dev),
- sizeof *priv->eq_table.uar_map,
+ sizeof(*priv->eq_table.uar_map),
GFP_KERNEL);
if (!priv->eq_table.uar_map) {
err = -ENOMEM;
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 041c0ed65929..042707623922 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -57,7 +57,7 @@ MODULE_PARM_DESC(enable_qos, "Enable Enhanced QoS support (default: off)");
do { \
void *__p = (char *) (source) + (offset); \
u64 val; \
- switch (sizeof (dest)) { \
+ switch (sizeof(dest)) { \
case 1: (dest) = *(u8 *) __p; break; \
case 2: (dest) = be16_to_cpup(__p); break; \
case 4: (dest) = be32_to_cpup(__p); break; \
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c
index 5a7816e7c7b4..a822f7a56bc5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/icm.c
+++ b/drivers/net/ethernet/mellanox/mlx4/icm.c
@@ -400,7 +400,7 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table,
obj_per_chunk = MLX4_TABLE_CHUNK_SIZE / obj_size;
num_icm = (nobj + obj_per_chunk - 1) / obj_per_chunk;
- table->icm = kcalloc(num_icm, sizeof *table->icm, GFP_KERNEL);
+ table->icm = kcalloc(num_icm, sizeof(*table->icm), GFP_KERNEL);
if (!table->icm)
return -ENOMEM;
table->virt = virt;
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.h b/drivers/net/ethernet/mellanox/mlx4/icm.h
index dee67fa39107..c9169a490557 100644
--- a/drivers/net/ethernet/mellanox/mlx4/icm.h
+++ b/drivers/net/ethernet/mellanox/mlx4/icm.h
@@ -39,8 +39,8 @@
#include <linux/mutex.h>
#define MLX4_ICM_CHUNK_LEN \
- ((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \
- (sizeof (struct scatterlist)))
+ ((256 - sizeof(struct list_head) - 2 * sizeof(int)) / \
+ (sizeof(struct scatterlist)))
enum {
MLX4_ICM_PAGE_SHIFT = 12,
diff --git a/drivers/net/ethernet/mellanox/mlx4/intf.c b/drivers/net/ethernet/mellanox/mlx4/intf.c
index e00f627331cb..2edcce98ab2d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/intf.c
+++ b/drivers/net/ethernet/mellanox/mlx4/intf.c
@@ -53,7 +53,7 @@ static void mlx4_add_device(struct mlx4_interface *intf, struct mlx4_priv *priv)
{
struct mlx4_device_context *dev_ctx;
- dev_ctx = kmalloc(sizeof *dev_ctx, GFP_KERNEL);
+ dev_ctx = kmalloc(sizeof(*dev_ctx), GFP_KERNEL);
if (!dev_ctx)
return;
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 09b9bc17bce9..69ea6af46fd7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -925,10 +925,10 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
mlx4_replace_zero_macs(dev);
dev->caps.qp0_qkey = kcalloc(dev->caps.num_ports, sizeof(u32), GFP_KERNEL);
- dev->caps.qp0_tunnel = kcalloc(dev->caps.num_ports, sizeof (u32), GFP_KERNEL);
- dev->caps.qp0_proxy = kcalloc(dev->caps.num_ports, sizeof (u32), GFP_KERNEL);
- dev->caps.qp1_tunnel = kcalloc(dev->caps.num_ports, sizeof (u32), GFP_KERNEL);
- dev->caps.qp1_proxy = kcalloc(dev->caps.num_ports, sizeof (u32), GFP_KERNEL);
+ dev->caps.qp0_tunnel = kcalloc(dev->caps.num_ports, sizeof(u32), GFP_KERNEL);
+ dev->caps.qp0_proxy = kcalloc(dev->caps.num_ports, sizeof(u32), GFP_KERNEL);
+ dev->caps.qp1_tunnel = kcalloc(dev->caps.num_ports, sizeof(u32), GFP_KERNEL);
+ dev->caps.qp1_proxy = kcalloc(dev->caps.num_ports, sizeof(u32), GFP_KERNEL);
if (!dev->caps.qp0_tunnel || !dev->caps.qp0_proxy ||
!dev->caps.qp1_tunnel || !dev->caps.qp1_proxy ||
@@ -2399,7 +2399,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
dev->caps.rx_checksum_flags_port[2] = params.rx_csum_flags_port_2;
}
priv->eq_table.inta_pin = adapter.inta_pin;
- memcpy(dev->board_id, adapter.board_id, sizeof dev->board_id);
+ memcpy(dev->board_id, adapter.board_id, sizeof(dev->board_id));
return 0;
@@ -2869,7 +2869,7 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
dev->caps.num_eqs - dev->caps.reserved_eqs,
MAX_MSIX);
- entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
+ entries = kcalloc(nreq, sizeof(*entries), GFP_KERNEL);
if (!entries)
goto no_msi;
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c
index 0710b3677464..4c5306dbcf11 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mcg.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c
@@ -162,7 +162,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 port,
return -EINVAL;
s_steer = &mlx4_priv(dev)->steer[port - 1];
- new_entry = kzalloc(sizeof *new_entry, GFP_KERNEL);
+ new_entry = kzalloc(sizeof(*new_entry), GFP_KERNEL);
if (!new_entry)
return -ENOMEM;
@@ -175,7 +175,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 port,
*/
pqp = get_promisc_qp(dev, port, steer, qpn);
if (pqp) {
- dqp = kmalloc(sizeof *dqp, GFP_KERNEL);
+ dqp = kmalloc(sizeof(*dqp), GFP_KERNEL);
if (!dqp) {
err = -ENOMEM;
goto out_alloc;
@@ -274,7 +274,7 @@ static int existing_steering_entry(struct mlx4_dev *dev, u8 port,
}
/* add the qp as a duplicate on this index */
- dqp = kmalloc(sizeof *dqp, GFP_KERNEL);
+ dqp = kmalloc(sizeof(*dqp), GFP_KERNEL);
if (!dqp)
return -ENOMEM;
dqp->qpn = qpn;
@@ -443,7 +443,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port,
goto out_mutex;
}
- pqp = kmalloc(sizeof *pqp, GFP_KERNEL);
+ pqp = kmalloc(sizeof(*pqp), GFP_KERNEL);
if (!pqp) {
err = -ENOMEM;
goto out_mutex;
@@ -514,7 +514,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port,
/* add the new qpn to list of promisc qps */
list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]);
/* now need to add all the promisc qps to default entry */
- memset(mgm, 0, sizeof *mgm);
+ memset(mgm, 0, sizeof(*mgm));
members_count = 0;
list_for_each_entry(dqp, &s_steer->promisc_qps[steer], list) {
if (members_count == dev->caps.num_qp_per_mgm) {
@@ -1144,7 +1144,7 @@ int mlx4_qp_attach_common(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
index += dev->caps.num_mgms;
new_entry = 1;
- memset(mgm, 0, sizeof *mgm);
+ memset(mgm, 0, sizeof(*mgm));
memcpy(mgm->gid, gid, 16);
}
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index 24282cd017d3..c7c0764991c9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -106,9 +106,9 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order)
buddy->max_order = max_order;
spin_lock_init(&buddy->lock);
- buddy->bits = kcalloc(buddy->max_order + 1, sizeof (long *),
+ buddy->bits = kcalloc(buddy->max_order + 1, sizeof(long *),
GFP_KERNEL);
- buddy->num_free = kcalloc((buddy->max_order + 1), sizeof *buddy->num_free,
+ buddy->num_free = kcalloc(buddy->max_order + 1, sizeof(*buddy->num_free),
GFP_KERNEL);
if (!buddy->bits || !buddy->num_free)
goto err_out;
@@ -703,13 +703,13 @@ static int mlx4_write_mtt_chunk(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
return -ENOMEM;
dma_sync_single_for_cpu(&dev->persist->pdev->dev, dma_handle,
- npages * sizeof (u64), DMA_TO_DEVICE);
+ npages * sizeof(u64), DMA_TO_DEVICE);
for (i = 0; i < npages; ++i)
mtts[i] = cpu_to_be64(page_list[i] | MLX4_MTT_FLAG_PRESENT);
dma_sync_single_for_device(&dev->persist->pdev->dev, dma_handle,
- npages * sizeof (u64), DMA_TO_DEVICE);
+ npages * sizeof(u64), DMA_TO_DEVICE);
return 0;
}
@@ -1052,7 +1052,7 @@ int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages,
return -EINVAL;
/* All MTTs must fit in the same page */
- if (max_pages * sizeof *fmr->mtts > PAGE_SIZE)
+ if (max_pages * sizeof(*fmr->mtts) > PAGE_SIZE)
return -EINVAL;
fmr->page_shift = page_shift;
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 26747212526b..2b067763a6bc 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -174,7 +174,7 @@ static int __mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
cpu_to_be16(mlx4_qp_roce_entropy(dev, qp->qpn));
*(__be32 *) mailbox->buf = cpu_to_be32(optpar);
- memcpy(mailbox->buf + 8, context, sizeof *context);
+ memcpy(mailbox->buf + 8, context, sizeof(*context));
((struct mlx4_qp_context *) (mailbox->buf + 8))->local_qpn =
cpu_to_be32(qp->qpn);
@@ -844,10 +844,10 @@ int mlx4_init_qp_table(struct mlx4_dev *dev)
/* In mfunc, calculate proxy and tunnel qp offsets for the PF here,
* since the PF does not call mlx4_slave_caps */
- dev->caps.qp0_tunnel = kcalloc(dev->caps.num_ports, sizeof (u32), GFP_KERNEL);
- dev->caps.qp0_proxy = kcalloc(dev->caps.num_ports, sizeof (u32), GFP_KERNEL);
- dev->caps.qp1_tunnel = kcalloc(dev->caps.num_ports, sizeof (u32), GFP_KERNEL);
- dev->caps.qp1_proxy = kcalloc(dev->caps.num_ports, sizeof (u32), GFP_KERNEL);
+ dev->caps.qp0_tunnel = kcalloc(dev->caps.num_ports, sizeof(u32), GFP_KERNEL);
+ dev->caps.qp0_proxy = kcalloc(dev->caps.num_ports, sizeof(u32), GFP_KERNEL);
+ dev->caps.qp1_tunnel = kcalloc(dev->caps.num_ports, sizeof(u32), GFP_KERNEL);
+ dev->caps.qp1_proxy = kcalloc(dev->caps.num_ports, sizeof(u32), GFP_KERNEL);
if (!dev->caps.qp0_tunnel || !dev->caps.qp0_proxy ||
!dev->caps.qp1_tunnel || !dev->caps.qp1_proxy) {
@@ -907,7 +907,7 @@ int mlx4_qp_query(struct mlx4_dev *dev, struct mlx4_qp *qp,
MLX4_CMD_QUERY_QP, MLX4_CMD_TIME_CLASS_A,
MLX4_CMD_WRAPPED);
if (!err)
- memcpy(context, mailbox->buf + 8, sizeof *context);
+ memcpy(context, mailbox->buf + 8, sizeof(*context));
mlx4_free_cmd_mailbox(dev, mailbox);
return err;
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 215e21c3dc8a..fabb53379727 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -1040,7 +1040,7 @@ static struct res_common *alloc_qp_tr(int id)
{
struct res_qp *ret;
- ret = kzalloc(sizeof *ret, GFP_KERNEL);
+ ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -1058,7 +1058,7 @@ static struct res_common *alloc_mtt_tr(int id, int order)
{
struct res_mtt *ret;
- ret = kzalloc(sizeof *ret, GFP_KERNEL);
+ ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -1074,7 +1074,7 @@ static struct res_common *alloc_mpt_tr(int id, int key)
{
struct res_mpt *ret;
- ret = kzalloc(sizeof *ret, GFP_KERNEL);
+ ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -1089,7 +1089,7 @@ static struct res_common *alloc_eq_tr(int id)
{
struct res_eq *ret;
- ret = kzalloc(sizeof *ret, GFP_KERNEL);
+ ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -1103,7 +1103,7 @@ static struct res_common *alloc_cq_tr(int id)
{
struct res_cq *ret;
- ret = kzalloc(sizeof *ret, GFP_KERNEL);
+ ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -1118,7 +1118,7 @@ static struct res_common *alloc_srq_tr(int id)
{
struct res_srq *ret;
- ret = kzalloc(sizeof *ret, GFP_KERNEL);
+ ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -1133,7 +1133,7 @@ static struct res_common *alloc_counter_tr(int id, int port)
{
struct res_counter *ret;
- ret = kzalloc(sizeof *ret, GFP_KERNEL);
+ ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -1148,7 +1148,7 @@ static struct res_common *alloc_xrcdn_tr(int id)
{
struct res_xrcdn *ret;
- ret = kzalloc(sizeof *ret, GFP_KERNEL);
+ ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -1162,7 +1162,7 @@ static struct res_common *alloc_fs_rule_tr(u64 id, int qpn)
{
struct res_fs_rule *ret;
- ret = kzalloc(sizeof *ret, GFP_KERNEL);
+ ret = kzalloc(sizeof(*ret), GFP_KERNEL);
if (!ret)
return NULL;
@@ -1274,7 +1274,7 @@ static int add_res_range(struct mlx4_dev *dev, int slave, u64 base, int count,
struct mlx4_resource_tracker *tracker = &priv->mfunc.master.res_tracker;
struct rb_root *root = &tracker->res_tree[type];
- res_arr = kzalloc(count * sizeof *res_arr, GFP_KERNEL);
+ res_arr = kcalloc(count, sizeof(*res_arr), GFP_KERNEL);
if (!res_arr)
return -ENOMEM;
@@ -2027,7 +2027,7 @@ static int mac_add_to_slave(struct mlx4_dev *dev, int slave, u64 mac, int port,
if (mlx4_grant_resource(dev, slave, RES_MAC, 1, port))
return -EINVAL;
- res = kzalloc(sizeof *res, GFP_KERNEL);
+ res = kzalloc(sizeof(*res), GFP_KERNEL);
if (!res) {
mlx4_release_resource(dev, slave, RES_MAC, 1, port);
return -ENOMEM;
@@ -4020,7 +4020,7 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp,
struct res_gid *res;
int err;
- res = kzalloc(sizeof *res, GFP_KERNEL);
+ res = kzalloc(sizeof(*res), GFP_KERNEL);
if (!res)
return -ENOMEM;
--
2.11.0
^ permalink raw reply related
* [PATCH net-next 3/4] skge: add paren around sizeof arg
From: Stephen Hemminger @ 2017-08-15 17:29 UTC (permalink / raw)
To: mlindner, stephen, mst, jasowang
Cc: netdev, linux-rdma, virtualization, Stephen Hemminger
In-Reply-To: <20170815172919.26153-1-sthemmin@microsoft.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ethernet/marvell/skge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
index 5d7d94de4e00..8a835e82256a 100644
--- a/drivers/net/ethernet/marvell/skge.c
+++ b/drivers/net/ethernet/marvell/skge.c
@@ -3516,7 +3516,7 @@ static const char *skge_board_name(const struct skge_hw *hw)
if (skge_chips[i].id == hw->chip_id)
return skge_chips[i].name;
- snprintf(buf, sizeof buf, "chipid 0x%x", hw->chip_id);
+ snprintf(buf, sizeof(buf), "chipid 0x%x", hw->chip_id);
return buf;
}
--
2.11.0
^ permalink raw reply related
* [PATCH net-next 2/4] virtio: put paren around sizeof
From: Stephen Hemminger @ 2017-08-15 17:29 UTC (permalink / raw)
To: mlindner, stephen, mst, jasowang
Cc: netdev, linux-rdma, virtualization, Stephen Hemminger
In-Reply-To: <20170815172919.26153-1-sthemmin@microsoft.com>
Kernel coding style is to put paren around operand of sizeof.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/virtio_net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index a3f3c66b4530..4302f313d9a7 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -319,7 +319,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
hdr_len = vi->hdr_len;
if (vi->mergeable_rx_bufs)
- hdr_padded_len = sizeof *hdr;
+ hdr_padded_len = sizeof(*hdr);
else
hdr_padded_len = sizeof(struct padded_vnet_hdr);
--
2.11.0
^ permalink raw reply related
* [PATCH net-next 1/4] tun/tap: use paren's with sizeof
From: Stephen Hemminger @ 2017-08-15 17:29 UTC (permalink / raw)
To: mlindner, stephen, mst, jasowang
Cc: linux-rdma, netdev, Stephen Hemminger, virtualization
In-Reply-To: <20170815172919.26153-1-sthemmin@microsoft.com>
Although sizeof is an operator in C. The kernel coding style convention
is to always use it like a function and add parenthesis.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/tap.c | 2 +-
drivers/net/tun.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index 0d039411e64c..21b71ae947fd 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -1215,7 +1215,7 @@ int tap_queue_resize(struct tap_dev *tap)
int n = tap->numqueues;
int ret, i = 0;
- arrays = kmalloc(sizeof *arrays * n, GFP_KERNEL);
+ arrays = kmalloc_array(n, sizeof(*arrays), GFP_KERNEL);
if (!arrays)
return -ENOMEM;
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 5892284eb8d0..f5017121cd57 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2737,7 +2737,7 @@ static int tun_queue_resize(struct tun_struct *tun)
int n = tun->numqueues + tun->numdisabled;
int ret, i;
- arrays = kmalloc(sizeof *arrays * n, GFP_KERNEL);
+ arrays = kmalloc_array(n, sizeof(*arrays), GFP_KERNEL);
if (!arrays)
return -ENOMEM;
--
2.11.0
^ permalink raw reply related
* [PATCH net-next 0/4] various sizeof cleanups
From: Stephen Hemminger @ 2017-08-15 17:29 UTC (permalink / raw)
To: mlindner, stephen, mst, jasowang
Cc: linux-rdma, netdev, Stephen Hemminger, virtualization
Noticed some places that were using sizeof as an operator.
This is legal C but is not the convention used in the kernel.
Stephen Hemminger (4):
tun/tap: use paren's with sizeof
virtio: put paren around sizeof
skge: add paren around sizeof arg
mlx4: sizeof style usage
drivers/net/ethernet/marvell/skge.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/alloc.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/cmd.c | 4 ++--
drivers/net/ethernet/mellanox/mlx4/en_resources.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/eq.c | 20 +++++++++---------
drivers/net/ethernet/mellanox/mlx4/fw.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/icm.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/icm.h | 4 ++--
drivers/net/ethernet/mellanox/mlx4/intf.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/main.c | 12 +++++------
drivers/net/ethernet/mellanox/mlx4/mcg.c | 12 +++++------
drivers/net/ethernet/mellanox/mlx4/mr.c | 10 ++++-----
drivers/net/ethernet/mellanox/mlx4/qp.c | 12 +++++------
.../net/ethernet/mellanox/mlx4/resource_tracker.c | 24 +++++++++++-----------
drivers/net/tap.c | 2 +-
drivers/net/tun.c | 2 +-
drivers/net/virtio_net.c | 2 +-
19 files changed, 60 insertions(+), 60 deletions(-)
--
2.11.0
^ permalink raw reply
* Re: [PATCH net-next 02/11] net: dsa: add debugfs interface
From: Florian Fainelli @ 2017-08-15 17:29 UTC (permalink / raw)
To: Vivien Didelot, netdev
Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
Egil Hjelmeland, John Crispin, Woojung Huh, Sean Wang,
Volodymyr Bendiuga, Nikita Yushchenko, Maxime Hadjinlian,
Chris Healy, Maxim Uvarov, Stefan Eichenberger, Jason Cobham,
Juergen Borleis, Tobias Waldekranz
In-Reply-To: <20170814222242.10643-3-vivien.didelot@savoirfairelinux.com>
On 08/14/2017 03:22 PM, Vivien Didelot wrote:
> This commit adds a DEBUG_FS dependent DSA core file creating a generic
> debug filesystem interface for the DSA switch devices.
>
> The interface can be mounted with:
>
> # mount -t debugfs none /sys/kernel/debug
>
> The dsa directory contains one directory per switch chip:
>
> # cd /sys/kernel/debug/dsa/
> # ls
> switch0 switch1 switch2
>
> Each chip directory contains one directory per port:
>
> # ls -l switch0/
> drwxr-xr-x 2 root root 0 Jan 1 00:00 port0
> drwxr-xr-x 2 root root 0 Jan 1 00:00 port1
> drwxr-xr-x 2 root root 0 Jan 1 00:00 port2
> drwxr-xr-x 2 root root 0 Jan 1 00:00 port5
> drwxr-xr-x 2 root root 0 Jan 1 00:00 port6
>
> Future patches will add entry files to these directories.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> +static int dsa_debugfs_create_switch(struct dsa_switch *ds)
> +{
> + char name[32];
> + int i;
> +
> + /* skip if there is no debugfs support */
> + if (!dsa_debugfs_dir)
> + return 0;
> +
> + snprintf(name, sizeof(name), DSA_SWITCH_FMT, ds->index);
> +
> + ds->debugfs_dir = debugfs_create_dir(name, dsa_debugfs_dir);
> + if (IS_ERR_OR_NULL(ds->debugfs_dir))
> + return -EFAULT;
> +
> + for (i = 0; i < ds->num_ports; i++) {
> + if (!ds->ports[i].dn)
> + continue;
This won't create port directories when using platform data, can you
check for BIT(i) & ds->enabled_port_mask instead?
--
Florian
^ permalink raw reply
* Re: [PATCH 1/2] mlx4: remove unnecessary pci_set_drvdata()
From: Jason Gunthorpe @ 2017-08-15 17:21 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Zhu Yanjun, saeedm, matanb, netdev, linux-rdma, yuval.shaia
In-Reply-To: <20170815071336.GL24282@mtr-leonro.local>
On Tue, Aug 15, 2017 at 10:13:36AM +0300, Leon Romanovsky wrote:
> On Tue, Aug 15, 2017 at 02:33:05AM -0400, Zhu Yanjun wrote:
> > The driver core clears the driver data to NULL after device_release
> > or on probe failure. Thus, it is not necessary to manually clear the
> > device driver data to NULL.
> >
>
> It makes sense and I'm pretty sure that you are right, but I'm failing
> to find the function in device core which sets it to NULL. Can you help
> me and present the actual call stack to that code place?
http://elixir.free-electrons.com/linux/v4.13-rc1/source/drivers/base/dd.c#L840
The call to the remove callback is on line 833.
This is done after dropping devres, so you could allocate the drv data
inside a devm object and everything would unwind correctly.
In this case, the kfree is explicit, so I would advocate for still putting
the null near the kfree to minimize the time where a free'd pointer is
present - eg incase a devm callback or some other bug accidently
touches it.
Jason
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox