diff mbox series

[net-next,01/12] net: hns3: check 1000M half for hns3_ethtool_ops.set_link_ksettings

Message ID 1554260881-44948-2-git-send-email-tanhuazhong@huawei.com
State Changes Requested
Delegated to: David Miller
Headers show
Series code optimizations & bugfixes for HNS3 driver | expand

Commit Message

tanhuazhong April 3, 2019, 3:07 a.m. UTC
From: Peng Li <lipeng321@huawei.com>

Hip08 SOC does not support 1000M half, this patch adds 1000M half
check for hns3_ethtool_ops.set_link_ksettings, so the user can not
set 1000M half by ethtool.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Sergei Shtylyov April 3, 2019, 9:12 a.m. UTC | #1
Hello!

On 03.04.2019 6:07, Huazhong Tan wrote:

> From: Peng Li <lipeng321@huawei.com>
> 
> Hip08 SOC does not support 1000M half, this patch adds 1000M half
> check for hns3_ethtool_ops.set_link_ksettings, so the user can not
> set 1000M half by ethtool.
> 
> Signed-off-by: Peng Li <lipeng321@huawei.com>
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
> ---
>   drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
> index 359d473..0c05807 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
> @@ -648,6 +648,10 @@ static int hns3_get_link_ksettings(struct net_device *netdev,
>   static int hns3_set_link_ksettings(struct net_device *netdev,
>   				   const struct ethtool_link_ksettings *cmd)
>   {
> +	/* Chip don't support this mode. */

    Doesn't.

[...]

MBR, Sergei
tanhuazhong April 3, 2019, 9:52 a.m. UTC | #2
On 2019/4/3 17:12, Sergei Shtylyov wrote:
> Hello!
> 
> On 03.04.2019 6:07, Huazhong Tan wrote:
> 
>> From: Peng Li <lipeng321@huawei.com>
>>
>> Hip08 SOC does not support 1000M half, this patch adds 1000M half
>> check for hns3_ethtool_ops.set_link_ksettings, so the user can not
>> set 1000M half by ethtool.
>>
>> Signed-off-by: Peng Li <lipeng321@huawei.com>
>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
>> ---
>>   drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c 
>> b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
>> index 359d473..0c05807 100644
>> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
>> @@ -648,6 +648,10 @@ static int hns3_get_link_ksettings(struct 
>> net_device *netdev,
>>   static int hns3_set_link_ksettings(struct net_device *netdev,
>>                      const struct ethtool_link_ksettings *cmd)
>>   {
>> +    /* Chip don't support this mode. */
> 
>     Doesn't.
> 
> [...]
> 
> MBR, Sergei
> 

ok, thanks.

> .
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index 359d473..0c05807 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -648,6 +648,10 @@  static int hns3_get_link_ksettings(struct net_device *netdev,
 static int hns3_set_link_ksettings(struct net_device *netdev,
 				   const struct ethtool_link_ksettings *cmd)
 {
+	/* Chip don't support this mode. */
+	if (cmd->base.speed == SPEED_1000 && cmd->base.duplex == DUPLEX_HALF)
+		return -EINVAL;
+
 	/* Only support ksettings_set for netdev with phy attached for now */
 	if (netdev->phydev)
 		return phy_ethtool_ksettings_set(netdev->phydev, cmd);