Skip to content

Commit d0c3e46

Browse files
committed
Merge branch 'hwtstamp_bonding'
Hangbin Liu says: ==================== net: add new hwtstamp flag HWTSTAMP_FLAG_BONDED_PHC_INDEX This patchset add a new hwtstamp_config flag HWTSTAMP_FLAG_BONDED_PHC_INDEX. When user want to get bond active interface's PHC, they need to add this flag and aware the PHC index may changed. v3: Use bitwise test to check the flags validation v2: rename the flag to HWTSTAMP_FLAG_BONDED_PHC_INDEX ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents a3c62a0 + 085d610 commit d0c3e46

File tree

41 files changed

+37
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+37
-156
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4094,6 +4094,7 @@ static int bond_eth_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cm
40944094
struct mii_ioctl_data *mii = NULL;
40954095
const struct net_device_ops *ops;
40964096
struct net_device *real_dev;
4097+
struct hwtstamp_config cfg;
40974098
struct ifreq ifrr;
40984099
int res = 0;
40994100

@@ -4124,21 +4125,29 @@ static int bond_eth_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cm
41244125
break;
41254126
case SIOCSHWTSTAMP:
41264127
case SIOCGHWTSTAMP:
4127-
rcu_read_lock();
4128-
real_dev = bond_option_active_slave_get_rcu(bond);
4129-
rcu_read_unlock();
4130-
if (real_dev) {
4131-
strscpy_pad(ifrr.ifr_name, real_dev->name, IFNAMSIZ);
4132-
ifrr.ifr_ifru = ifr->ifr_ifru;
4128+
if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
4129+
return -EFAULT;
4130+
4131+
if (cfg.flags & HWTSTAMP_FLAG_BONDED_PHC_INDEX) {
4132+
rcu_read_lock();
4133+
real_dev = bond_option_active_slave_get_rcu(bond);
4134+
rcu_read_unlock();
4135+
if (real_dev) {
4136+
strscpy_pad(ifrr.ifr_name, real_dev->name, IFNAMSIZ);
4137+
ifrr.ifr_ifru = ifr->ifr_ifru;
4138+
4139+
ops = real_dev->netdev_ops;
4140+
if (netif_device_present(real_dev) && ops->ndo_eth_ioctl) {
4141+
res = ops->ndo_eth_ioctl(real_dev, &ifrr, cmd);
41334142

4134-
ops = real_dev->netdev_ops;
4135-
if (netif_device_present(real_dev) && ops->ndo_eth_ioctl)
4136-
res = ops->ndo_eth_ioctl(real_dev, &ifrr, cmd);
4143+
if (!res)
4144+
ifr->ifr_ifru = ifrr.ifr_ifru;
41374145

4138-
if (!res)
4139-
ifr->ifr_ifru = ifrr.ifr_ifru;
4146+
return res;
4147+
}
4148+
}
41404149
}
4141-
break;
4150+
fallthrough;
41424151
default:
41434152
res = -EOPNOTSUPP;
41444153
}

drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ static int hellcreek_set_hwtstamp_config(struct hellcreek *hellcreek, int port,
5252
*/
5353
clear_bit_unlock(HELLCREEK_HWTSTAMP_ENABLED, &ps->state);
5454

55-
/* Reserved for future extensions */
56-
if (config->flags)
57-
return -EINVAL;
58-
5955
switch (config->tx_type) {
6056
case HWTSTAMP_TX_ON:
6157
tx_tstamp_enable = true;

drivers/net/dsa/mv88e6xxx/hwtstamp.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ static int mv88e6xxx_set_hwtstamp_config(struct mv88e6xxx_chip *chip, int port,
100100
*/
101101
clear_bit_unlock(MV88E6XXX_HWTSTAMP_ENABLED, &ps->state);
102102

103-
/* reserved for future extensions */
104-
if (config->flags)
105-
return -EINVAL;
106-
107103
switch (config->tx_type) {
108104
case HWTSTAMP_TX_OFF:
109105
tstamp_enable = false;

drivers/net/ethernet/amd/xgbe/xgbe-drv.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,9 +1508,6 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
15081508
if (copy_from_user(&config, ifreq->ifr_data, sizeof(config)))
15091509
return -EFAULT;
15101510

1511-
if (config.flags)
1512-
return -EINVAL;
1513-
15141511
mac_tscr = 0;
15151512

15161513
switch (config.tx_type) {

drivers/net/ethernet/aquantia/atlantic/aq_main.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,6 @@ static void aq_ndev_set_multicast_settings(struct net_device *ndev)
231231
static int aq_ndev_config_hwtstamp(struct aq_nic_s *aq_nic,
232232
struct hwtstamp_config *config)
233233
{
234-
if (config->flags)
235-
return -EINVAL;
236-
237234
switch (config->tx_type) {
238235
case HWTSTAMP_TX_OFF:
239236
case HWTSTAMP_TX_ON:

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15356,11 +15356,6 @@ static int bnx2x_hwtstamp_ioctl(struct bnx2x *bp, struct ifreq *ifr)
1535615356
DP(BNX2X_MSG_PTP, "Requested tx_type: %d, requested rx_filters = %d\n",
1535715357
config.tx_type, config.rx_filter);
1535815358

15359-
if (config.flags) {
15360-
BNX2X_ERR("config.flags is reserved for future use\n");
15361-
return -EINVAL;
15362-
}
15363-
1536415359
bp->hwtstamp_ioctl_called = true;
1536515360
bp->tx_type = config.tx_type;
1536615361
bp->rx_filter = config.rx_filter;

drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,6 @@ int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
417417
if (copy_from_user(&stmpconf, ifr->ifr_data, sizeof(stmpconf)))
418418
return -EFAULT;
419419

420-
if (stmpconf.flags)
421-
return -EINVAL;
422-
423420
if (stmpconf.tx_type != HWTSTAMP_TX_ON &&
424421
stmpconf.tx_type != HWTSTAMP_TX_OFF)
425422
return -ERANGE;

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13806,9 +13806,6 @@ static int tg3_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
1380613806
if (copy_from_user(&stmpconf, ifr->ifr_data, sizeof(stmpconf)))
1380713807
return -EFAULT;
1380813808

13809-
if (stmpconf.flags)
13810-
return -EINVAL;
13811-
1381213809
if (stmpconf.tx_type != HWTSTAMP_TX_ON &&
1381313810
stmpconf.tx_type != HWTSTAMP_TX_OFF)
1381413811
return -ERANGE;

drivers/net/ethernet/cadence/macb_ptp.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,6 @@ int gem_set_hwtst(struct net_device *dev, struct ifreq *ifr, int cmd)
464464
sizeof(*tstamp_config)))
465465
return -EFAULT;
466466

467-
/* reserved for future extensions */
468-
if (tstamp_config->flags)
469-
return -EINVAL;
470-
471467
switch (tstamp_config->tx_type) {
472468
case HWTSTAMP_TX_OFF:
473469
break;

drivers/net/ethernet/cavium/liquidio/lio_main.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,9 +2114,6 @@ static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr)
21142114
if (copy_from_user(&conf, ifr->ifr_data, sizeof(conf)))
21152115
return -EFAULT;
21162116

2117-
if (conf.flags)
2118-
return -EINVAL;
2119-
21202117
switch (conf.tx_type) {
21212118
case HWTSTAMP_TX_ON:
21222119
case HWTSTAMP_TX_OFF:

0 commit comments

Comments
 (0)