Skip to content

Commit 9e46b6b

Browse files
Russell King (Oracle)harshimogalapalli
authored andcommitted
net: dsa: b53/bcm_sf2: implement .support_eee() method
commit c86692f upstream. Implement the .support_eee() method to indicate that EEE is not supported by two switch variants, rather than making these checks in the .set_mac_eee() and .get_mac_eee() methods. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Link: https://patch.msgid.link/E1tL14E-006cZU-Nc@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit b765b9ee4e5a82e9d0e5d0649bf031e8a8b90b3d) Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
1 parent 7b01bb2 commit 9e46b6b

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,13 +2388,16 @@ int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy)
23882388
}
23892389
EXPORT_SYMBOL(b53_eee_init);
23902390

2391-
int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
2391+
bool b53_support_eee(struct dsa_switch *ds, int port)
23922392
{
23932393
struct b53_device *dev = ds->priv;
23942394

2395-
if (is5325(dev) || is5365(dev))
2396-
return -EOPNOTSUPP;
2395+
return !is5325(dev) && !is5365(dev);
2396+
}
2397+
EXPORT_SYMBOL(b53_support_eee);
23972398

2399+
int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
2400+
{
23982401
return 0;
23992402
}
24002403
EXPORT_SYMBOL(b53_get_mac_eee);
@@ -2404,9 +2407,6 @@ int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
24042407
struct b53_device *dev = ds->priv;
24052408
struct ethtool_keee *p = &dev->ports[port].eee;
24062409

2407-
if (is5325(dev) || is5365(dev))
2408-
return -EOPNOTSUPP;
2409-
24102410
p->eee_enabled = e->eee_enabled;
24112411
b53_eee_enable_set(ds, port, e->eee_enabled);
24122412

@@ -2463,6 +2463,7 @@ static const struct dsa_switch_ops b53_switch_ops = {
24632463
.port_setup = b53_setup_port,
24642464
.port_enable = b53_enable_port,
24652465
.port_disable = b53_disable_port,
2466+
.support_eee = b53_support_eee,
24662467
.get_mac_eee = b53_get_mac_eee,
24672468
.set_mac_eee = b53_set_mac_eee,
24682469
.port_bridge_join = b53_br_join,

drivers/net/dsa/b53/b53_priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
387387
void b53_disable_port(struct dsa_switch *ds, int port);
388388
void b53_brcm_hdr_setup(struct dsa_switch *ds, int port);
389389
int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy);
390+
bool b53_support_eee(struct dsa_switch *ds, int port);
390391
int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);
391392
int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);
392393

drivers/net/dsa/bcm_sf2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,7 @@ static const struct dsa_switch_ops bcm_sf2_ops = {
12331233
.port_setup = b53_setup_port,
12341234
.port_enable = bcm_sf2_port_setup,
12351235
.port_disable = bcm_sf2_port_disable,
1236+
.support_eee = b53_support_eee,
12361237
.get_mac_eee = b53_get_mac_eee,
12371238
.set_mac_eee = b53_set_mac_eee,
12381239
.port_bridge_join = b53_br_join,

0 commit comments

Comments
 (0)