Commit graph

969116 commits

Author SHA1 Message Date
Mauro Carvalho Chehab
5a5b9fb1a1 media: vidtv: simplify NIT write function
- pass struct vidtv_psi_nit_write_args as a pointer;
- avoid initializing struct fields multiple times.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:24 +01:00
Mauro Carvalho Chehab
6286a4b79b media: vidtv: simplify SDT write function
- pass struct vidtv_psi_sdt_write_args as a pointer;
- avoid initializing struct fields multiple times.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:24 +01:00
Mauro Carvalho Chehab
db9569f67e media: vidtv: cleanup PMT write table function
- Pass struct vidtv_psi_pmt_write_args as a pointer;
- Avoid initializing structs multiple times.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:24 +01:00
Mauro Carvalho Chehab
7f95751519 media: vidtv: cleanup PAT write function
Avoid initializing the structs multiple times and pass the
PAT struct as a pointer, instead of a var.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:24 +01:00
Mauro Carvalho Chehab
c570fb9ffc media: vidtv: cleanup PSI table header function
- Pass struct header_write_args as a pointer, instead of
  passing as a var;

- Initialize the psi_args struct only once.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:24 +01:00
Mauro Carvalho Chehab
974ea17692 media: vidtv: cleanup PSI descriptor write function
This function initializes the psi_args twice, and receives
a struct, instead of a pointer to a struct.

Clean it up.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:24 +01:00
Mauro Carvalho Chehab
9e0067417b media: vidtv: simplify the crc writing logic
Cleanup the table_section_crc32_write_into() function
by initializing struct psi_write_args only once and by
passing the args as a pointer.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:24 +01:00
Mauro Carvalho Chehab
5edbd330e3 media: vidtv: simplify PSI write function
The function vidtv_psi_ts_psi_write_into() initializes the
ts_header fields several times, and receives a struct
as argument, instead of using a pointer to struct.

Cleanup the function, in order to reduce its stack usage
and to avoid initializing the ts_header multiple times.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:24 +01:00
Mauro Carvalho Chehab
160028542b media: vidtv: add date to the current event
The current event is using an undefined date. Instead, it
should be the timestamp when the EIT table was generated.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:24 +01:00
Mauro Carvalho Chehab
bfa4aaebe8 media: vidtv: fix service_id at SDT table
The service_id there should be equal to the one used
on other tables, otherwise, EIT entries won't be valid.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Mauro Carvalho Chehab
11f4933f7b media: vidtv: fix service type
As the service currently broadcasts just audio, change the
service type to reflect that.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Mauro Carvalho Chehab
039b7caed1 media: vidtv: add a PID entry for the NIT table
On normal TS streams, the NIT table has its own entry at PAT,
but not at PMT.

While here, properly handle alloc problems when creating
PMT entries.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Mauro Carvalho Chehab
91a8a240e2 media: vidtv: properly fill EIT service_id
The EIT header ID field should not contain the network ID, but,
instead, the service_id of the program described at EIT.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Mauro Carvalho Chehab
1d2b2a6d8c media: vidtv: fix the network ID range
As defined at ETSI TS 101 162, original network IDs up to 0xfebf
are reserved for registration at dvb.org.

Let's use, instead, an original network ID at the range
0xff00-0xffff, as this is for private temporary usage.

As the same value is also used for the network ID,
the range 0xff01-0xffff also fits better, as values
lower than that depend if the network is used for
satellite, terrestrial, cable of CI.

While here, move the TS ID to the bridge code, where it
is used, and change its value, as it was identical to
the value previously used by network ID. While we could
keep the same value, let's change it, just to make easier
to check for the new code while reading it with DVB tools
like dvbinspector.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Mauro Carvalho Chehab
b9e09e06e3 media: vidtv: improve EIT data
Place some text at EIT data, and use ISO 8859-15 encoding for
the German letter "ü" (u mit umlat) letter.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Mauro Carvalho Chehab
ec3eda53f4 media: vidtv: cleanup null packet initialization logic
Initialize the destination buffer/size and the initial
offset when creating the local var.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Mauro Carvalho Chehab
c857b065ab media: vidtv: pre-initialize mux arrays
Instead of first zeroing all fields at the mux structs and
then filling, do some initialization for the const data
when they're created.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Mauro Carvalho Chehab
330d135679 media: vidtv: remove some unused functions
Right now, there's no need to access the length of some
tables. So, drop the unused functions.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Mauro Carvalho Chehab
a8bd461ca3 media: vidtv: do some cleanups at the driver
Do some cleanups at the coding style of the driver:
- remove "inline" declarations;
- use reverse xmas-tree for local var declarations;
- Adjust some indent to avoid breaking 80-cols;
- Cleanup some comments.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 08:05:23 +01:00
Matti Hamalainen
2be6564164 drm/nouveau: fix relocations applying logic and a double-free
Commit 03e0d26fcf ("drm/nouveau: slowpath for pushbuf ioctl") included
a logic-bug which results in the relocations not actually getting
applied at all as the call to nouveau_gem_pushbuf_reloc_apply() is
never reached. This causes a regression with graphical corruption,
triggered when relocations need to be done (for example after a
suspend/resume cycle.)

