diff mbox series

[net-next,1/6] net: dsa: sja1105: populate supported_interfaces

Message ID E1nNZCc-00Ab1Q-Kg@rmk-PC.armlinux.org.uk (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: sja1105: phylink updates | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: linux@armlinux.org.uk
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff fail author Signed-off-by missing
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Russell King (Oracle) Feb. 25, 2022, 11:56 a.m. UTC
Populate the supported interfaces bitmap for the SJA1105 DSA switch.

This switch only supports a static model of configuration, so we
restrict the interface modes to the configured setting.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/sja1105/sja1105_main.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Russell King (Oracle) Feb. 25, 2022, 11:56 a.m. UTC | #1
On Fri, Feb 25, 2022 at 11:56:02AM +0000, Russell King (Oracle) wrote:
> Populate the supported interfaces bitmap for the SJA1105 DSA switch.
> 
> This switch only supports a static model of configuration, so we
> restrict the interface modes to the configured setting.
> 
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Bl"%$y vi!
Vladimir Oltean Feb. 25, 2022, 11:58 a.m. UTC | #2
On Fri, Feb 25, 2022 at 11:56:02AM +0000, Russell King (Oracle) wrote:
> Populate the supported interfaces bitmap for the SJA1105 DSA switch.
> 
> This switch only supports a static model of configuration, so we
> restrict the interface modes to the configured setting.
> 
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

These all appear on the same line, can you please fix and resend?
Russell King (Oracle) Feb. 25, 2022, 12:08 p.m. UTC | #3
On Fri, Feb 25, 2022 at 01:58:58PM +0200, Vladimir Oltean wrote:
> On Fri, Feb 25, 2022 at 11:56:02AM +0000, Russell King (Oracle) wrote:
> > Populate the supported interfaces bitmap for the SJA1105 DSA switch.
> > 
> > This switch only supports a static model of configuration, so we
> > restrict the interface modes to the configured setting.
> > 
> > Reviewed-by: Vladimir Oltean <olteanv@gmail.com>                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> 
> These all appear on the same line, can you please fix and resend?

I hate vi/vim precisely because of this.

How this problem happens. I read the email in mutt under KDE's kconsole
with your attributation. I select the attributation so it can be pasted.
I edit the commit, which starts vi, move to the line containing my
sign-off, hit 'i' and paste it in.

The result is a line that _looks_ in vi as being entirely correct. The
next line follows on as if it is a separate line.

I save the commit message. When I look at it in "git log", again,
everything looks good.

The only times that it can be identified is after sending and looking
at it in mutt, and noticing that the Signed-off-by line appears to have
a# '+' prefix, indicating that mutt wrapped the line - or after it gets
merged into net-next when linux-next identifies the lack of s-o-b, by
which time it's too late to fix.

How do others avoid this problem? Not use vi/vim, but use some other
editor such as emacs or microemacs that doesn't have this crazy way of
dealing with multiple lines?
Vladimir Oltean Feb. 25, 2022, 12:15 p.m. UTC | #4
On Fri, Feb 25, 2022 at 12:08:02PM +0000, Russell King (Oracle) wrote:
> On Fri, Feb 25, 2022 at 01:58:58PM +0200, Vladimir Oltean wrote:
> > On Fri, Feb 25, 2022 at 11:56:02AM +0000, Russell King (Oracle) wrote:
> > > Populate the supported interfaces bitmap for the SJA1105 DSA switch.
> > > 
> > > This switch only supports a static model of configuration, so we
> > > restrict the interface modes to the configured setting.
> > > 
> > > Reviewed-by: Vladimir Oltean <olteanv@gmail.com>                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > 
> > These all appear on the same line, can you please fix and resend?
> 
> I hate vi/vim precisely because of this.
> 
> How this problem happens. I read the email in mutt under KDE's kconsole
> with your attributation. I select the attributation so it can be pasted.
> I edit the commit, which starts vi, move to the line containing my
> sign-off, hit 'i' and paste it in.
> 
> The result is a line that _looks_ in vi as being entirely correct. The
> next line follows on as if it is a separate line.
> 
> I save the commit message. When I look at it in "git log", again,
> everything looks good.
> 
> The only times that it can be identified is after sending and looking
> at it in mutt, and noticing that the Signed-off-by line appears to have
> a# '+' prefix, indicating that mutt wrapped the line - or after it gets
> merged into net-next when linux-next identifies the lack of s-o-b, by
> which time it's too late to fix.
> 
> How do others avoid this problem? Not use vi/vim, but use some other
> editor such as emacs or microemacs that doesn't have this crazy way of
> dealing with multiple lines?

I do this in vim all the time and never had this problem.
Maybe you're not realizing it's on the same line because you don't have
line numbers turned on? A long line wrapped by the vim viewer would be
obvious.

:set number

Compare (just a random bit of a commit message)

 20 Fixes: 869f0ec048dc ("arm64: dts: freescale: Fix 'interrupt-map' parent address cells")           │
 21 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Vladimir Oltean <vladimir.│
    oltean@nxp.com>                                                                                   │
 22

with

Fixes: 869f0ec048dc ("arm64: dts: freescale: Fix 'interrupt-map' parent address cells")               │
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Vladimir Oltean <vladimir.    │
oltean@nxp.com>                                                                                       │
Russell King (Oracle) Feb. 25, 2022, 12:41 p.m. UTC | #5
On Fri, Feb 25, 2022 at 02:15:56PM +0200, Vladimir Oltean wrote:
> On Fri, Feb 25, 2022 at 12:08:02PM +0000, Russell King (Oracle) wrote:
> > On Fri, Feb 25, 2022 at 01:58:58PM +0200, Vladimir Oltean wrote:
> > > On Fri, Feb 25, 2022 at 11:56:02AM +0000, Russell King (Oracle) wrote:
> > > > Populate the supported interfaces bitmap for the SJA1105 DSA switch.
> > > > 
> > > > This switch only supports a static model of configuration, so we
> > > > restrict the interface modes to the configured setting.
> > > > 
> > > > Reviewed-by: Vladimir Oltean <olteanv@gmail.com>                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > 
> > > These all appear on the same line, can you please fix and resend?
> > 
> > I hate vi/vim precisely because of this.
> > 
> > How this problem happens. I read the email in mutt under KDE's kconsole
> > with your attributation. I select the attributation so it can be pasted.
> > I edit the commit, which starts vi, move to the line containing my
> > sign-off, hit 'i' and paste it in.
> > 
> > The result is a line that _looks_ in vi as being entirely correct. The
> > next line follows on as if it is a separate line.
> > 
> > I save the commit message. When I look at it in "git log", again,
> > everything looks good.
> > 
> > The only times that it can be identified is after sending and looking
> > at it in mutt, and noticing that the Signed-off-by line appears to have
> > a# '+' prefix, indicating that mutt wrapped the line - or after it gets
> > merged into net-next when linux-next identifies the lack of s-o-b, by
> > which time it's too late to fix.
> > 
> > How do others avoid this problem? Not use vi/vim, but use some other
> > editor such as emacs or microemacs that doesn't have this crazy way of
> > dealing with multiple lines?
> 
> I do this in vim all the time and never had this problem.
> Maybe you're not realizing it's on the same line because you don't have
> line numbers turned on? A long line wrapped by the vim viewer would be
> obvious.
> 
> :set number

Thanks - Peter Zijlstra suggested "set showbreak=+" which works
wonderfully - gives the same indication that mutt does when reading
email that a line has wrapped and without being too intrusive but
makes the wrap visible.

The issue appears to be caused by a combination effect: not having
vim setup to identify wrapped lines, kconsole's copy-n-paste
behaviour where it attempts to replicate exactly what the program
in the terminal's output (even if it includes whitespace to the end
of the line), and probably the combination of mutt under screen under
mosh, resulting in the terminal thinking that the program wrote
"Reviewed-By: Joe Bloggs <joe@example.com>[large-number-of-space-characters]"

