@@ -1057,7 +1057,7 @@ static void ssip_pn_setup(struct net_device *dev)
{
static const u8 addr = PN_MEDIA_SOS;
- dev->features = 0;
+ netdev_active_features_zero(dev);
dev->netdev_ops = &ssip_pn_ops;
dev->type = ARPHRD_PHONET;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
@@ -11,6 +11,7 @@
#include <linux/types.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
+#include <linux/netdev_feature_helpers.h>
#include <linux/rtnetlink.h>
#include <linux/tty.h>
#include <linux/file.h>
@@ -398,7 +399,7 @@ static void caifdev_setup(struct net_device *dev)
{
struct ser_device *serdev = netdev_priv(dev);
- dev->features = 0;
+ netdev_active_features_zero(dev);
dev->netdev_ops = &netdev_ops;
dev->type = ARPHRD_CAIF;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
@@ -4014,7 +4014,9 @@ static u32 ena_calc_max_io_queue_num(struct pci_dev *pdev,
static void ena_set_dev_offloads(struct ena_com_dev_get_features_ctx *feat,
struct net_device *netdev)
{
- netdev_features_t dev_features = 0;
+ netdev_features_t dev_features;
+
+ netdev_features_zero(dev_features);
/* Set offload features */
if (feat->offload.tx &
@@ -2359,7 +2359,7 @@ static int b44_init_one(struct ssb_device *sdev,
SET_NETDEV_DEV(dev, sdev->dev);
/* No interesting netdevice features in this card... */
- dev->features |= 0;
+ dev->features |= netdev_empty_features;
bp = netdev_priv(dev);
bp->sdev = sdev;
@@ -17552,13 +17552,13 @@ static void tg3_init_coal(struct tg3 *tp)
static int tg3_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
+ netdev_features_t features;
struct net_device *dev;
struct tg3 *tp;
int i, err;
u32 sndmbx, rcvmbx, intmbx;
char str[40];
u64 dma_mask, persist_dma_mask;
- netdev_features_t features = 0;
u8 addr[ETH_ALEN] __aligned(2);
err = pci_enable_device(pdev);
@@ -17698,6 +17698,8 @@ static int tg3_init_one(struct pci_dev *pdev,
} else
persist_dma_mask = dma_mask = DMA_BIT_MASK(64);
+ netdev_features_zero(features);
+
/* Configure DMA attributes. */
if (dma_mask > DMA_BIT_MASK(32)) {
err = dma_set_mask(&pdev->dev, dma_mask);
@@ -763,7 +763,7 @@ static int dnet_probe(struct platform_device *pdev)
return -ENOMEM;
/* TODO: Actually, we have some interesting features... */
- dev->features |= 0;
+ dev->features |= netdev_empty_features;
bp = netdev_priv(dev);
bp->dev = dev;
@@ -16,6 +16,7 @@
#include <linux/init.h>
#include <linux/netdevice.h>
+#include <linux/netdev_feature_helpers.h>
#include <linux/etherdevice.h>
#include <linux/ip.h>
#include <linux/skbuff.h>
@@ -525,7 +526,7 @@ static int ec_bhf_probe(struct pci_dev *dev, const struct pci_device_id *id)
pci_set_drvdata(dev, net_dev);
SET_NETDEV_DEV(net_dev, &dev->dev);
- net_dev->features = 0;
+ netdev_active_features_zero(net_dev);
net_dev->flags |= IFF_NOARP;
net_dev->netdev_ops = &ec_bhf_netdev_ops;
@@ -4025,7 +4025,7 @@ static int be_vxlan_unset_port(struct net_device *netdev, unsigned int table,
adapter->flags &= ~BE_FLAGS_VXLAN_OFFLOADS;
adapter->vxlan_port = 0;
- netdev->hw_enc_features = 0;
+ netdev_hw_enc_features_zero(netdev);
return 0;
}
@@ -1220,7 +1220,7 @@ static int ethoc_probe(struct platform_device *pdev)
/* setup the net_device structure */
netdev->netdev_ops = ðoc_netdev_ops;
netdev->watchdog_timeo = ETHOC_TIMEOUT;
- netdev->features |= 0;
+ netdev->features |= netdev_empty_features;
netdev->ethtool_ops = ðoc_ethtool_ops;
/* setup NAPI */
@@ -1063,10 +1063,11 @@ static int set_features(struct hinic_dev *nic_dev,
{
netdev_features_t changed = force_change ? ~0 : pre_features ^ features;
u32 csum_en = HINIC_RX_CSUM_OFFLOAD_EN;
- netdev_features_t failed_features = 0;
+ netdev_features_t failed_features;
int ret = 0;
int err = 0;
+ netdev_features_zero(failed_features);
if (changed & NETIF_F_TSO) {
ret = hinic_port_set_tso(nic_dev, (features & NETIF_F_TSO) ?
HINIC_TSO_ENABLE : HINIC_TSO_DISABLE);
@@ -1165,6 +1166,7 @@ static int nic_dev_init(struct pci_dev *pdev)
struct net_device *netdev;
struct hinic_hwdev *hwdev;
struct devlink *devlink;
+ netdev_features_t feats;
u8 addr[ETH_ALEN];
int err, num_qps;
@@ -1284,7 +1286,9 @@ static int nic_dev_init(struct pci_dev *pdev)
HINIC_MGMT_MSG_CMD_LINK_ERR_EVENT,
nic_dev, link_err_event);
- err = set_features(nic_dev, 0, nic_dev->netdev->features, true);
+ netdev_features_zero(feats);
+ err = set_features(nic_dev, feats,
+ nic_dev->netdev->features, true);
if (err)
goto err_set_features;
@@ -4836,7 +4836,7 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter)
struct ibmvnic_control_ip_offload_buffer *ctrl_buf = &adapter->ip_offload_ctrl;
struct ibmvnic_query_ip_offload_buffer *buf = &adapter->ip_offload_buf;
struct device *dev = &adapter->vdev->dev;
- netdev_features_t old_hw_features = 0;
+ netdev_features_t old_hw_features;
union ibmvnic_crq crq;
adapter->ip_offload_ctrl_tok =
@@ -4865,9 +4865,10 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter)
ctrl_buf->large_rx_ipv4 = 0;
ctrl_buf->large_rx_ipv6 = 0;
+ netdev_hw_features_zero(old_hw_features);
if (adapter->state != VNIC_PROBING) {
old_hw_features = adapter->netdev->hw_features;
- adapter->netdev->hw_features = 0;
+ netdev_hw_features_zero(adapter->netdev);
}
netdev_hw_features_zero(adapter->netdev);
@@ -4891,8 +4892,9 @@ static void send_control_ip_offload(struct ibmvnic_adapter *adapter)
if (adapter->state == VNIC_PROBING) {
adapter->netdev->features |= adapter->netdev->hw_features;
} else if (old_hw_features != adapter->netdev->hw_features) {
- netdev_features_t tmp = 0;
+ netdev_features_t tmp;
+ netdev_features_zero(tmp);
/* disable features no longer supported */
adapter->netdev->features &= adapter->netdev->hw_features;
/* turn on features now supported if previously enabled */
@@ -2670,9 +2670,14 @@ static void iavf_init_config_adapter(struct iavf_adapter *adapter)
else
iavf_init_rss(adapter);
- if (VLAN_V2_ALLOWED(adapter))
+ if (VLAN_V2_ALLOWED(adapter)) {
+ netdev_features_t feats;
+
+ netdev_features_zero(feats);
/* request initial VLAN offload settings */
- iavf_set_vlan_offload_features(adapter, 0, netdev->features);
+ iavf_set_vlan_offload_features(adapter, feats,
+ netdev->features);
+ }
return;
err_mem:
@@ -3232,14 +3237,16 @@ static void iavf_adminq_task(struct work_struct *work)
if (adapter->netdev_registered ||
!test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
struct net_device *netdev = adapter->netdev;
+ netdev_features_t feats;
rtnl_lock();
netdev_update_features(netdev);
rtnl_unlock();
+ netdev_features_zero(feats);
/* Request VLAN offload settings */
if (VLAN_V2_ALLOWED(adapter))
iavf_set_vlan_offload_features
- (adapter, 0, netdev->features);
+ (adapter, feats, netdev->features);
iavf_set_queue_vlan_tag_loc(adapter);
}
@@ -4441,7 +4448,9 @@ static netdev_features_t iavf_features_check(struct sk_buff *skb,
static netdev_features_t
iavf_get_netdev_vlan_hw_features(struct iavf_adapter *adapter)
{
- netdev_features_t hw_features = 0;
+ netdev_features_t hw_features;
+
+ netdev_features_zero(hw_features);
if (!adapter->vf_res || !adapter->vf_res->vf_cap_flags)
return hw_features;
@@ -4502,8 +4511,9 @@ iavf_get_netdev_vlan_hw_features(struct iavf_adapter *adapter)
static netdev_features_t
iavf_get_netdev_vlan_features(struct iavf_adapter *adapter)
{
- netdev_features_t features = 0;
+ netdev_features_t features;
+ netdev_features_zero(features);
if (!adapter->vf_res || !adapter->vf_res->vf_cap_flags)
return features;
@@ -2087,7 +2087,7 @@ static int mana_probe_port(struct mana_context *ac, int port_idx,
NETIF_F_TSO_BIT, NETIF_F_TSO6_BIT,
NETIF_F_RXHASH_BIT);
ndev->features = ndev->hw_features;
- ndev->vlan_features = 0;
+ netdev_vlan_features_zero(ndev);
err = register_netdev(ndev);
if (err) {
@@ -1304,7 +1304,7 @@ static void efx_ef10_fini_nic(struct efx_nic *efx)
static int efx_ef10_init_nic(struct efx_nic *efx)
{
struct efx_ef10_nic_data *nic_data = efx->nic_data;
- netdev_features_t hw_enc_features = 0;
+ netdev_features_t hw_enc_features;
int rc;
if (nic_data->must_check_datapath_caps) {
@@ -1349,6 +1349,7 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
nic_data->must_restore_piobufs = false;
}
+ netdev_features_zero(hw_enc_features);
/* add encapsulated checksum offload features */
if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx))
hw_enc_features |= netdev_ip_csum_features;
@@ -938,13 +938,14 @@ static int tap_ioctl_set_queue(struct file *file, unsigned int flags)
static int set_offload(struct tap_queue *q, unsigned long arg)
{
struct tap_dev *tap;
+ netdev_features_t feature_mask;
netdev_features_t features;
- netdev_features_t feature_mask = 0;
tap = rtnl_dereference(q->tap);
if (!tap)
return -ENOLINK;
+ netdev_features_zero(feature_mask);
features = tap->dev->features;
if (arg & TUN_F_CSUM) {
@@ -2858,7 +2858,9 @@ static void tun_get_iff(struct tun_struct *tun, struct ifreq *ifr)
* privs required. */
static int set_offload(struct tun_struct *tun, unsigned long arg)
{
- netdev_features_t features = 0;
+ netdev_features_t features;
+
+ netdev_features_zero(features);
if (arg & TUN_F_CSUM) {
features |= NETIF_F_HW_CSUM;
@@ -14,6 +14,7 @@
#include <linux/usb.h>
#include <linux/usb/cdc.h>
#include <linux/netdevice.h>
+#include <linux/netdev_feature_helpers.h>
#include <linux/if_arp.h>
#include <linux/if_phonet.h>
#include <linux/phonet.h>
@@ -277,7 +278,7 @@ static void usbpn_setup(struct net_device *dev)
{
const u8 addr = PN_MEDIA_USB;
- dev->features = 0;
+ netdev_active_features_zero(dev);
dev->netdev_ops = &usbpn_ops;
dev->header_ops = &phonet_header_ops;
dev->type = ARPHRD_PHONET;
@@ -3457,7 +3457,7 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
INIT_WORK(&pdata->set_vlan, lan78xx_deferred_vlan_write);
- dev->net->features = 0;
+ netdev_active_features_zero(dev->net);
if (DEFAULT_TX_CSUM_ENABLE)
dev->net->features |= NETIF_F_HW_CSUM;
@@ -6864,8 +6864,9 @@ netdev_features_t qeth_features_check(struct sk_buff *skb,
/* Traffic with local next-hop is not eligible for some offloads: */
if (skb->ip_summed == CHECKSUM_PARTIAL &&
READ_ONCE(card->options.isolation) != ISOLATION_MODE_FWD) {
- netdev_features_t restricted = 0;
+ netdev_features_t restricted;
+ netdev_features_zero(restricted);
if (skb_is_gso(skb) && !netif_needs_gso(skb, features))
restricted |= NETIF_F_ALL_TSO;
@@ -14,6 +14,7 @@
#include <linux/device.h>
#include <linux/netdevice.h>
+#include <linux/netdev_feature_helpers.h>
#include <linux/if_ether.h>
#include <linux/if_phonet.h>
#include <linux/if_arp.h>
@@ -269,7 +270,7 @@ static void pn_net_setup(struct net_device *dev)
{
const u8 addr = PN_MEDIA_USB;
- dev->features = 0;
+ netdev_active_features_zero(dev);
dev->type = ARPHRD_PHONET;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
dev->mtu = PHONET_DEV_MTU;
@@ -16,6 +16,7 @@
#include <linux/skbuff.h>
#include <linux/win_minmax.h>
+#include <linux/netdev_feature_helpers.h>
#include <net/sock.h>
#include <net/inet_connection_sock.h>
#include <net/inet_timewait_sock.h>
@@ -158,7 +158,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
*/
dccp_set_state(sk, DCCP_CLOSED);
ip_rt_put(rt);
- sk->sk_route_caps = 0;
+ netdev_features_zero(sk->sk_route_caps);
inet->inet_dport = 0;
goto out;
}
@@ -989,7 +989,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
__sk_dst_reset(sk);
failure:
inet->inet_dport = 0;
- sk->sk_route_caps = 0;
+ netdev_features_zero(sk->sk_route_caps);
return err;
}
@@ -125,7 +125,8 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
{
struct ethtool_sfeatures cmd;
struct ethtool_set_features_block features[ETHTOOL_DEV_FEATURE_WORDS];
- netdev_features_t wanted = 0, valid = 0;
+ netdev_features_t wanted;
+ netdev_features_t valid;
netdev_features_t tmp;
int i, ret = 0;
@@ -139,6 +140,8 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
if (copy_from_user(features, useraddr, sizeof(features)))
return -EFAULT;
+ netdev_features_zero(wanted);
+ netdev_features_zero(valid);
for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
valid |= (netdev_features_t)features[i].valid << (32 * i);
wanted |= (netdev_features_t)features[i].requested << (32 * i);
@@ -325,13 +328,15 @@ static u32 __ethtool_get_flags(struct net_device *dev)
static int __ethtool_set_flags(struct net_device *dev, u32 data)
{
- netdev_features_t features = 0, changed;
netdev_features_t eth_all_features;
+ netdev_features_t features;
+ netdev_features_t changed;
netdev_features_t tmp;
if (data & ~ETH_ALL_FLAGS)
return -EINVAL;
+ netdev_features_zero(features);
if (data & ETH_FLAG_LRO)
features |= NETIF_F_LRO;
if (data & ETH_FLAG_RXVLAN)
@@ -1313,7 +1313,7 @@ int inet_sk_rebuild_header(struct sock *sk)
err = PTR_ERR(rt);
/* Routing failed... */
- sk->sk_route_caps = 0;
+ netdev_features_zero(sk->sk_route_caps);
/*
* Other protocols have to map its equivalent state to TCP_SYN_SENT.
* DCCP maps its DCCP_REQUESTING state to TCP_SYN_SENT. -acme
@@ -1193,7 +1193,7 @@ static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg,
if (err) {
tcp_set_state(sk, TCP_CLOSE);
inet->inet_dport = 0;
- sk->sk_route_caps = 0;
+ netdev_features_zero(sk->sk_route_caps);
}
}
flags = (msg->msg_flags & MSG_DONTWAIT) ? O_NONBLOCK : 0;
@@ -343,7 +343,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
*/
tcp_set_state(sk, TCP_CLOSE);
ip_rt_put(rt);
- sk->sk_route_caps = 0;
+ netdev_features_zero(sk->sk_route_caps);
inet->inet_dport = 0;
return err;
}
@@ -846,7 +846,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl6, final_p);
if (IS_ERR(dst)) {
- sk->sk_route_caps = 0;
+ netdev_features_zero(sk->sk_route_caps);
sk->sk_err_soft = -PTR_ERR(dst);
return PTR_ERR(dst);
}
@@ -121,7 +121,7 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused
dst = inet6_csk_route_socket(sk, &fl6);
if (IS_ERR(dst)) {
sk->sk_err_soft = -PTR_ERR(dst);
- sk->sk_route_caps = 0;
+ netdev_features_zero(sk->sk_route_caps);
kfree_skb(skb);
return PTR_ERR(dst);
}
@@ -359,7 +359,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
tcp_set_state(sk, TCP_CLOSE);
failure:
inet->inet_dport = 0;
- sk->sk_route_caps = 0;
+ netdev_features_zero(sk->sk_route_caps);
return err;
}
@@ -417,6 +417,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
struct ovs_header *upcall;
struct sk_buff *nskb = NULL;
struct sk_buff *user_skb = NULL; /* to be queued to userspace */
+ netdev_features_t feats;
struct nlattr *nla;
size_t len;
unsigned int hlen;
@@ -444,9 +445,10 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
goto out;
}
+ netdev_features_zero(feats);
/* Complete checksum if needed */
if (skb->ip_summed == CHECKSUM_PARTIAL &&
- (err = skb_csum_hwoffload_help(skb, 0)))
+ (err = skb_csum_hwoffload_help(skb, feats)))
goto out;
/* Older versions of OVS user space enforce alignment of the last
For the prototype of netdev_features_t will be changed from u64 to structure, so it's unable to assignment with 0 directly. Replace it with netdev_features_zero helpers. Signed-off-by: Jian Shen <shenjian15@huawei.com> --- drivers/hsi/clients/ssi_protocol.c | 2 +- drivers/net/caif/caif_serial.c | 3 ++- drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 +++- drivers/net/ethernet/broadcom/b44.c | 2 +- drivers/net/ethernet/broadcom/tg3.c | 4 +++- drivers/net/ethernet/dnet.c | 2 +- drivers/net/ethernet/ec_bhf.c | 3 ++- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- drivers/net/ethernet/ethoc.c | 2 +- .../net/ethernet/huawei/hinic/hinic_main.c | 8 ++++++-- drivers/net/ethernet/ibm/ibmvnic.c | 8 +++++--- drivers/net/ethernet/intel/iavf/iavf_main.c | 20 ++++++++++++++----- drivers/net/ethernet/microsoft/mana/mana_en.c | 2 +- drivers/net/ethernet/sfc/ef10.c | 3 ++- drivers/net/tap.c | 3 ++- drivers/net/tun.c | 4 +++- drivers/net/usb/cdc-phonet.c | 3 ++- drivers/net/usb/lan78xx.c | 2 +- drivers/s390/net/qeth_core_main.c | 3 ++- drivers/usb/gadget/function/f_phonet.c | 3 ++- include/linux/tcp.h | 1 + net/dccp/ipv4.c | 2 +- net/dccp/ipv6.c | 2 +- net/ethtool/ioctl.c | 9 +++++++-- net/ipv4/af_inet.c | 2 +- net/ipv4/tcp.c | 2 +- net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/af_inet6.c | 2 +- net/ipv6/inet6_connection_sock.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- net/openvswitch/datapath.c | 4 +++- 31 files changed, 75 insertions(+), 38 deletions(-)