Fix by setting *apply_relocs value only if there were more than 0
relocations.

Additionally, the never reached code had a leftover u_free() call,
which, after fixing the logic, now got called and resulted in a
double-free. Fix by removing one u_free(), moving the other
and adding check for errors.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Fixes: 03e0d26fcf ("drm/nouveau: slowpath for pushbuf ioctl")
References: https://gitlab.freedesktop.org/drm/nouveau/-/issues/11
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201120152338.1203257-1-ccr@tnsp.org
2020-11-26 08:04:19 +01:00
Mauro Carvalho Chehab
163d72a2d3 media: vidtv: avoid copying data for PES structs
Minimize the number of data copies and initialization at
the code, passing them as pointers instead of duplicating
the data.

The only case where we're keeping the data copy is at
vidtv_pes_write_h(), as it needs a copy of the passed
arguments. On such case, we're being more explicit.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:47:34 +01:00
Mauro Carvalho Chehab
0a33ab1682 media: vidtv: avoid data copy when initializing the multiplexer
Initialize the fields of the arguments directly when
declaring it, and pass the args as a pointer, instead of
copying them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:45:20 +01:00
Mauro Carvalho Chehab
0d271a79c7 media: vidtv: fix some notes at the tone generator
The sheet music used to generate the tones had a few
polyphonic notes. Due to that, its conversion to a
tones sequence had a few errors.

Also, due to a bug at the tone generator, it was missing
the pause at the initial compass.

Fix them.

While here, reduce the compass to 100bpm.

The music was converted from a Music XML file using
this small script:

<snip>
my $count = 0;
my $silent = 0;
my $note;
my $octave;
print "\t";
while (<>) {
	$note = $1 if (m,\<step\>(.*)\</step\>,);
	$octave = "_$1" if (m,\<octave\>(.*)\</octave\>,);
	if (m,\<alter\>1\</alter\>,) {
		$note .= "S";
		$sharp = 1;
	}
	if (m,\<rest/\>,) {
		$note = "SILENT";
		$silent = 1;
	}
	if (m,\<duration\>(.*)\</duration\>,) {
		printf "{ NOTE_${note}${octave}, %d},", $1 * 128 / 480;
		$count++;
		if ($silent || $count >= 3) {
			print "\n\t";
			$count = 0;
			$silent = 0;
		} else {
			print " ";
			print " " if (!$sharp);
		}
		$sharp = 0;
		$note = "";
		$octave = "";
	};
};
print "\n";
</snip>

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:44:58 +01:00
Mauro Carvalho Chehab
ab6bad0a4d media: vidtv: fix the tone generator logic
The tone generator logic were repeating the song after the
first silent. There's also a wrong logic at the note
offset calculus, which may create some noise.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:44:38 +01:00
Mauro Carvalho Chehab
af66e03edd media: vidtv: fix the name of the program
While the original plan was to use the first movement of
the 5th Symphony, it was opted to use the Für Elise song,
instead.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:44:19 +01:00
Mauro Carvalho Chehab
31e82355a1 media: vidtv: don't use recursive functions
The Linux stack is too short. So, using recursive functions
is a very bad idea. Convert those into non-recursive ones.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:43:58 +01:00
Mauro Carvalho Chehab
3be8037960 media: vidtv: add error checks
Currently, there are not checks if something gets bad during
memory allocation: it will simply use NULL pointers and
crash.

Add error path at the logic which allocates memory for the
MPEG-TS generator code, propagating the errors up to the
vidtv_bridge. Now, if something wents bad, start_streaming
will return an error that userspace can detect:

	ERROR    DMX_SET_PES_FILTER failed (PID = 0x2000): 12 Cannot allocate memory