Anyway, "set showbreak=+" seems to be perfect.
diff mbox series

Patch

diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index b513713be610..90e73a982faf 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -1412,6 +1412,18 @@  static void sja1105_mac_link_up(struct dsa_switch *ds, int port,
 	sja1105_inhibit_tx(priv, BIT(port), false);
 }
 
+static void sja1105_phylink_get_caps(struct dsa_switch *ds, int port,
+				     struct phylink_config *config)
+{
+	struct sja1105_private *priv = ds->priv;
+
+	/* The SJA1105 MAC programming model is through the static config
+	 * (the xMII Mode table cannot be dynamically reconfigured), and
+	 * we have to program that early.
+	 */
+	__set_bit(priv->phy_mode[port], config->supported_interfaces);
+}
+
 static void sja1105_phylink_validate(struct dsa_switch *ds, int port,
 				     unsigned long *supported,
 				     struct phylink_link_state *state)
@@ -3152,6 +3164,7 @@  static const struct dsa_switch_ops sja1105_switch_ops = {
 	.set_ageing_time	= sja1105_set_ageing_time,
 	.port_change_mtu	= sja1105_change_mtu,
 	.port_max_mtu		= sja1105_get_max_mtu,
+	.phylink_get_caps	= sja1105_phylink_get_caps,
 	.phylink_validate	= sja1105_phylink_validate,
 	.phylink_mac_config	= sja1105_mac_config,
 	.phylink_mac_link_up	= sja1105_mac_link_up,