.. | .. |
---|
386 | 386 | } |
---|
387 | 387 | NETDEVICE_SHOW_RW(tx_queue_len, fmt_dec); |
---|
388 | 388 | |
---|
| 389 | +#ifdef CONFIG_NET_OOB |
---|
| 390 | + |
---|
| 391 | +__weak int netif_oob_switch_port(struct net_device *dev, bool enabled) |
---|
| 392 | +{ |
---|
| 393 | + return 0; |
---|
| 394 | +} |
---|
| 395 | + |
---|
| 396 | +__weak bool netif_oob_get_port(struct net_device *dev) |
---|
| 397 | +{ |
---|
| 398 | + return false; |
---|
| 399 | +} |
---|
| 400 | + |
---|
| 401 | +__weak ssize_t netif_oob_query_pool(struct net_device *dev, char *buf) |
---|
| 402 | +{ |
---|
| 403 | + return -EIO; |
---|
| 404 | +} |
---|
| 405 | + |
---|
| 406 | +static int switch_oob_port(struct net_device *dev, unsigned long enable) |
---|
| 407 | +{ |
---|
| 408 | + return netif_oob_switch_port(dev, (bool)enable); |
---|
| 409 | +} |
---|
| 410 | + |
---|
| 411 | +static ssize_t oob_port_store(struct device *dev, struct device_attribute *attr, |
---|
| 412 | + const char *buf, size_t len) |
---|
| 413 | +{ |
---|
| 414 | + return netdev_store(dev, attr, buf, len, switch_oob_port); |
---|
| 415 | +} |
---|
| 416 | + |
---|
| 417 | +static ssize_t oob_port_show(struct device *dev, |
---|
| 418 | + struct device_attribute *attr, char *buf) |
---|
| 419 | +{ |
---|
| 420 | + struct net_device *netdev = to_net_dev(dev); |
---|
| 421 | + |
---|
| 422 | + return sprintf(buf, fmt_dec, netif_oob_get_port(netdev)); |
---|
| 423 | +} |
---|
| 424 | +static DEVICE_ATTR_RW(oob_port); |
---|
| 425 | + |
---|
| 426 | +static ssize_t oob_pool_show(struct device *dev, |
---|
| 427 | + struct device_attribute *attr, char *buf) |
---|
| 428 | +{ |
---|
| 429 | + struct net_device *netdev = to_net_dev(dev); |
---|
| 430 | + |
---|
| 431 | + return netif_oob_query_pool(netdev, buf); |
---|
| 432 | +} |
---|
| 433 | +static DEVICE_ATTR_RO(oob_pool); |
---|
| 434 | + |
---|
| 435 | +#endif |
---|
| 436 | + |
---|
389 | 437 | static int change_gro_flush_timeout(struct net_device *dev, unsigned long val) |
---|
390 | 438 | { |
---|
391 | 439 | WRITE_ONCE(dev->gro_flush_timeout, val); |
---|
.. | .. |
---|
619 | 667 | &dev_attr_proto_down.attr, |
---|
620 | 668 | &dev_attr_carrier_up_count.attr, |
---|
621 | 669 | &dev_attr_carrier_down_count.attr, |
---|
| 670 | +#ifdef CONFIG_NET_OOB |
---|
| 671 | + &dev_attr_oob_port.attr, |
---|
| 672 | + &dev_attr_oob_pool.attr, |
---|
| 673 | +#endif |
---|
622 | 674 | NULL, |
---|
623 | 675 | }; |
---|
624 | 676 | ATTRIBUTE_GROUPS(net_class); |
---|