hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/net/ethernet/ibm/ibmvnic.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /**************************************************************************/
23 /* */
34 /* IBM System i and System p Virtual NIC Device Driver */
....@@ -6,18 +7,6 @@
67 /* Thomas Falcon (tlfalcon@linux.vnet.ibm.com) */
78 /* John Allen (jallen@linux.vnet.ibm.com) */
89 /* */
9
-/* This program is free software; you can redistribute it and/or modify */
10
-/* it under the terms of the GNU General Public License as published by */
11
-/* the Free Software Foundation; either version 2 of the License, or */
12
-/* (at your option) any later version. */
13
-/* */
14
-/* This program is distributed in the hope that it will be useful, */
15
-/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
16
-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
17
-/* GNU General Public License for more details. */
18
-/* */
19
-/* You should have received a copy of the GNU General Public License */
20
-/* along with this program. */
2110 /* */
2211 /* This module contains the implementation of a virtual ethernet device */
2312 /* for use with IBM i/pSeries LPAR Linux. It utilizes the logical LAN */
....@@ -31,6 +20,7 @@
3120 #define IBMVNIC_INVALID_MAP -1
3221 #define IBMVNIC_STATS_TIMEOUT 1
3322 #define IBMVNIC_INIT_FAILED 2
23
+#define IBMVNIC_OPEN_FAILED 3
3424
3525 /* basic structures plus 100 2k buffers */
3626 #define IBMVNIC_IO_ENTITLEMENT_DEFAULT 610305
....@@ -39,7 +29,8 @@
3929 #define IBMVNIC_RX_WEIGHT 16
4030 /* when changing this, update IBMVNIC_IO_ENTITLEMENT_DEFAULT */
4131 #define IBMVNIC_BUFFS_PER_POOL 100
42
-#define IBMVNIC_MAX_QUEUES 10
32
+#define IBMVNIC_MAX_QUEUES 16
33
+#define IBMVNIC_MAX_QUEUE_SZ 4096
4334
4435 #define IBMVNIC_TSO_BUF_SZ 65536
4536 #define IBMVNIC_TSO_BUFS 64
....@@ -47,6 +38,8 @@
4738
4839 #define IBMVNIC_MAX_LTB_SIZE ((1 << (MAX_ORDER - 1)) * PAGE_SIZE)
4940 #define IBMVNIC_BUFFER_HLEN 500
41
+
42
+#define IBMVNIC_RESET_DELAY 100
5043
5144 struct ibmvnic_login_buffer {
5245 __be32 len;
....@@ -371,11 +364,16 @@
371364 u8 flags2;
372365 #define IBMVNIC_LOGICAL_LNK_ACTIVE 0x80
373366 __be32 speed;
374
-#define IBMVNIC_AUTONEG 0x80
375
-#define IBMVNIC_10MBPS 0x40
376
-#define IBMVNIC_100MBPS 0x20
377
-#define IBMVNIC_1GBPS 0x10
378
-#define IBMVNIC_10GBPS 0x08
367
+#define IBMVNIC_AUTONEG 0x80000000
368
+#define IBMVNIC_10MBPS 0x40000000
369
+#define IBMVNIC_100MBPS 0x20000000
370
+#define IBMVNIC_1GBPS 0x10000000
371
+#define IBMVNIC_10GBPS 0x08000000
372
+#define IBMVNIC_40GBPS 0x04000000
373
+#define IBMVNIC_100GBPS 0x02000000
374
+#define IBMVNIC_25GBPS 0x01000000
375
+#define IBMVNIC_50GBPS 0x00800000
376
+#define IBMVNIC_200GBPS 0x00400000
379377 __be32 mtu;
380378 struct ibmvnic_rc rc;
381379 } __packed __aligned(8);
....@@ -844,6 +842,7 @@
844842 dma_addr_t msg_token;
845843 spinlock_t lock;
846844 bool active;
845
+ char name[32];
847846 };
848847
849848 union sub_crq {
....@@ -870,6 +869,8 @@
870869 struct sk_buff *rx_skb_top;
871870 struct ibmvnic_adapter *adapter;
872871 atomic_t used;
872
+ char name[32];
873
+ u64 handle;
873874 };
874875
875876 struct ibmvnic_long_term_buff {
....@@ -956,7 +957,6 @@
956957 u64 rx_entries;
957958 u64 tx_entries;
958959 u64 mtu;
959
- struct sockaddr mac;
960960 };
961961
962962 struct ibmvnic_adapter {
....@@ -992,6 +992,9 @@
992992 int phys_link_state;
993993 int logical_link_state;
994994
995
+ u32 speed;
996
+ u8 duplex;
997
+
995998 /* login data */
996999 struct ibmvnic_login_buffer *login_buf;
9971000 dma_addr_t login_buf_token;
....@@ -1018,6 +1021,8 @@
10181021 int init_done_rc;
10191022
10201023 struct completion fw_done;
1024
+ /* Used for serialization of device commands */
1025
+ struct mutex fw_lock;
10211026 int fw_done_rc;
10221027
10231028 struct completion reset_done;
....@@ -1064,20 +1069,30 @@
10641069 u32 num_active_rx_napi;
10651070 u32 num_active_tx_scrqs;
10661071 u32 num_active_tx_pools;
1072
+ u32 cur_rx_buf_sz;
10671073
10681074 struct tasklet_struct tasklet;
10691075 enum vnic_state state;
10701076 enum ibmvnic_reset_reason reset_reason;
1077
+ /* when taking both state and rwi locks, take state lock first */
10711078 spinlock_t rwi_lock;
10721079 struct list_head rwi_list;
10731080 struct work_struct ibmvnic_reset;
1074
- bool resetting;
1081
+ struct delayed_work ibmvnic_delayed_reset;
1082
+ unsigned long resetting;
10751083 bool napi_enabled, from_passive_init;
1084
+ bool login_pending;
1085
+ /* last device reset time */
1086
+ unsigned long last_reset_time;
10761087
1077
- bool mac_change_pending;
10781088 bool failover_pending;
10791089 bool force_reset_recovery;
10801090
10811091 struct ibmvnic_tunables desired;
10821092 struct ibmvnic_tunables fallback;
1093
+
1094
+ /* Used for serialization of state field. When taking both state
1095
+ * and rwi locks, take state lock first.
1096
+ */
1097
+ spinlock_t state_lock;
10831098 };