and the driver doesn't crash.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:43:40 +01:00
Mauro Carvalho Chehab
8922e3931d media: vidtv: reorganize includes
- Place the includes on alphabetical order;
- get rid of asm/byteorder.h;
- add bug.h at vidtv_s302m.c, as it is needed by
  inux/fixp-arith.h

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:41:03 +01:00
Daniel W. S. Almeida
c2b6ca661a media: vidtv: psi: fix missing assignments in while loops
Some variables were only assigned once but were used in while
loops as if they had been updated at every iteration. Fix this.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:40:36 +01:00
Daniel W. S. Almeida
99b99d135e media: vidtv: Move s302m specific fields into encoder context
A few fields used only by the tone generator in the s302m encoder
are stored in struct vidtv_encoder. Move them into
struct vidtv_s302m_ctx instead. While we are at it: fix a
checkpatch warning for long lines.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:40:16 +01:00
Daniel W. S. Almeida
84306c96b1 media: vidtv: psi: extract descriptor chaining code into a helper
The code to append a descriptor to the end of a chain is repeated
throughout the psi generator code. Extract it into its own helper
function to avoid cluttering.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:39:54 +01:00
Daniel W. S. Almeida
7a7899f6f5 media: vidtv: psi: Implement an Event Information Table (EIT)
Implement an Event Information Table (EIT) as per EN 300 468
5.2.4.

The EIT provides information in chronological order regarding
the events contained within each service.

For now only present event information is supported.

[mchehab+huawei@kernel.org: removed an extra blank line]
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:39:31 +01:00
Daniel W. S. Almeida
c2f78f0cb2 media: vidtv: psi: add a Network Information Table (NIT)
Add a Network Information Table (NIT) as specified in ETSI EN 300 468.

This table conveys information relating to the physical organization of
the multiplexes carried via a given network and the characteristics of
the network itself.

It is conveyed in the output of vidtv as packets with TS PID of 0x0010

[mchehab+huawei@kernel.org: removed an extra blank line]
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:37:59 +01:00
Daniel W. S. Almeida
dd6dbe8d7e media: vidtv: extract the initial CRC value to into a #define
The same constant (0xffffffff) is used in three different functions.

Extract it into a #define to avoid repetition.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-11-26 07:35:49 +01:00
Jakub Kicinski
594e31bceb Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says:

====================
40GbE Intel Wired LAN Driver Updates 2020-11-24

This series contains updates to i40e and igbvf drivers.

Marek removes a redundant assignment for i40e.

Stefan Assmann corrects reporting of VF link speed for i40e.

Karen revises a couple of error messages to warnings for igbvf as they
could be misinterpreted as issues when they are not.

v2: Dropped PTP patch as it's being updated.

* '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
  igbvf: Refactor traces
  i40e: report correct VF link speed when link state is set to enable
  i40e: remove redundant assignment
====================

Link: https://lore.kernel.org/r/20201124165245.2844118-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 18:11:25 -08:00
Jakub Kicinski
64088b2ac1 Merge branch 'net-dsa-mv88e6xxx-serdes-link-without-phy'
Chris Packham says:

====================
net: dsa: mv88e6xxx: serdes link without phy

This small series gets my hardware into a working state. The key points are to
make sure we don't force the link and that we ask the MAC for the link status.
I also have updated my dts to say `phy-mode = "1000base-x";` and `managed =
"in-band-status";`

I've dropped the patch for the 88E6123 as it's a distraction and I lack
hardware to do any proper testing with it. Earlier versions are on the mailing
list if anyone wants to pick it up in the future.

I notice there's a series for mv88e6393x circulating on the netdev mailing
list. As patch #1 is adding a new device specific op either this series will
need updating to cover the mv88e6393x or the mv88e6393x series will need
updating for the new op depenting on which lands first.
====================

Link: https://lore.kernel.org/r/20201124043440.28400-1-chris.packham@alliedtelesis.co.nz
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:58:09 -08:00
Chris Packham
0fd5d79efa net: dsa: mv88e6xxx: Handle error in serdes_get_regs
If the underlying read operation failed we would end up writing stale
data to the supplied buffer. This would end up with the last
successfully read value repeating. Fix this by only writing the data
when we know the read was good. This will mean that failed values will
return 0xffff.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:58:06 -08:00
Chris Packham
5c19bc8b57 net: dsa: mv88e6xxx: Add serdes interrupt support for MV88E6097
The MV88E6097 presents the serdes interrupts for ports 8 and 9 via the
Switch Global 2 registers. There is no additional layer of
enablinh/disabling the serdes interrupts like other mv88e6xxx switches.
Even though most of the serdes behaviour is the same as the MV88E6185
that chip does not provide interrupts for serdes events so unlike
earlier commits the functions added here are specific to the MV88E6097.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:58:06 -08:00
Chris Packham
f5be107c33 net: dsa: mv88e6xxx: Support serdes ports on MV88E6097/6095/6185
Implement serdes_power, serdes_get_lane and serdes_pcs_get_state ops for
the MV88E6097/6095/6185 so that ports 8 & 9 can be supported as serdes
ports and directly connected to other network interfaces or to SFPs
without a PHY.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:58:06 -08:00
Chris Packham
4efe766290 net: dsa: mv88e6xxx: Don't force link when using in-band-status
When a port is configured with 'managed = "in-band-status"' switch chips
like the 88E6390 need to propagate the SERDES link state to the MAC
because the link state is not correctly detected. This causes problems
on the 88E6185/88E6097 where the link partner won't see link state
changes because we're forcing the link.

