net: ethernet: update drivers to handle HWTSTAMP_FILTER_NTP_ALL
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 19 May 2017 15:52:36 +0000 (17:52 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 21 May 2017 17:37:32 +0000 (13:37 -0400)
Include HWTSTAMP_FILTER_NTP_ALL in net_hwtstamp_validate() as a valid
filter and update drivers which can timestamp all packets, or which
explicitly list unsupported filters instead of using a default case, to
handle the filter.

CC: Richard Cochran <richardcochran@gmail.com>
CC: Willem de Bruijn <willemb@google.com>
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
18 files changed:
drivers/net/ethernet/amd/xgbe/xgbe-drv.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/i40e/i40e_ptp.c
drivers/net/ethernet/intel/igb/igb_ptp.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
drivers/net/ethernet/mellanox/mlx5/core/en_clock.c
drivers/net/ethernet/neterion/vxge/vxge-main.c
drivers/net/ethernet/qlogic/qede/qede_ptp.c
drivers/net/ethernet/sfc/ef10.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/ti/cpsw.c
drivers/net/ethernet/tile/tilegx.c
net/core/dev_ioctl.c

index c772420fa41caf57907610bce4528da9c70be63e..89b21d7c537b6e690d0643b90f01816123963afa 100644 (file)
@@ -1268,6 +1268,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
        case HWTSTAMP_FILTER_NONE:
                break;
 
+       case HWTSTAMP_FILTER_NTP_ALL:
        case HWTSTAMP_FILTER_ALL:
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSENALL, 1);
                XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSENA, 1);
index 7414ffd70c90d71af5d05b98bfd7cda65213e98e..14c236e5bdb1a456ece5ff135e3bbff8a86955da 100644 (file)
@@ -15351,6 +15351,7 @@ int bnx2x_configure_ptp_filters(struct bnx2x *bp)
                break;
        case HWTSTAMP_FILTER_ALL:
        case HWTSTAMP_FILTER_SOME:
+       case HWTSTAMP_FILTER_NTP_ALL:
                bp->rx_filter = HWTSTAMP_FILTER_NONE;
                break;
        case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
index 649f2aaf0afb41e1a2096134a54bb1c13a451c4c..ba012427edd694057fe968e43e150165c1f9b9f0 100644 (file)
@@ -3024,6 +3024,7 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr)
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+       case HWTSTAMP_FILTER_NTP_ALL:
                conf.rx_filter = HWTSTAMP_FILTER_ALL;
                break;
        default:
index d51c8d8d9a35fcb6554a591b0daf7d3d672d2289..31d737c22648b71c119b38d8f8122a555dd6a5b6 100644 (file)
@@ -2085,6 +2085,7 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr)
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+       case HWTSTAMP_FILTER_NTP_ALL:
                conf.rx_filter = HWTSTAMP_FILTER_ALL;
                break;
        default:
