forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/net/ethernet/emulex/benet/be_main.c
....@@ -1,11 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2005 - 2016 Broadcom
34 * All rights reserved.
4
- *
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License version 2
7
- * as published by the Free Software Foundation. The full GNU General
8
- * Public License is included in this distribution in the file called COPYING.
95 *
106 * Contact Information:
117 * linux-drivers@emulex.com
....@@ -25,8 +21,7 @@
2521 #include <net/busy_poll.h>
2622 #include <net/vxlan.h>
2723
28
-MODULE_VERSION(DRV_VER);
29
-MODULE_DESCRIPTION(DRV_DESC " " DRV_VER);
24
+MODULE_DESCRIPTION(DRV_DESC);
3025 MODULE_AUTHOR("Emulex Corporation");
3126 MODULE_LICENSE("GPL");
3227
....@@ -167,8 +162,8 @@
167162 q->len = len;
168163 q->entry_size = entry_size;
169164 mem->size = len * entry_size;
170
- mem->va = dma_zalloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma,
171
- GFP_KERNEL);
165
+ mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size,
166
+ &mem->dma, GFP_KERNEL);
172167 if (!mem->va)
173168 return -ENOMEM;
174169 return 0;
....@@ -796,7 +791,7 @@
796791 u16 vlan_tag;
797792
798793 vlan_tag = skb_vlan_tag_get(skb);
799
- vlan_prio = (vlan_tag & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
794
+ vlan_prio = skb_vlan_tag_get_prio(skb);
800795 /* If vlan priority provided by OS is NOT in available bmap */
801796 if (!(adapter->vlan_prio_bmap & (1 << vlan_prio)))
802797 vlan_tag = (vlan_tag & ~VLAN_PRIO_MASK) |
....@@ -1018,7 +1013,7 @@
10181013 }
10191014
10201015 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1021
- const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
1016
+ const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
10221017 len = skb_frag_size(frag);
10231018
10241019 busaddr = skb_frag_dma_map(dev, frag, 0, len, DMA_TO_DEVICE);
....@@ -1049,30 +1044,35 @@
10491044 struct be_wrb_params
10501045 *wrb_params)
10511046 {
1047
+ bool insert_vlan = false;
10521048 u16 vlan_tag = 0;
10531049
10541050 skb = skb_share_check(skb, GFP_ATOMIC);
10551051 if (unlikely(!skb))
10561052 return skb;
10571053
1058
- if (skb_vlan_tag_present(skb))
1054
+ if (skb_vlan_tag_present(skb)) {
10591055 vlan_tag = be_get_tx_vlan_tag(adapter, skb);
1056
+ insert_vlan = true;
1057
+ }
10601058
10611059 if (qnq_async_evt_rcvd(adapter) && adapter->pvid) {
1062
- if (!vlan_tag)
1060
+ if (!insert_vlan) {
10631061 vlan_tag = adapter->pvid;
1062
+ insert_vlan = true;
1063
+ }
10641064 /* f/w workaround to set skip_hw_vlan = 1, informs the F/W to
10651065 * skip VLAN insertion
10661066 */
10671067 BE_WRB_F_SET(wrb_params->features, VLAN_SKIP_HW, 1);
10681068 }
10691069
1070
- if (vlan_tag) {
1070
+ if (insert_vlan) {
10711071 skb = vlan_insert_tag_set_proto(skb, htons(ETH_P_8021Q),
10721072 vlan_tag);
10731073 if (unlikely(!skb))
10741074 return skb;
1075
- skb->vlan_tci = 0;
1075
+ __vlan_hwaccel_clear_tag(skb);
10761076 }
10771077
10781078 /* Insert the outer VLAN, if any */
....@@ -1136,10 +1136,11 @@
11361136 eth_hdr_len = ntohs(skb->protocol) == ETH_P_8021Q ?
11371137 VLAN_ETH_HLEN : ETH_HLEN;
11381138 if (skb->len <= 60 &&
1139
- (lancer_chip(adapter) || skb_vlan_tag_present(skb)) &&
1140
- is_ipv4_pkt(skb)) {
1139
+ (lancer_chip(adapter) || BE3_chip(adapter) ||
1140
+ skb_vlan_tag_present(skb)) && is_ipv4_pkt(skb)) {
11411141 ip = (struct iphdr *)ip_hdr(skb);
1142
- pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len));
1142
+ if (unlikely(pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len))))
1143
+ goto tx_drop;
11431144 }
11441145
11451146 /* If vlan tag is already inlined in the packet, skip HW VLAN
....@@ -1265,10 +1266,6 @@
12651266 #define is_arp_allowed_on_bmc(adapter, skb) \
12661267 (is_arp(skb) && is_arp_filt_enabled(adapter))
12671268
1268
-#define is_broadcast_packet(eh, adapter) \
1269
- (is_multicast_ether_addr(eh->h_dest) && \
1270
- !compare_ether_addr(eh->h_dest, adapter->netdev->broadcast))
1271
-
12721269 #define is_arp(skb) (skb->protocol == htons(ETH_P_ARP))
12731270
12741271 #define is_arp_filt_enabled(adapter) \
....@@ -1375,7 +1372,7 @@
13751372 u16 q_idx = skb_get_queue_mapping(skb);
13761373 struct be_tx_obj *txo = &adapter->tx_obj[q_idx];
13771374 struct be_wrb_params wrb_params = { 0 };
1378
- bool flush = !skb->xmit_more;
1375
+ bool flush = !netdev_xmit_more();
13791376 u16 wrb_cnt;
13801377
13811378 skb = be_xmit_workarounds(adapter, skb, &wrb_params);
....@@ -1420,7 +1417,7 @@
14201417 return NETDEV_TX_OK;
14211418 }
14221419
1423
-static void be_tx_timeout(struct net_device *netdev)
1420
+static void be_tx_timeout(struct net_device *netdev, unsigned int txqueue)
14241421 {
14251422 struct be_adapter *adapter = netdev_priv(netdev);
14261423 struct device *dev = &adapter->pdev->dev;
....@@ -2150,7 +2147,7 @@
21502147 int i;
21512148
21522149 aic = &adapter->aic_obj[eqo->idx];
2153
- if (!aic->enable) {
2150
+ if (!adapter->aic_enabled) {
21542151 if (aic->jiffies)
21552152 aic->jiffies = 0;
21562153 eqd = aic->et_eqd;
....@@ -2207,7 +2204,7 @@
22072204 int eqd;
22082205 u32 mult_enc;
22092206
2210
- if (!aic->enable)
2207
+ if (!adapter->aic_enabled)
22112208 return 0;
22122209
22132210 if (jiffies_to_msecs(now - aic->jiffies) < 1)
....@@ -2349,8 +2346,8 @@
23492346 memcpy(skb->data, start, hdr_len);
23502347 skb_shinfo(skb)->nr_frags = 1;
23512348 skb_frag_set_page(skb, 0, page_info->page);
2352
- skb_shinfo(skb)->frags[0].page_offset =
2353
- page_info->page_offset + hdr_len;
2349
+ skb_frag_off_set(&skb_shinfo(skb)->frags[0],
2350
+ page_info->page_offset + hdr_len);
23542351 skb_frag_size_set(&skb_shinfo(skb)->frags[0],
23552352 curr_frag_len - hdr_len);
23562353 skb->data_len = curr_frag_len - hdr_len;
....@@ -2375,8 +2372,8 @@
23752372 /* Fresh page */
23762373 j++;
23772374 skb_frag_set_page(skb, j, page_info->page);
2378
- skb_shinfo(skb)->frags[j].page_offset =
2379
- page_info->page_offset;
2375
+ skb_frag_off_set(&skb_shinfo(skb)->frags[j],
2376
+ page_info->page_offset);
23802377 skb_frag_size_set(&skb_shinfo(skb)->frags[j], 0);
23812378 skb_shinfo(skb)->nr_frags++;
23822379 } else {
....@@ -2457,8 +2454,8 @@
24572454 /* First frag or Fresh page */
24582455 j++;
24592456 skb_frag_set_page(skb, j, page_info->page);
2460
- skb_shinfo(skb)->frags[j].page_offset =
2461
- page_info->page_offset;
2457
+ skb_frag_off_set(&skb_shinfo(skb)->frags[j],
2458
+ page_info->page_offset);
24622459 skb_frag_size_set(&skb_shinfo(skb)->frags[j], 0);
24632460 } else {
24642461 put_page(page_info->page);
....@@ -2962,6 +2959,8 @@
29622959 max(adapter->cfg_num_rx_irqs,
29632960 adapter->cfg_num_tx_irqs));
29642961
2962
+ adapter->aic_enabled = true;
2963
+
29652964 for_all_evt_queues(adapter, eqo, i) {
29662965 int numa_node = dev_to_node(&adapter->pdev->dev);
29672966
....@@ -2969,7 +2968,6 @@
29692968 eqo->adapter = adapter;
29702969 eqo->idx = i;
29712970 aic->max_eqd = BE_MAX_EQD;
2972
- aic->enable = true;
29732971
29742972 eq = &eqo->q;
29752973 rc = be_queue_alloc(adapter, eq, EVNT_Q_LEN,
....@@ -3832,8 +3830,8 @@
38323830 be_link_status_update(adapter, link_status);
38333831
38343832 netif_tx_start_all_queues(netdev);
3835
- if (skyhawk_chip(adapter))
3836
- udp_tunnel_get_rx_info(netdev);
3833
+
3834
+ udp_tunnel_nic_reset_ntf(netdev);
38373835
38383836 return 0;
38393837 err:
....@@ -3970,17 +3968,22 @@
39703968 }
39713969 }
39723970
3973
-static int be_enable_vxlan_offloads(struct be_adapter *adapter)
3971
+/* VxLAN offload Notes:
3972
+ *
3973
+ * The stack defines tunnel offload flags (hw_enc_features) for IP and doesn't
3974
+ * distinguish various types of transports (VxLAN, GRE, NVGRE ..). So, offload
3975
+ * is expected to work across all types of IP tunnels once exported. Skyhawk
3976
+ * supports offloads for either VxLAN or NVGRE, exclusively. So we export VxLAN
3977
+ * offloads in hw_enc_features only when a VxLAN port is added. If other (non
3978
+ * VxLAN) tunnels are configured while VxLAN offloads are enabled, offloads for
3979
+ * those other tunnels are unexported on the fly through ndo_features_check().
3980
+ */
3981
+static int be_vxlan_set_port(struct net_device *netdev, unsigned int table,
3982
+ unsigned int entry, struct udp_tunnel_info *ti)
39743983 {
3975
- struct net_device *netdev = adapter->netdev;
3984
+ struct be_adapter *adapter = netdev_priv(netdev);
39763985 struct device *dev = &adapter->pdev->dev;
3977
- struct be_vxlan_port *vxlan_port;
3978
- __be16 port;
39793986 int status;
3980
-
3981
- vxlan_port = list_first_entry(&adapter->vxlan_port_list,
3982
- struct be_vxlan_port, list);
3983
- port = vxlan_port->port;
39843987
39853988 status = be_cmd_manage_iface(adapter, adapter->if_handle,
39863989 OP_CONVERT_NORMAL_TO_TUNNEL);
....@@ -3990,25 +3993,26 @@
39903993 }
39913994 adapter->flags |= BE_FLAGS_VXLAN_OFFLOADS;
39923995
3993
- status = be_cmd_set_vxlan_port(adapter, port);
3996
+ status = be_cmd_set_vxlan_port(adapter, ti->port);
39943997 if (status) {
39953998 dev_warn(dev, "Failed to add VxLAN port\n");
39963999 return status;
39974000 }
3998
- adapter->vxlan_port = port;
4001
+ adapter->vxlan_port = ti->port;
39994002
40004003 netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
40014004 NETIF_F_TSO | NETIF_F_TSO6 |
40024005 NETIF_F_GSO_UDP_TUNNEL;
40034006
40044007 dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n",
4005
- be16_to_cpu(port));
4008
+ be16_to_cpu(ti->port));
40064009 return 0;
40074010 }
40084011
4009
-static void be_disable_vxlan_offloads(struct be_adapter *adapter)
4012
+static int be_vxlan_unset_port(struct net_device *netdev, unsigned int table,
4013
+ unsigned int entry, struct udp_tunnel_info *ti)
40104014 {
4011
- struct net_device *netdev = adapter->netdev;
4015
+ struct be_adapter *adapter = netdev_priv(netdev);
40124016
40134017 if (adapter->flags & BE_FLAGS_VXLAN_OFFLOADS)
40144018 be_cmd_manage_iface(adapter, adapter->if_handle,
....@@ -4021,7 +4025,18 @@
40214025 adapter->vxlan_port = 0;
40224026
40234027 netdev->hw_enc_features = 0;
4028
+ return 0;
40244029 }
4030
+
4031
+static const struct udp_tunnel_nic_info be_udp_tunnels = {
4032
+ .set_port = be_vxlan_set_port,
4033
+ .unset_port = be_vxlan_unset_port,
4034
+ .flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP |
4035
+ UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
4036
+ .tables = {
4037
+ { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, },
4038
+ },
4039
+};
40254040
40264041 static void be_calculate_vf_res(struct be_adapter *adapter, u16 num_vfs,
40274042 struct be_resources *vft_res)
....@@ -4138,7 +4153,7 @@
41384153 &vft_res);
41394154 }
41404155
4141
- be_disable_vxlan_offloads(adapter);
4156
+ be_vxlan_unset_port(adapter->netdev, 0, 0, NULL);
41424157
41434158 be_if_destroy(adapter);
41444159
....@@ -4701,8 +4716,13 @@
47014716 int status;
47024717
47034718 if (netif_running(netdev)) {
4719
+ /* be_tx_timeout() must not run concurrently with this
4720
+ * function, synchronize with an already-running dev_watchdog
4721
+ */
4722
+ netif_tx_lock_bh(netdev);
47044723 /* device cannot transmit now, avoid dev_watchdog timeouts */
47054724 netif_carrier_off(netdev);
4725
+ netif_tx_unlock_bh(netdev);
47064726
47074727 be_close(netdev);
47084728 }
....@@ -4954,7 +4974,7 @@
49544974 }
49554975
49564976 static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
4957
- u16 flags)
4977
+ u16 flags, struct netlink_ext_ack *extack)
49584978 {
49594979 struct be_adapter *adapter = netdev_priv(dev);
49604980 struct nlattr *attr, *br_spec;
....@@ -5049,147 +5069,6 @@
50495069 INIT_WORK(&work->work, func);
50505070 work->adapter = adapter;
50515071 return work;
5052
-}
5053
-
5054
-/* VxLAN offload Notes:
5055
- *
5056
- * The stack defines tunnel offload flags (hw_enc_features) for IP and doesn't
5057
- * distinguish various types of transports (VxLAN, GRE, NVGRE ..). So, offload
5058
- * is expected to work across all types of IP tunnels once exported. Skyhawk
5059
- * supports offloads for either VxLAN or NVGRE, exclusively. So we export VxLAN
5060
- * offloads in hw_enc_features only when a VxLAN port is added. If other (non
5061
- * VxLAN) tunnels are configured while VxLAN offloads are enabled, offloads for
5062
- * those other tunnels are unexported on the fly through ndo_features_check().
5063
- *
5064
- * Skyhawk supports VxLAN offloads only for one UDP dport. So, if the stack
5065
- * adds more than one port, disable offloads and re-enable them again when
5066
- * there's only one port left. We maintain a list of ports for this purpose.
5067
- */
5068
-static void be_work_add_vxlan_port(struct work_struct *work)
5069
-{
5070
- struct be_cmd_work *cmd_work =
5071
- container_of(work, struct be_cmd_work, work);
5072
- struct be_adapter *adapter = cmd_work->adapter;
5073
- struct device *dev = &adapter->pdev->dev;
5074
- __be16 port = cmd_work->info.vxlan_port;
5075
- struct be_vxlan_port *vxlan_port;
5076
- int status;
5077
-
5078
- /* Bump up the alias count if it is an existing port */
5079
- list_for_each_entry(vxlan_port, &adapter->vxlan_port_list, list) {
5080
- if (vxlan_port->port == port) {
5081
- vxlan_port->port_aliases++;
5082
- goto done;
5083
- }
5084
- }
5085
-
5086
- /* Add a new port to our list. We don't need a lock here since port
5087
- * add/delete are done only in the context of a single-threaded work
5088
- * queue (be_wq).
5089
- */
5090
- vxlan_port = kzalloc(sizeof(*vxlan_port), GFP_KERNEL);
5091
- if (!vxlan_port)
5092
- goto done;
5093
-
5094
- vxlan_port->port = port;
5095
- INIT_LIST_HEAD(&vxlan_port->list);
5096
- list_add_tail(&vxlan_port->list, &adapter->vxlan_port_list);
5097
- adapter->vxlan_port_count++;
5098
-
5099
- if (adapter->flags & BE_FLAGS_VXLAN_OFFLOADS) {
5100
- dev_info(dev,
5101
- "Only one UDP port supported for VxLAN offloads\n");
5102
- dev_info(dev, "Disabling VxLAN offloads\n");
5103
- goto err;
5104
- }
5105
-
5106
- if (adapter->vxlan_port_count > 1)
5107
- goto done;
5108
-
5109
- status = be_enable_vxlan_offloads(adapter);
5110
- if (!status)
5111
- goto done;
5112
-
5113
-err:
5114
- be_disable_vxlan_offloads(adapter);
5115
-done:
5116
- kfree(cmd_work);
5117
- return;
5118
-}
5119
-
5120
-static void be_work_del_vxlan_port(struct work_struct *work)
5121
-{
5122
- struct be_cmd_work *cmd_work =
5123
- container_of(work, struct be_cmd_work, work);
5124
- struct be_adapter *adapter = cmd_work->adapter;
5125
- __be16 port = cmd_work->info.vxlan_port;
5126
- struct be_vxlan_port *vxlan_port;
5127
-
5128
- /* Nothing to be done if a port alias is being deleted */
5129
- list_for_each_entry(vxlan_port, &adapter->vxlan_port_list, list) {
5130
- if (vxlan_port->port == port) {
5131
- if (vxlan_port->port_aliases) {
5132
- vxlan_port->port_aliases--;
5133
- goto done;
5134
- }
5135
- break;
5136
- }
5137
- }
5138
-
5139
- /* No port aliases left; delete the port from the list */
5140
- list_del(&vxlan_port->list);
5141
- adapter->vxlan_port_count--;
5142
-
5143
- /* Disable VxLAN offload if this is the offloaded port */
5144
- if (adapter->vxlan_port == vxlan_port->port) {
5145
- WARN_ON(adapter->vxlan_port_count);
5146
- be_disable_vxlan_offloads(adapter);
5147
- dev_info(&adapter->pdev->dev,
5148
- "Disabled VxLAN offloads for UDP port %d\n",
5149
- be16_to_cpu(port));
5150
- goto out;
5151
- }
5152
-
5153
- /* If only 1 port is left, re-enable VxLAN offload */
5154
- if (adapter->vxlan_port_count == 1)
5155
- be_enable_vxlan_offloads(adapter);
5156
-
5157
-out:
5158
- kfree(vxlan_port);
5159
-done:
5160
- kfree(cmd_work);
5161
-}
5162
-
5163
-static void be_cfg_vxlan_port(struct net_device *netdev,
5164
- struct udp_tunnel_info *ti,
5165
- void (*func)(struct work_struct *))
5166
-{
5167
- struct be_adapter *adapter = netdev_priv(netdev);
5168
- struct be_cmd_work *cmd_work;
5169
-
5170
- if (ti->type != UDP_TUNNEL_TYPE_VXLAN)
5171
- return;
5172
-
5173
- if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter))
5174
- return;
5175
-
5176
- cmd_work = be_alloc_work(adapter, func);
5177
- if (cmd_work) {
5178
- cmd_work->info.vxlan_port = ti->port;
5179
- queue_work(be_wq, &cmd_work->work);
5180
- }
5181
-}
5182
-
5183
-static void be_del_vxlan_port(struct net_device *netdev,
5184
- struct udp_tunnel_info *ti)
5185
-{
5186
- be_cfg_vxlan_port(netdev, ti, be_work_del_vxlan_port);
5187
-}
5188
-
5189
-static void be_add_vxlan_port(struct net_device *netdev,
5190
- struct udp_tunnel_info *ti)
5191
-{
5192
- be_cfg_vxlan_port(netdev, ti, be_work_add_vxlan_port);
51935072 }
51945073
51955074 static netdev_features_t be_features_check(struct sk_buff *skb,
....@@ -5307,8 +5186,8 @@
53075186 #endif
53085187 .ndo_bridge_setlink = be_ndo_bridge_setlink,
53095188 .ndo_bridge_getlink = be_ndo_bridge_getlink,
5310
- .ndo_udp_tunnel_add = be_add_vxlan_port,
5311
- .ndo_udp_tunnel_del = be_del_vxlan_port,
5189
+ .ndo_udp_tunnel_add = udp_tunnel_nic_add_port,
5190
+ .ndo_udp_tunnel_del = udp_tunnel_nic_del_port,
53125191 .ndo_features_check = be_features_check,
53135192 .ndo_get_phys_port_id = be_get_phys_port_id,
53145193 };
....@@ -5339,6 +5218,9 @@
53395218 netdev->netdev_ops = &be_netdev_ops;
53405219
53415220 netdev->ethtool_ops = &be_ethtool_ops;
5221
+
5222
+ if (!lancer_chip(adapter) && !BEx_chip(adapter) && !be_is_mc(adapter))
5223
+ netdev->udp_tunnel_nic_info = &be_udp_tunnels;
53425224
53435225 /* MTU range: 256 - 9000 */
53445226 netdev->min_mtu = BE_MIN_MTU;
....@@ -5765,9 +5647,9 @@
57655647 int status = 0;
57665648
57675649 mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16;
5768
- mbox_mem_alloc->va = dma_zalloc_coherent(dev, mbox_mem_alloc->size,
5769
- &mbox_mem_alloc->dma,
5770
- GFP_KERNEL);
5650
+ mbox_mem_alloc->va = dma_alloc_coherent(dev, mbox_mem_alloc->size,
5651
+ &mbox_mem_alloc->dma,
5652
+ GFP_KERNEL);
57715653 if (!mbox_mem_alloc->va)
57725654 return -ENOMEM;
57735655
....@@ -5776,8 +5658,8 @@
57765658 mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16);
57775659
57785660 rx_filter->size = sizeof(struct be_cmd_req_rx_filter);
5779
- rx_filter->va = dma_zalloc_coherent(dev, rx_filter->size,
5780
- &rx_filter->dma, GFP_KERNEL);
5661
+ rx_filter->va = dma_alloc_coherent(dev, rx_filter->size,
5662
+ &rx_filter->dma, GFP_KERNEL);
57815663 if (!rx_filter->va) {
57825664 status = -ENOMEM;
57835665 goto free_mbox;
....@@ -5791,8 +5673,8 @@
57915673 stats_cmd->size = sizeof(struct be_cmd_req_get_stats_v1);
57925674 else
57935675 stats_cmd->size = sizeof(struct be_cmd_req_get_stats_v2);
5794
- stats_cmd->va = dma_zalloc_coherent(dev, stats_cmd->size,
5795
- &stats_cmd->dma, GFP_KERNEL);
5676
+ stats_cmd->va = dma_alloc_coherent(dev, stats_cmd->size,
5677
+ &stats_cmd->dma, GFP_KERNEL);
57965678 if (!stats_cmd->va) {
57975679 status = -ENOMEM;
57985680 goto free_rx_filter;
....@@ -5819,7 +5701,6 @@
58195701 /* Must be a power of 2 or else MODULO will BUG_ON */
58205702 adapter->be_get_temp_freq = 64;
58215703
5822
- INIT_LIST_HEAD(&adapter->vxlan_port_list);
58235704 return 0;
58245705
58255706 free_rx_filter:
....@@ -5948,8 +5829,6 @@
59485829 struct net_device *netdev;
59495830 int status = 0;
59505831
5951
- dev_info(&pdev->dev, "%s version is %s\n", DRV_NAME, DRV_VER);
5952
-
59535832 status = pci_enable_device(pdev);
59545833 if (status)
59555834 goto do_none;
....@@ -6040,31 +5919,22 @@
60405919 return status;
60415920 }
60425921
6043
-static int be_suspend(struct pci_dev *pdev, pm_message_t state)
5922
+static int __maybe_unused be_suspend(struct device *dev_d)
60445923 {
6045
- struct be_adapter *adapter = pci_get_drvdata(pdev);
5924
+ struct be_adapter *adapter = dev_get_drvdata(dev_d);
60465925
60475926 be_intr_set(adapter, false);
60485927 be_cancel_err_detection(adapter);
60495928
60505929 be_cleanup(adapter);
60515930
6052
- pci_save_state(pdev);
6053
- pci_disable_device(pdev);
6054
- pci_set_power_state(pdev, pci_choose_state(pdev, state));
60555931 return 0;
60565932 }
60575933
6058
-static int be_pci_resume(struct pci_dev *pdev)
5934
+static int __maybe_unused be_pci_resume(struct device *dev_d)
60595935 {
6060
- struct be_adapter *adapter = pci_get_drvdata(pdev);
5936
+ struct be_adapter *adapter = dev_get_drvdata(dev_d);
60615937 int status = 0;
6062
-
6063
- status = pci_enable_device(pdev);
6064
- if (status)
6065
- return status;
6066
-
6067
- pci_restore_state(pdev);
60685938
60695939 status = be_resume(adapter);
60705940 if (status)
....@@ -6151,7 +6021,6 @@
61516021 if (status)
61526022 return PCI_ERS_RESULT_DISCONNECT;
61536023
6154
- pci_cleanup_aer_uncorrect_error_status(pdev);
61556024 be_clear_error(adapter, BE_CLEAR_ALL);
61566025 return PCI_ERS_RESULT_RECOVERED;
61576026 }
....@@ -6238,13 +6107,14 @@
62386107 .resume = be_eeh_resume,
62396108 };
62406109
6110
+static SIMPLE_DEV_PM_OPS(be_pci_pm_ops, be_suspend, be_pci_resume);
6111
+
62416112 static struct pci_driver be_driver = {
62426113 .name = DRV_NAME,
62436114 .id_table = be_dev_ids,
62446115 .probe = be_probe,
62456116 .remove = be_remove,
6246
- .suspend = be_suspend,
6247
- .resume = be_pci_resume,
6117
+ .driver.pm = &be_pci_pm_ops,
62486118 .shutdown = be_shutdown,
62496119 .sriov_configure = be_pci_sriov_configure,
62506120 .err_handler = &be_eeh_handlers