To address this introduce a new device specific op port_sync_link() and
push the logic from mv88e6xxx_mac_link_up() into that. Provide an
implementation for the 88E6185 like devices which doesn't force the
link.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:58:06 -08:00
Jakub Kicinski
0f614511fa Merge branch 'dt-bindings-net-dsa-microchip-convert-ksz-bindings-to-yaml'
Christian Eggers says:

====================
dt-bindings: net: dsa: microchip: convert KSZ bindings to yaml

These patches are orginally from the series

"net: dsa: microchip: PTP support for KSZ956x"

As the the device tree conversion to yaml is not really related to the
PTP patches and the original series is going to take more time than
I expected, I would like to split this.

Changes (original series -> v1)
--------------------------------
- dts: moved "allOf" below "maintainers"
- dts: use "unevaluatedProperties" instead of "additionalProperties"
- dts: removed "spi-cpha" and "spi-cpol" flags as the hardware is fixed
- ksz8795: setup SPI for mode 3
- ksz9477: dito
====================

Link: https://lore.kernel.org/r/20201120112107.16334-1-ceggers@arri.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:55:27 -08:00
Christian Eggers
8c4599f498 net: dsa: microchip: ksz8795: setup SPI mode
This should be done in the device driver instead of the device tree.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:53:45 -08:00
Christian Eggers
9ed602bac9 net: dsa: microchip: ksz9477: setup SPI mode
This should be done in the device driver instead of the device tree.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:53:45 -08:00
Christian Eggers
44e53c8882 net: dsa: microchip: support for "ethernet-ports" node
The dsa.yaml device tree binding allows "ethernet-ports" (preferred) and
"ports".

Signed-off-by: Christian Eggers <ceggers@arri.de>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:53:45 -08:00
Christian Eggers
4f36d97786 dt-bindings: net: dsa: convert ksz bindings document to yaml
Convert the bindings document for Microchip KSZ Series Ethernet switches
from txt to yaml. Removed spi-cpha and spi-cpol flags is this should be
handled by the device driver.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:53:45 -08:00
Rohit Maheshwari
cbf3d60329 ch_ktls: lock is not freed
Currently lock gets freed only if timeout expires, but missed a
case when HW returns failure and goes for cleanup.

Fixes: efca3878a5 ("ch_ktls: Issue if connection offload fails")
Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
Link: https://lore.kernel.org/r/20201125072626.10861-1-rohitm@chelsio.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:44:42 -08:00
Maxim Mikityanskiy
025cc2fb6a net/tls: Protect from calling tls_dev_del for TLS RX twice
tls_device_offload_cleanup_rx doesn't clear tls_ctx->netdev after
calling tls_dev_del if TLX TX offload is also enabled. Clearing
tls_ctx->netdev gets postponed until tls_device_gc_task. It leaves a
time frame when tls_device_down may get called and call tls_dev_del for
RX one extra time, confusing the driver, which may lead to a crash.

This patch corrects this racy behavior by adding a flag to prevent
tls_device_down from calling tls_dev_del the second time.

Fixes: e8f6979981 ("net/tls: Add generic NIC offload infrastructure")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Link: https://lore.kernel.org/r/20201125221810.69870-1-saeedm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:31:06 -08:00
Jakub Kicinski
a060133c20 Merge branch 'devlink-port-attribute-fixes'
Parav Pandit says:

====================
devlink port attribute fixes

This patchset contains 2 small fixes for devlink port attributes.

Patch summary:
Patch-1 synchronize the devlink port attribute reader
        with net namespace change operation
Patch-2 Ensure to return devlink port's netdevice attributes
        when netdev and devlink instance belong to same net namespace
====================

Link: https://lore.kernel.org/r/20201125091620.6781-1-parav@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:26:38 -08:00
Parav Pandit
a7b4364950 devlink: Make sure devlink instance and port are in same net namespace
When devlink reload operation is not used, netdev of an Ethernet port may
be present in different net namespace than the net namespace of the
devlink instance.

Ensure that both the devlink instance and devlink port netdev are located
in same net namespace.

Fixes: 070c63f20f ("net: devlink: allow to change namespaces during reload")
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:26:34 -08:00
Parav Pandit
b187c9b417 devlink: Hold rtnl lock while reading netdev attributes
A netdevice of a devlink port can be moved to different net namespace
than its parent devlink instance.
This scenario occurs when devlink reload is not used.

When netdevice is undergoing migration to net namespace, its ifindex
and name may change.

In such use case, devlink port query may read stale netdev attributes.

Fix it by reading them under rtnl lock.

Fixes: bfcd3a4661 ("Introduce devlink infrastructure")
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-25 17:26:34 -08:00