index a2138686c6055d3d18d9294a14d2468b638cd9c3..2887bcaf6af56890fbcf5e9f915151d5c08dc455 100644 (file)
@@ -755,6 +755,7 @@ static int octeon_mgmt_ioctl_hwtstamp(struct net_device *netdev,
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+       case HWTSTAMP_FILTER_NTP_ALL:
                p->has_rx_tstamp = have_hw_timestamps;
                config.rx_filter = HWTSTAMP_FILTER_ALL;
                if (p->has_rx_tstamp) {
index b3679728caac451354873e60e5114429af0a7fdd..0ff9295ed449b3f02c54e9287a8b666114fd2bcc 100644 (file)
@@ -3680,6 +3680,7 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
                 * Delay Request messages but not both so fall-through to
                 * time stamp all packets.
                 */
+       case HWTSTAMP_FILTER_NTP_ALL:
        case HWTSTAMP_FILTER_ALL:
                is_l2 = true;
                is_l4 = true;
index 18c1cc08da97da972daf97a8df01e69f8039d31c..0efff18ee336ba1568173e45be29efa064703440 100644 (file)
@@ -562,6 +562,7 @@ static int i40e_ptp_set_timestamp_mode(struct i40e_pf *pf,
                        config->rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
                }
                break;
+       case HWTSTAMP_FILTER_NTP_ALL:
        case HWTSTAMP_FILTER_ALL:
        default:
                return -ERANGE;
index 7a3fd4d745928c809961c589e05ce25abc0077a9..d333d6d80194af085b643e6efea10360407543b1 100644 (file)
@@ -941,6 +941,7 @@ static int igb_ptp_set_timestamp_mode(struct igb_adapter *adapter,
                is_l4 = true;
                break;
        case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
+       case HWTSTAMP_FILTER_NTP_ALL:
        case HWTSTAMP_FILTER_ALL:
                /* 82576 cannot timestamp all packets, which it needs to do to
                 * support both V1 Sync and Delay_Req messages
index ef0635e0918c239f066362f5c33eec5beb38a17d..d44c728fdc0be1b598b4f74a9f76b212c71ff3d9 100644 (file)
@@ -883,6 +883,7 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter,
                                   IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
                break;
        case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
+       case HWTSTAMP_FILTER_NTP_ALL:
        case HWTSTAMP_FILTER_ALL:
                /* The X550 controller is capable of timestamping all packets,
                 * which allows it to accept any filter.
index 94fab20ef146bd5874a21ec2ecbe3dea16180aec..82436742ad75b011847cde250bc26f7a2d9e7175 100644 (file)
@@ -2375,6 +2375,7 @@ static int mlx4_en_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+       case HWTSTAMP_FILTER_NTP_ALL:
                config.rx_filter = HWTSTAMP_FILTER_ALL;
                break;
        default:
index e706a87fc8b2b06b8f620a96f66d316e90070e04..e29494464cae9cea6e0af45337d3eac0e9168117 100644 (file)
@@ -128,6 +128,7 @@ int mlx5e_hwstamp_set(struct net_device *dev, struct ifreq *ifr)
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+       case HWTSTAMP_FILTER_NTP_ALL:
                /* Disable CQE compression */
                netdev_warn(dev, "Disabling cqe compression");
                err = mlx5e_modify_rx_cqe_compression_locked(priv, false);
index 6a4310af5d970eae8821357c61701847804d1b72..50ea69d88480c6108e82192d9b9ed57c985ccaf7 100644 (file)
@@ -3218,6 +3218,7 @@ static int vxge_hwtstamp_set(struct vxgedev *vdev, void __user *data)
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+       case HWTSTAMP_FILTER_NTP_ALL:
                if (vdev->devh->config.hwts_en != VXGE_HW_HWTS_ENABLE)
                        return -EFAULT;
 
index 24f06e2ef43e8c16c8b29f35a87d952e71da5dd6..9b2280badaf77666ceab5cf0409f484ed08719b8 100644 (file)
@@ -244,6 +244,7 @@ static int qede_ptp_cfg_filters(struct qede_dev *edev)
                break;
        case HWTSTAMP_FILTER_ALL:
        case HWTSTAMP_FILTER_SOME:
+       case HWTSTAMP_FILTER_NTP_ALL:
                ptp->rx_filter = HWTSTAMP_FILTER_NONE;
                rx_filter = QED_PTP_FILTER_ALL;
                break;
index 78efb2822b8648c6e6f02ffa764aad89570ffbd0..ad9c4ded2b901f2f339dafab57ec7eed0b5f8059 100644 (file)
@@ -6068,6 +6068,7 @@ static int efx_ef10_ptp_set_ts_config(struct efx_nic *efx,
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+       case HWTSTAMP_FILTER_NTP_ALL:
                init->rx_filter = HWTSTAMP_FILTER_ALL;
                rc = efx_ptp_change_mode(efx, true, 0);
                if (!rc)
index a74c481401c46ee659b1244b0124966cabeafdbd..cce862b81f3e2426db38af9561cfdf28b41fb218 100644 (file)
@@ -644,6 +644,7 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr)
                        ptp_over_ethernet = PTP_TCR_TSIPENA;
                        break;
 
+               case HWTSTAMP_FILTER_NTP_ALL:
                case HWTSTAMP_FILTER_ALL:
                        /* time stamp any incoming packet */
                        config.rx_filter = HWTSTAMP_FILTER_ALL;
index f4d7aec5047953559b46755f694cabc191c304f9..37fc16521143ed8391d81103e621e7e723ab7919 100644 (file)
@@ -1734,6 +1734,7 @@ static int cpsw_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
        case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
        case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
        case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
+       case HWTSTAMP_FILTER_NTP_ALL:
                return -ERANGE;
        case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
index 7c634bc75615870e33c50ad0c514c9339333097f..aec95382ea5ceb46d9841088bf6dd55bfcca55b7 100644 (file)
@@ -512,6 +512,7 @@ static int tile_hwtstamp_set(struct net_device *dev, struct ifreq *rq)
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+       case HWTSTAMP_FILTER_NTP_ALL:
                config.rx_filter = HWTSTAMP_FILTER_ALL;
                break;
        default:
index 8f036a76b92ef626c185ea203b733a5712b000bb..77f04e71100fc7de6c508a1ece2d375d16390331 100644 (file)
@@ -225,9 +225,8 @@ static int net_hwtstamp_validate(struct ifreq *ifr)
        case HWTSTAMP_FILTER_PTP_V2_EVENT:
        case HWTSTAMP_FILTER_PTP_V2_SYNC:
        case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
-               rx_filter_valid = 1;
-               break;
        case HWTSTAMP_FILTER_NTP_ALL:
+               rx_filter_valid = 1;
                break;
        }