]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net: thunderx: Add ethtool support for supported ports and link modes.
authorThanneeru Srinivasulu <tsrinivasulu@cavium.com>
Thu, 24 Nov 2016 09:18:01 +0000 (14:48 +0530)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Nov 2016 01:21:17 +0000 (20:21 -0500)
Signed-off-by: Thanneeru Srinivasulu <tsrinivasulu@cavium.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/thunder/nic.h
drivers/net/ethernet/cavium/thunder/nic_main.c
drivers/net/ethernet/cavium/thunder/nicvf_ethtool.c
drivers/net/ethernet/cavium/thunder/nicvf_main.c
drivers/net/ethernet/cavium/thunder/thunder_bgx.c

index 86bd93ce2ea30fc66f1c9c63fdf5a5d6209013a2..be8404a9a325079508f1bc2b0f899b7ad5437208 100644 (file)
@@ -292,6 +292,7 @@ struct nicvf {
        u8                      node;
        u8                      cpi_alg;
        bool                    link_up;
+       u8                      mac_type;
        u8                      duplex;
        u32                     speed;
        bool                    tns_mode;
@@ -446,6 +447,7 @@ struct bgx_stats_msg {
 /* Physical interface link status */
 struct bgx_link_status {
        u8    msg;
+       u8    mac_type;
        u8    link_up;
        u8    duplex;
        u32   speed;
index 6677b96e1f3f6e033ac985847e3b65b27db17842..b87d416ad372c1f5553ce2727816d9d172e128b7 100644 (file)
@@ -1258,6 +1258,7 @@ static void nic_poll_for_link(struct work_struct *work)
                        mbx.link_status.link_up = link.link_up;
                        mbx.link_status.duplex = link.duplex;
                        mbx.link_status.speed = link.speed;
+                       mbx.link_status.mac_type = link.mac_type;
                        nic_send_msg_to_vf(nic, vf, &mbx);
                }
        }
index 432bf6be57cb2ff596d43ec08f2ff0aa250d4b86..d4d76a72b998a57bb5a320be819e6c7bea7988fe 100644 (file)
@@ -130,12 +130,42 @@ static int nicvf_get_settings(struct net_device *netdev,
                return 0;
        }
 
-       if (nic->speed <= 1000) {
-               cmd->port = PORT_MII;
+       switch (nic->speed) {
+       case SPEED_1000:
+               cmd->port = PORT_MII | PORT_TP;
                cmd->autoneg = AUTONEG_ENABLE;
-       } else {
+               cmd->supported |= SUPPORTED_MII | SUPPORTED_TP;
+               cmd->supported |= SUPPORTED_1000baseT_Full |
+                                 SUPPORTED_1000baseT_Half |
+                                 SUPPORTED_100baseT_Full  |
+                                 SUPPORTED_100baseT_Half  |
+                                 SUPPORTED_10baseT_Full   |
+                                 SUPPORTED_10baseT_Half;
+               cmd->supported |= SUPPORTED_Autoneg;
+               cmd->advertising |= ADVERTISED_1000baseT_Full |
+                                   ADVERTISED_1000baseT_Half |
+                                   ADVERTISED_100baseT_Full  |
+                                   ADVERTISED_100baseT_Half  |
+                                   ADVERTISED_10baseT_Full   |
+                                   ADVERTISED_10baseT_Half;
+               break;
+       case SPEED_10000:
+               if (nic->mac_type == BGX_MODE_RXAUI) {
+                       cmd->port = PORT_TP;
+                       cmd->supported |= SUPPORTED_TP;
+               } else {
+                       cmd->port = PORT_FIBRE;
+                       cmd->supported |= SUPPORTED_FIBRE;
+               }
+               cmd->autoneg = AUTONEG_DISABLE;
+               cmd->supported |= SUPPORTED_10000baseT_Full;
+               break;
+       case SPEED_40000:
                cmd->port = PORT_FIBRE;
                cmd->autoneg = AUTONEG_DISABLE;
+               cmd->supported |= SUPPORTED_FIBRE;
+               cmd->supported |= SUPPORTED_40000baseCR4_Full;
+               break;
        }
        cmd->duplex = nic->duplex;
        ethtool_cmd_speed_set(cmd, nic->speed);
index 7c2c37388c1240c79712b37ad846d3a0ad6748bf..c6c23033e6ebb28178359cfcdf0f3deea20aad88 100644 (file)
@@ -221,6 +221,7 @@ static void  nicvf_handle_mbx_intr(struct nicvf *nic)
                nic->link_up = mbx.link_status.link_up;
                nic->duplex = mbx.link_status.duplex;
                nic->speed = mbx.link_status.speed;
+               nic->mac_type = mbx.link_status.mac_type;
                if (nic->link_up) {
                        netdev_info(nic->netdev, "%s: Link is Up %d Mbps %s\n",
                                    nic->netdev->name, nic->speed,
index 1d6214ba2cf1c71abf12f52c8f3be1d96abb5585..29c727fc887a8491e6a5518f05ec0a24d4492013 100644 (file)
@@ -161,6 +161,7 @@ void bgx_get_lmac_link_state(int node, int bgx_idx, int lmacid, void *status)
                return;
 
        lmac = &bgx->lmac[lmacid];
+       link->mac_type = lmac->lmac_type;
        link->link_up = lmac->link_up;
        link->duplex = lmac->last_duplex;
        link->speed = lmac->last_speed;