2015-04-23 19:17:19

by Karicheri, Muralidharan

[permalink] [raw]
Subject: [PATCH] net: netcp: remove call to netif_carrier_(on/off) for MAC to Phy interface

Currently when interface type is MAC to Phy, netif_carrier_(on/off)
is called which is not needed as Phy lib already updates the carrier
status to net stack. This is needed only for other interface types

Signed-off-by: Murali Karicheri <[email protected]>
---
drivers/net/ethernet/ti/netcp_ethss.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
index 2bef655..0a1ef2e 100644
--- a/drivers/net/ethernet/ti/netcp_ethss.c
+++ b/drivers/net/ethernet/ti/netcp_ethss.c
@@ -1765,7 +1765,9 @@ static void netcp_ethss_link_state_action(struct gbe_priv *gbe_dev,
ALE_PORT_STATE,
ALE_PORT_STATE_FORWARD);

- if (ndev && slave->open)
+ if (ndev && slave->open &&
+ ((slave->link_interface != SGMII_LINK_MAC_PHY) &&
+ (slave->link_interface != XGMII_LINK_MAC_PHY)))
netif_carrier_on(ndev);
} else {
writel(mac_control, GBE_REG_ADDR(slave, emac_regs,
@@ -1773,7 +1775,9 @@ static void netcp_ethss_link_state_action(struct gbe_priv *gbe_dev,
cpsw_ale_control_set(gbe_dev->ale, slave->port_num,
ALE_PORT_STATE,
ALE_PORT_STATE_DISABLE);
- if (ndev)
+ if (ndev &&
+ ((slave->link_interface != SGMII_LINK_MAC_PHY) &&
+ (slave->link_interface != XGMII_LINK_MAC_PHY)))
netif_carrier_off(ndev);
}

--
1.7.9.5


2015-04-24 05:55:11

by Mugunthan V N

[permalink] [raw]
Subject: Re: [PATCH] net: netcp: remove call to netif_carrier_(on/off) for MAC to Phy interface

On Friday 24 April 2015 12:47 AM, Murali Karicheri wrote:
> Currently when interface type is MAC to Phy, netif_carrier_(on/off)
> is called which is not needed as Phy lib already updates the carrier
> status to net stack. This is needed only for other interface types
>
> Signed-off-by: Murali Karicheri <[email protected]>
> ---

Acked-by: Mugunthan V N <[email protected]>

Regards
Mugunthan V N

2015-04-24 13:33:32

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] net: netcp: remove call to netif_carrier_(on/off) for MAC to Phy interface

Hello.

On 4/23/2015 10:17 PM, Murali Karicheri wrote:

> Currently when interface type is MAC to Phy, netif_carrier_(on/off)
> is called which is not needed as Phy lib already updates the carrier
> status to net stack. This is needed only for other interface types

> Signed-off-by: Murali Karicheri <[email protected]>
> ---
> drivers/net/ethernet/ti/netcp_ethss.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)

> diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
> index 2bef655..0a1ef2e 100644
> --- a/drivers/net/ethernet/ti/netcp_ethss.c
> +++ b/drivers/net/ethernet/ti/netcp_ethss.c
> @@ -1765,7 +1765,9 @@ static void netcp_ethss_link_state_action(struct gbe_priv *gbe_dev,
> ALE_PORT_STATE,
> ALE_PORT_STATE_FORWARD);
>
> - if (ndev && slave->open)
> + if (ndev && slave->open &&
> + ((slave->link_interface != SGMII_LINK_MAC_PHY) &&
> + (slave->link_interface != XGMII_LINK_MAC_PHY)))

You don't need extra parens around &&.

> netif_carrier_on(ndev);
> } else {
> writel(mac_control, GBE_REG_ADDR(slave, emac_regs,
> @@ -1773,7 +1775,9 @@ static void netcp_ethss_link_state_action(struct gbe_priv *gbe_dev,
> cpsw_ale_control_set(gbe_dev->ale, slave->port_num,
> ALE_PORT_STATE,
> ALE_PORT_STATE_DISABLE);
> - if (ndev)
> + if (ndev &&
> + ((slave->link_interface != SGMII_LINK_MAC_PHY) &&
> + (slave->link_interface != XGMII_LINK_MAC_PHY)))

Likewise.

WBR, Sergei

2015-04-24 15:18:04

by Karicheri, Muralidharan

[permalink] [raw]
Subject: Re: [PATCH] net: netcp: remove call to netif_carrier_(on/off) for MAC to Phy interface

On 04/24/2015 09:33 AM, Sergei Shtylyov wrote:
> Hello.
>
> On 4/23/2015 10:17 PM, Murali Karicheri wrote:
>
>> Currently when interface type is MAC to Phy, netif_carrier_(on/off)
>> is called which is not needed as Phy lib already updates the carrier
>> status to net stack. This is needed only for other interface types
>
>> Signed-off-by: Murali Karicheri <[email protected]>
>> ---
>> drivers/net/ethernet/ti/netcp_ethss.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>
>> diff --git a/drivers/net/ethernet/ti/netcp_ethss.c
>> b/drivers/net/ethernet/ti/netcp_ethss.c
>> index 2bef655..0a1ef2e 100644
>> --- a/drivers/net/ethernet/ti/netcp_ethss.c
>> +++ b/drivers/net/ethernet/ti/netcp_ethss.c
>> @@ -1765,7 +1765,9 @@ static void
>> netcp_ethss_link_state_action(struct gbe_priv *gbe_dev,
>> ALE_PORT_STATE,
>> ALE_PORT_STATE_FORWARD);
>>
>> - if (ndev && slave->open)
>> + if (ndev && slave->open &&
>> + ((slave->link_interface != SGMII_LINK_MAC_PHY) &&
>> + (slave->link_interface != XGMII_LINK_MAC_PHY)))
>
> You don't need extra parens around &&.
You are right! I will fix it up and re-send.

Mruali
>
>> netif_carrier_on(ndev);
>> } else {
>> writel(mac_control, GBE_REG_ADDR(slave, emac_regs,
>> @@ -1773,7 +1775,9 @@ static void
>> netcp_ethss_link_state_action(struct gbe_priv *gbe_dev,
>> cpsw_ale_control_set(gbe_dev->ale, slave->port_num,
>> ALE_PORT_STATE,
>> ALE_PORT_STATE_DISABLE);
>> - if (ndev)
>> + if (ndev &&
>> + ((slave->link_interface != SGMII_LINK_MAC_PHY) &&
>> + (slave->link_interface != XGMII_LINK_MAC_PHY)))
>
> Likewise.
>
> WBR, Sergei
>


--
Murali Karicheri
Linux Kernel, Texas Instruments

2015-04-24 16:41:37

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] net: netcp: remove call to netif_carrier_(on/off) for MAC to Phy interface

On 04/24/2015 06:18 PM, Murali Karicheri wrote:

>>> Currently when interface type is MAC to Phy, netif_carrier_(on/off)
>>> is called which is not needed as Phy lib already updates the carrier
>>> status to net stack. This is needed only for other interface types

>>> Signed-off-by: Murali Karicheri <[email protected]>
>>> ---
>>> drivers/net/ethernet/ti/netcp_ethss.c | 8 ++++++--
>>> 1 file changed, 6 insertions(+), 2 deletions(-)

>>> diff --git a/drivers/net/ethernet/ti/netcp_ethss.c
>>> b/drivers/net/ethernet/ti/netcp_ethss.c
>>> index 2bef655..0a1ef2e 100644
>>> --- a/drivers/net/ethernet/ti/netcp_ethss.c
>>> +++ b/drivers/net/ethernet/ti/netcp_ethss.c
>>> @@ -1765,7 +1765,9 @@ static void netcp_ethss_link_state_action(struct
>>> gbe_priv *gbe_dev,
>>> ALE_PORT_STATE,
>>> ALE_PORT_STATE_FORWARD);
>>>
>>> - if (ndev && slave->open)
>>> + if (ndev && slave->open &&
>>> + ((slave->link_interface != SGMII_LINK_MAC_PHY) &&
>>> + (slave->link_interface != XGMII_LINK_MAC_PHY)))

>> You don't need extra parens around &&.

> You are right! I will fix it up and re-send.

In fact, you don't need parens around != either.

> Mruali

[...]

WBR, Sergei