@@ -3574,6 +3574,7 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)
3574
3574
* e1000e_config_hwtstamp - configure the hwtstamp registers and enable/disable
3575
3575
* @adapter: board private structure
3576
3576
* @config: timestamp configuration
3577
+ * @extack: netlink extended ACK for error report
3577
3578
*
3578
3579
* Outgoing time stamping can be enabled and disabled. Play nice and
3579
3580
* disable it when requested, although it shouldn't cause any overhead
@@ -3587,7 +3588,8 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)
3587
3588
* exception of "all V2 events regardless of level 2 or 4".
3588
3589
**/
3589
3590
static int e1000e_config_hwtstamp (struct e1000_adapter * adapter ,
3590
- struct hwtstamp_config * config )
3591
+ struct kernel_hwtstamp_config * config ,
3592
+ struct netlink_ext_ack * extack )
3591
3593
{
3592
3594
struct e1000_hw * hw = & adapter -> hw ;
3593
3595
u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED ;
@@ -3598,8 +3600,10 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
3598
3600
bool is_l2 = false;
3599
3601
u32 regval ;
3600
3602
3601
- if (!(adapter -> flags & FLAG_HAS_HW_TIMESTAMP ))
3603
+ if (!(adapter -> flags & FLAG_HAS_HW_TIMESTAMP )) {
3604
+ NL_SET_ERR_MSG (extack , "No HW timestamp support" );
3602
3605
return - EINVAL ;
3606
+ }
3603
3607
3604
3608
switch (config -> tx_type ) {
3605
3609
case HWTSTAMP_TX_OFF :
@@ -3608,6 +3612,7 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
3608
3612
case HWTSTAMP_TX_ON :
3609
3613
break ;
3610
3614
default :
3615
+ NL_SET_ERR_MSG (extack , "Unsupported TX HW timestamp type" );
3611
3616
return - ERANGE ;
3612
3617
}
3613
3618
@@ -3681,6 +3686,7 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
3681
3686
config -> rx_filter = HWTSTAMP_FILTER_ALL ;
3682
3687
break ;
3683
3688
default :
3689
+ NL_SET_ERR_MSG (extack , "Unsupported RX HW timestamp filter" );
3684
3690
return - ERANGE ;
3685
3691
}
3686
3692
@@ -3693,7 +3699,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
3693
3699
ew32 (TSYNCTXCTL , regval );
3694
3700
if ((er32 (TSYNCTXCTL ) & E1000_TSYNCTXCTL_ENABLED ) !=
3695
3701
(regval & E1000_TSYNCTXCTL_ENABLED )) {
3696
- e_err ("Timesync Tx Control register not set as expected\n" );
3702
+ NL_SET_ERR_MSG (extack ,
3703
+ "Timesync Tx Control register not set as expected" );
3697
3704
return - EAGAIN ;
3698
3705
}
3699
3706
@@ -3706,7 +3713,8 @@ static int e1000e_config_hwtstamp(struct e1000_adapter *adapter,
3706
3713
E1000_TSYNCRXCTL_TYPE_MASK )) !=
3707
3714
(regval & (E1000_TSYNCRXCTL_ENABLED |
3708
3715
E1000_TSYNCRXCTL_TYPE_MASK ))) {
3709
- e_err ("Timesync Rx Control register not set as expected\n" );
3716
+ NL_SET_ERR_MSG (extack ,
3717
+ "Timesync Rx Control register not set as expected" );
3710
3718
return - EAGAIN ;
3711
3719
}
3712
3720
@@ -3901,6 +3909,7 @@ static void e1000e_systim_reset(struct e1000_adapter *adapter)
3901
3909
{
3902
3910
struct ptp_clock_info * info = & adapter -> ptp_clock_info ;
3903
3911
struct e1000_hw * hw = & adapter -> hw ;
3912
+ struct netlink_ext_ack extack = {};
3904
3913
unsigned long flags ;
3905
3914
u32 timinca ;
3906
3915
s32 ret_val ;
@@ -3932,7 +3941,12 @@ static void e1000e_systim_reset(struct e1000_adapter *adapter)
3932
3941
spin_unlock_irqrestore (& adapter -> systim_lock , flags );
3933
3942
3934
3943
/* restore the previous hwtstamp configuration settings */
3935
- e1000e_config_hwtstamp (adapter , & adapter -> hwtstamp_config );
3944
+ ret_val = e1000e_config_hwtstamp (adapter , & adapter -> hwtstamp_config ,
3945
+ & extack );
3946
+ if (ret_val ) {
3947
+ if (extack ._msg )
3948
+ e_err ("%s\n" , extack ._msg );
3949
+ }
3936
3950
}
3937
3951
3938
3952
/**
@@ -6079,8 +6093,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
6079
6093
return 0 ;
6080
6094
}
6081
6095
6082
- static int e1000_mii_ioctl (struct net_device * netdev , struct ifreq * ifr ,
6083
- int cmd )
6096
+ static int e1000_ioctl (struct net_device * netdev , struct ifreq * ifr , int cmd )
6084
6097
{
6085
6098
struct e1000_adapter * adapter = netdev_priv (netdev );
6086
6099
struct mii_ioctl_data * data = if_mii (ifr );
@@ -6140,7 +6153,8 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
6140
6153
/**
6141
6154
* e1000e_hwtstamp_set - control hardware time stamping
6142
6155
* @netdev: network interface device structure
6143
- * @ifr: interface request
6156
+ * @config: timestamp configuration
6157
+ * @extack: netlink extended ACK report
6144
6158
*
6145
6159
* Outgoing time stamping can be enabled and disabled. Play nice and
6146
6160
* disable it when requested, although it shouldn't cause any overhead
@@ -6153,20 +6167,18 @@ static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
6153
6167
* specified. Matching the kind of event packet is not supported, with the
6154
6168
* exception of "all V2 events regardless of level 2 or 4".
6155
6169
**/
6156
- static int e1000e_hwtstamp_set (struct net_device * netdev , struct ifreq * ifr )
6170
+ static int e1000e_hwtstamp_set (struct net_device * netdev ,
6171
+ struct kernel_hwtstamp_config * config ,
6172
+ struct netlink_ext_ack * extack )
6157
6173
{
6158
6174
struct e1000_adapter * adapter = netdev_priv (netdev );
6159
- struct hwtstamp_config config ;
6160
6175
int ret_val ;
6161
6176
6162
- if (copy_from_user (& config , ifr -> ifr_data , sizeof (config )))
6163
- return - EFAULT ;
6164
-
6165
- ret_val = e1000e_config_hwtstamp (adapter , & config );
6177
+ ret_val = e1000e_config_hwtstamp (adapter , config , extack );
6166
6178
if (ret_val )
6167
6179
return ret_val ;
6168
6180
6169
- switch (config . rx_filter ) {
6181
+ switch (config -> rx_filter ) {
6170
6182
case HWTSTAMP_FILTER_PTP_V2_L4_SYNC :
6171
6183
case HWTSTAMP_FILTER_PTP_V2_L2_SYNC :
6172
6184
case HWTSTAMP_FILTER_PTP_V2_SYNC :
@@ -6178,38 +6190,23 @@ static int e1000e_hwtstamp_set(struct net_device *netdev, struct ifreq *ifr)
6178
6190
* by hardware so notify the caller the requested packets plus
6179
6191
* some others are time stamped.
6180
6192
*/
6181
- config . rx_filter = HWTSTAMP_FILTER_SOME ;
6193
+ config -> rx_filter = HWTSTAMP_FILTER_SOME ;
6182
6194
break ;
6183
6195
default :
6184
6196
break ;
6185
6197
}
6186
6198
6187
- return copy_to_user (ifr -> ifr_data , & config ,
6188
- sizeof (config )) ? - EFAULT : 0 ;
6199
+ return 0 ;
6189
6200
}
6190
6201
6191
- static int e1000e_hwtstamp_get (struct net_device * netdev , struct ifreq * ifr )
6202
+ static int e1000e_hwtstamp_get (struct net_device * netdev ,
6203
+ struct kernel_hwtstamp_config * kernel_config )
6192
6204
{
6193
6205
struct e1000_adapter * adapter = netdev_priv (netdev );
6194
6206
6195
- return copy_to_user (ifr -> ifr_data , & adapter -> hwtstamp_config ,
6196
- sizeof (adapter -> hwtstamp_config )) ? - EFAULT : 0 ;
6197
- }
6207
+ * kernel_config = adapter -> hwtstamp_config ;
6198
6208
6199
- static int e1000_ioctl (struct net_device * netdev , struct ifreq * ifr , int cmd )
6200
- {
6201
- switch (cmd ) {
6202
- case SIOCGMIIPHY :
6203
- case SIOCGMIIREG :
6204
- case SIOCSMIIREG :
6205
- return e1000_mii_ioctl (netdev , ifr , cmd );
6206
- case SIOCSHWTSTAMP :
6207
- return e1000e_hwtstamp_set (netdev , ifr );
6208
- case SIOCGHWTSTAMP :
6209
- return e1000e_hwtstamp_get (netdev , ifr );
6210
- default :
6211
- return - EOPNOTSUPP ;
6212
- }
6209
+ return 0 ;
6213
6210
}
6214
6211
6215
6212
static int e1000_init_phy_wakeup (struct e1000_adapter * adapter , u32 wufc )
@@ -7346,9 +7343,11 @@ static const struct net_device_ops e1000e_netdev_ops = {
7346
7343
#ifdef CONFIG_NET_POLL_CONTROLLER
7347
7344
.ndo_poll_controller = e1000_netpoll ,
7348
7345
#endif
7349
- .ndo_set_features = e1000_set_features ,
7350
- .ndo_fix_features = e1000_fix_features ,
7346
+ .ndo_set_features = e1000_set_features ,
7347
+ .ndo_fix_features = e1000_fix_features ,
7351
7348
.ndo_features_check = passthru_features_check ,
7349
+ .ndo_hwtstamp_get = e1000e_hwtstamp_get ,
7350
+ .ndo_hwtstamp_set = e1000e_hwtstamp_set ,
7352
7351
};
7353
7352
7354
7353
/**
0 commit comments