Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'bnx2x-next'

Yuval Mintz says:

====================
bnx2x: driver updates

This series contains several changes - the biggest change is the
addition of Geneve NDO support [allows device to perform RSS according
to inner-headers of encapsulated packet, similar to what it does for
vxlan]. It also extends dcbx support, as well as introducing some minor
changes.

Dave,

Please consider applying this series to `net-next'.
[Do notice patch #3 fails checkpatch due to consistency with existing
HSI]
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+206 -81
+15 -4
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
··· 1277 1277 BNX2X_SP_RTNL_HYPERVISOR_VLAN, 1278 1278 BNX2X_SP_RTNL_TX_STOP, 1279 1279 BNX2X_SP_RTNL_GET_DRV_VERSION, 1280 - BNX2X_SP_RTNL_ADD_VXLAN_PORT, 1281 - BNX2X_SP_RTNL_DEL_VXLAN_PORT, 1280 + BNX2X_SP_RTNL_CHANGE_UDP_PORT, 1282 1281 }; 1283 1282 1284 1283 enum bnx2x_iov_flag { ··· 1324 1325 struct list_head link; 1325 1326 u16 vid; 1326 1327 bool hw; 1328 + }; 1329 + 1330 + enum bnx2x_udp_port_type { 1331 + BNX2X_UDP_PORT_VXLAN, 1332 + BNX2X_UDP_PORT_GENEVE, 1333 + BNX2X_UDP_PORT_MAX, 1334 + }; 1335 + 1336 + struct bnx2x_udp_tunnel { 1337 + u16 dst_port; 1338 + u8 count; 1327 1339 }; 1328 1340 1329 1341 struct bnx2x { ··· 1840 1830 struct list_head vlan_reg; 1841 1831 u16 vlan_cnt; 1842 1832 u16 vlan_credit; 1843 - u16 vxlan_dst_port; 1844 - u8 vxlan_dst_port_count; 1845 1833 bool accept_any_vlan; 1834 + 1835 + /* Vxlan/Geneve related information */ 1836 + struct bnx2x_udp_tunnel udp_tunnel_ports[BNX2X_UDP_PORT_MAX]; 1846 1837 }; 1847 1838 1848 1839 /* Tx queues may be less or equal to Rx queues */
-1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
··· 5086 5086 flag); 5087 5087 schedule_delayed_work(&bp->sp_rtnl_task, 0); 5088 5088 } 5089 - EXPORT_SYMBOL(bnx2x_schedule_sp_rtnl);
+9 -2
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
··· 923 923 struct bnx2x_func_state_params func_params = {NULL}; 924 924 struct bnx2x_func_start_params *start_params = 925 925 &func_params.params.start; 926 + u16 port; 926 927 927 928 /* Prepare parameters for function state transitions */ 928 929 __set_bit(RAMROD_COMP_WAIT, &func_params.ramrod_flags); ··· 960 959 start_params->network_cos_mode = STATIC_COS; 961 960 else /* CHIP_IS_E1X */ 962 961 start_params->network_cos_mode = FW_WRR; 963 - 964 - start_params->vxlan_dst_port = bp->vxlan_dst_port; 962 + if (bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN].count) { 963 + port = bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN].dst_port; 964 + start_params->vxlan_dst_port = port; 965 + } 966 + if (bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE].count) { 967 + port = bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE].dst_port; 968 + start_params->geneve_dst_port = port; 969 + } 965 970 966 971 start_params->inner_rss = 1; 967 972
+43 -14
drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c
··· 195 195 u32 error) { 196 196 u8 index; 197 197 u32 *ttp = bp->dcbx_port_params.app.traffic_type_priority; 198 + u8 iscsi_pri_found = 0, fcoe_pri_found = 0; 198 199 199 200 if (GET_FLAGS(error, DCBX_LOCAL_APP_ERROR)) 200 201 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_APP_ERROR\n"); ··· 211 210 212 211 bp->dcbx_port_params.app.enabled = true; 213 212 213 + /* Use 0 as the default application priority for all. */ 214 214 for (index = 0 ; index < LLFC_DRIVER_TRAFFIC_TYPE_MAX; index++) 215 215 ttp[index] = 0; 216 - 217 - if (app->default_pri < MAX_PFC_PRIORITIES) 218 - ttp[LLFC_TRAFFIC_TYPE_NW] = app->default_pri; 219 216 220 217 for (index = 0 ; index < DCBX_MAX_APP_PROTOCOL; index++) { 221 218 struct dcbx_app_priority_entry *entry = 222 219 app->app_pri_tbl; 220 + enum traffic_type type = MAX_TRAFFIC_TYPE; 223 221 224 222 if (GET_FLAGS(entry[index].appBitfield, 225 - DCBX_APP_SF_ETH_TYPE) && 226 - ETH_TYPE_FCOE == entry[index].app_id) 227 - bnx2x_dcbx_get_ap_priority(bp, 228 - entry[index].pri_bitmap, 229 - LLFC_TRAFFIC_TYPE_FCOE); 223 + DCBX_APP_SF_DEFAULT) && 224 + GET_FLAGS(entry[index].appBitfield, 225 + DCBX_APP_SF_ETH_TYPE)) { 226 + type = LLFC_TRAFFIC_TYPE_NW; 227 + } else if (GET_FLAGS(entry[index].appBitfield, 228 + DCBX_APP_SF_PORT) && 229 + TCP_PORT_ISCSI == entry[index].app_id) { 230 + type = LLFC_TRAFFIC_TYPE_ISCSI; 231 + iscsi_pri_found = 1; 232 + } else if (GET_FLAGS(entry[index].appBitfield, 233 + DCBX_APP_SF_ETH_TYPE) && 234 + ETH_TYPE_FCOE == entry[index].app_id) { 235 + type = LLFC_TRAFFIC_TYPE_FCOE; 236 + fcoe_pri_found = 1; 237 + } 230 238 231 - if (GET_FLAGS(entry[index].appBitfield, 232 - DCBX_APP_SF_PORT) && 233 - TCP_PORT_ISCSI == entry[index].app_id) 234 - bnx2x_dcbx_get_ap_priority(bp, 235 - entry[index].pri_bitmap, 236 - LLFC_TRAFFIC_TYPE_ISCSI); 239 + if (type == MAX_TRAFFIC_TYPE) 240 + continue; 241 + 242 + bnx2x_dcbx_get_ap_priority(bp, 243 + entry[index].pri_bitmap, 244 + type); 245 + } 246 + 247 + /* If we have received a non-zero default application 248 + * priority, then use that for applications which are 249 + * not configured with any priority. 250 + */ 251 + if (ttp[LLFC_TRAFFIC_TYPE_NW] != 0) { 252 + if (!iscsi_pri_found) { 253 + ttp[LLFC_TRAFFIC_TYPE_ISCSI] = 254 + ttp[LLFC_TRAFFIC_TYPE_NW]; 255 + DP(BNX2X_MSG_DCB, 256 + "ISCSI is using default priority.\n"); 257 + } 258 + if (!fcoe_pri_found) { 259 + ttp[LLFC_TRAFFIC_TYPE_FCOE] = 260 + ttp[LLFC_TRAFFIC_TYPE_NW]; 261 + DP(BNX2X_MSG_DCB, 262 + "FCoE is using default priority.\n"); 263 + } 237 264 } 238 265 } else { 239 266 DP(BNX2X_MSG_DCB, "DCBX_LOCAL_APP_DISABLED\n");
+5
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
··· 981 981 memcpy(p, &dump_hdr, sizeof(struct dump_header)); 982 982 p += dump_hdr.header_size + 1; 983 983 984 + /* This isn't really an error, but since attention handling is going 985 + * to print the GRC timeouts using this macro, we use the same. 986 + */ 987 + BNX2X_ERR("Generating register dump. Might trigger harmless GRC timeouts\n"); 988 + 984 989 /* Actually read the registers */ 985 990 __bnx2x_get_regs(bp, p); 986 991
+4 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
··· 1831 1831 #elif defined(__LITTLE_ENDIAN) 1832 1832 u8 appBitfield; 1833 1833 #define DCBX_APP_ENTRY_VALID 0x01 1834 - #define DCBX_APP_ENTRY_SF_MASK 0x30 1834 + #define DCBX_APP_ENTRY_SF_MASK 0xF0 1835 1835 #define DCBX_APP_ENTRY_SF_SHIFT 4 1836 + #define DCBX_APP_ENTRY_VALID 0x01 1836 1837 #define DCBX_APP_SF_ETH_TYPE 0x10 1837 1838 #define DCBX_APP_SF_PORT 0x20 1839 + #define DCBX_APP_SF_UDP 0x40 1840 + #define DCBX_APP_SF_DEFAULT 0x80 1838 1841 u8 pri_bitmap; 1839 1842 u16 app_id; 1840 1843 #endif
+130 -59
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 59 59 #include <linux/semaphore.h> 60 60 #include <linux/stringify.h> 61 61 #include <linux/vmalloc.h> 62 - 62 + #if IS_ENABLED(CONFIG_GENEVE) 63 + #include <net/geneve.h> 64 + #endif 63 65 #include "bnx2x.h" 64 66 #include "bnx2x_init.h" 65 67 #include "bnx2x_init_ops.h" ··· 10078 10076 } 10079 10077 } 10080 10078 10081 - #ifdef CONFIG_BNX2X_VXLAN 10082 - static int bnx2x_vxlan_port_update(struct bnx2x *bp, u16 port) 10079 + #if defined(CONFIG_BNX2X_VXLAN) || IS_ENABLED(CONFIG_GENEVE) 10080 + static int bnx2x_udp_port_update(struct bnx2x *bp) 10083 10081 { 10084 10082 struct bnx2x_func_switch_update_params *switch_update_params; 10085 10083 struct bnx2x_func_state_params func_params = {NULL}; 10084 + struct bnx2x_udp_tunnel *udp_tunnel; 10085 + u16 vxlan_port = 0, geneve_port = 0; 10086 10086 int rc; 10087 10087 10088 10088 switch_update_params = &func_params.params.switch_update; ··· 10099 10095 /* Function parameters */ 10100 10096 __set_bit(BNX2X_F_UPDATE_TUNNEL_CFG_CHNG, 10101 10097 &switch_update_params->changes); 10102 - switch_update_params->vxlan_dst_port = port; 10098 + 10099 + if (bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE].count) { 10100 + udp_tunnel = &bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE]; 10101 + geneve_port = udp_tunnel->dst_port; 10102 + switch_update_params->geneve_dst_port = geneve_port; 10103 + } 10104 + 10105 + if (bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN].count) { 10106 + udp_tunnel = &bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN]; 10107 + vxlan_port = udp_tunnel->dst_port; 10108 + switch_update_params->vxlan_dst_port = vxlan_port; 10109 + } 10110 + 10111 + /* Re-enable inner-rss for the offloaded UDP tunnels */ 10112 + __set_bit(BNX2X_F_UPDATE_TUNNEL_INNER_RSS, 10113 + &switch_update_params->changes); 10114 + 10103 10115 rc = bnx2x_func_state_change(bp, &func_params); 10104 10116 if (rc) 10105 - BNX2X_ERR("failed to change vxlan dst port to %d (rc = 0x%x)\n", 10106 - port, rc); 10117 + BNX2X_ERR("failed to set UDP dst port to %04x %04x (rc = 0x%x)\n", 10118 + vxlan_port, geneve_port, rc); 10119 + else 10120 + DP(BNX2X_MSG_SP, 10121 + "Configured UDP ports: Vxlan [%04x] Geneve [%04x]\n", 10122 + vxlan_port, geneve_port); 10123 + 10107 10124 return rc; 10108 10125 } 10109 10126 10110 - static void __bnx2x_add_vxlan_port(struct bnx2x *bp, u16 port) 10127 + static void __bnx2x_add_udp_port(struct bnx2x *bp, u16 port, 10128 + enum bnx2x_udp_port_type type) 10111 10129 { 10112 - if (!netif_running(bp->dev)) 10130 + struct bnx2x_udp_tunnel *udp_port = &bp->udp_tunnel_ports[type]; 10131 + 10132 + if (!netif_running(bp->dev) || !IS_PF(bp)) 10113 10133 return; 10114 10134 10115 - if (bp->vxlan_dst_port_count && bp->vxlan_dst_port == port) { 10116 - bp->vxlan_dst_port_count++; 10117 - return; 10118 - } 10119 - 10120 - if (bp->vxlan_dst_port_count || !IS_PF(bp)) { 10121 - DP(BNX2X_MSG_SP, "Vxlan destination port limit reached\n"); 10135 + if (udp_port->count && udp_port->dst_port == port) { 10136 + udp_port->count++; 10122 10137 return; 10123 10138 } 10124 10139 10125 - bp->vxlan_dst_port = port; 10126 - bp->vxlan_dst_port_count = 1; 10127 - bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_ADD_VXLAN_PORT, 0); 10140 + if (udp_port->count) { 10141 + DP(BNX2X_MSG_SP, 10142 + "UDP tunnel [%d] - destination port limit reached\n", 10143 + type); 10144 + return; 10145 + } 10146 + 10147 + udp_port->dst_port = port; 10148 + udp_port->count = 1; 10149 + bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_CHANGE_UDP_PORT, 0); 10128 10150 } 10129 10151 10152 + static void __bnx2x_del_udp_port(struct bnx2x *bp, u16 port, 10153 + enum bnx2x_udp_port_type type) 10154 + { 10155 + struct bnx2x_udp_tunnel *udp_port = &bp->udp_tunnel_ports[type]; 10156 + 10157 + if (!IS_PF(bp)) 10158 + return; 10159 + 10160 + if (!udp_port->count || udp_port->dst_port != port) { 10161 + DP(BNX2X_MSG_SP, "Invalid UDP tunnel [%d] port\n", 10162 + type); 10163 + return; 10164 + } 10165 + 10166 + /* Remove reference, and make certain it's no longer in use */ 10167 + udp_port->count--; 10168 + if (udp_port->count) 10169 + return; 10170 + udp_port->dst_port = 0; 10171 + 10172 + if (netif_running(bp->dev)) 10173 + bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_CHANGE_UDP_PORT, 0); 10174 + else 10175 + DP(BNX2X_MSG_SP, "Deleted UDP tunnel [%d] port %d\n", 10176 + type, port); 10177 + } 10178 + #endif 10179 + 10180 + #ifdef CONFIG_BNX2X_VXLAN 10130 10181 static void bnx2x_add_vxlan_port(struct net_device *netdev, 10131 10182 sa_family_t sa_family, __be16 port) 10132 10183 { 10133 10184 struct bnx2x *bp = netdev_priv(netdev); 10134 10185 u16 t_port = ntohs(port); 10135 10186 10136 - __bnx2x_add_vxlan_port(bp, t_port); 10137 - } 10138 - 10139 - static void __bnx2x_del_vxlan_port(struct bnx2x *bp, u16 port) 10140 - { 10141 - if (!bp->vxlan_dst_port_count || bp->vxlan_dst_port != port || 10142 - !IS_PF(bp)) { 10143 - DP(BNX2X_MSG_SP, "Invalid vxlan port\n"); 10144 - return; 10145 - } 10146 - bp->vxlan_dst_port_count--; 10147 - if (bp->vxlan_dst_port_count) 10148 - return; 10149 - 10150 - if (netif_running(bp->dev)) { 10151 - bnx2x_schedule_sp_rtnl(bp, BNX2X_SP_RTNL_DEL_VXLAN_PORT, 0); 10152 - } else { 10153 - bp->vxlan_dst_port = 0; 10154 - netdev_info(bp->dev, "Deleted vxlan dest port %d", port); 10155 - } 10187 + __bnx2x_add_udp_port(bp, t_port, BNX2X_UDP_PORT_VXLAN); 10156 10188 } 10157 10189 10158 10190 static void bnx2x_del_vxlan_port(struct net_device *netdev, ··· 10197 10157 struct bnx2x *bp = netdev_priv(netdev); 10198 10158 u16 t_port = ntohs(port); 10199 10159 10200 - __bnx2x_del_vxlan_port(bp, t_port); 10160 + __bnx2x_del_udp_port(bp, t_port, BNX2X_UDP_PORT_VXLAN); 10161 + } 10162 + #endif 10163 + 10164 + #if IS_ENABLED(CONFIG_GENEVE) 10165 + static void bnx2x_add_geneve_port(struct net_device *netdev, 10166 + sa_family_t sa_family, __be16 port) 10167 + { 10168 + struct bnx2x *bp = netdev_priv(netdev); 10169 + u16 t_port = ntohs(port); 10170 + 10171 + __bnx2x_add_udp_port(bp, t_port, BNX2X_UDP_PORT_GENEVE); 10172 + } 10173 + 10174 + static void bnx2x_del_geneve_port(struct net_device *netdev, 10175 + sa_family_t sa_family, __be16 port) 10176 + { 10177 + struct bnx2x *bp = netdev_priv(netdev); 10178 + u16 t_port = ntohs(port); 10179 + 10180 + __bnx2x_del_udp_port(bp, t_port, BNX2X_UDP_PORT_GENEVE); 10201 10181 } 10202 10182 #endif 10203 10183 ··· 10229 10169 static void bnx2x_sp_rtnl_task(struct work_struct *work) 10230 10170 { 10231 10171 struct bnx2x *bp = container_of(work, struct bnx2x, sp_rtnl_task.work); 10232 - #ifdef CONFIG_BNX2X_VXLAN 10233 - u16 port; 10234 - #endif 10235 10172 10236 10173 rtnl_lock(); 10237 10174 ··· 10327 10270 &bp->sp_rtnl_state)) 10328 10271 bnx2x_update_mng_version(bp); 10329 10272 10273 + #if defined(CONFIG_BNX2X_VXLAN) || IS_ENABLED(CONFIG_GENEVE) 10274 + if (test_and_clear_bit(BNX2X_SP_RTNL_CHANGE_UDP_PORT, 10275 + &bp->sp_rtnl_state)) { 10276 + if (bnx2x_udp_port_update(bp)) { 10277 + /* On error, forget configuration */ 10278 + memset(bp->udp_tunnel_ports, 0, 10279 + sizeof(struct bnx2x_udp_tunnel) * 10280 + BNX2X_UDP_PORT_MAX); 10281 + } else { 10282 + /* Since we don't store additional port information, 10283 + * if no port is configured for any feature ask for 10284 + * information about currently configured ports. 10285 + */ 10330 10286 #ifdef CONFIG_BNX2X_VXLAN 10331 - port = bp->vxlan_dst_port; 10332 - if (test_and_clear_bit(BNX2X_SP_RTNL_ADD_VXLAN_PORT, 10333 - &bp->sp_rtnl_state)) { 10334 - if (!bnx2x_vxlan_port_update(bp, port)) 10335 - netdev_info(bp->dev, "Added vxlan dest port %d", port); 10336 - else 10337 - bp->vxlan_dst_port = 0; 10338 - } 10339 - 10340 - if (test_and_clear_bit(BNX2X_SP_RTNL_DEL_VXLAN_PORT, 10341 - &bp->sp_rtnl_state)) { 10342 - if (!bnx2x_vxlan_port_update(bp, 0)) { 10343 - netdev_info(bp->dev, 10344 - "Deleted vxlan dest port %d", port); 10345 - bp->vxlan_dst_port = 0; 10346 - vxlan_get_rx_port(bp->dev); 10287 + if (!bp->udp_tunnel_ports[BNX2X_UDP_PORT_VXLAN].count) 10288 + vxlan_get_rx_port(bp->dev); 10289 + #endif 10290 + #if IS_ENABLED(CONFIG_GENEVE) 10291 + if (!bp->udp_tunnel_ports[BNX2X_UDP_PORT_GENEVE].count) 10292 + geneve_get_rx_port(bp->dev); 10293 + #endif 10347 10294 } 10348 10295 } 10349 10296 #endif ··· 12429 12368 12430 12369 if (SHMEM2_HAS(bp, dcbx_lldp_params_offset) && 12431 12370 SHMEM2_HAS(bp, dcbx_lldp_dcbx_stat_offset) && 12371 + SHMEM2_HAS(bp, dcbx_en) && 12432 12372 SHMEM2_RD(bp, dcbx_lldp_params_offset) && 12433 - SHMEM2_RD(bp, dcbx_lldp_dcbx_stat_offset)) { 12373 + SHMEM2_RD(bp, dcbx_lldp_dcbx_stat_offset) && 12374 + SHMEM2_RD(bp, dcbx_en[BP_PORT(bp)])) { 12434 12375 bnx2x_dcbx_set_state(bp, true, BNX2X_DCBX_ENABLED_ON_NEG_ON); 12435 12376 bnx2x_dcbx_init_params(bp); 12436 12377 } else { ··· 12556 12493 #ifdef CONFIG_BNX2X_VXLAN 12557 12494 if (IS_PF(bp)) 12558 12495 vxlan_get_rx_port(dev); 12496 + #endif 12497 + #if IS_ENABLED(CONFIG_GENEVE) 12498 + if (IS_PF(bp)) 12499 + geneve_get_rx_port(dev); 12559 12500 #endif 12560 12501 12561 12502 return 0; ··· 13077 13010 #ifdef CONFIG_BNX2X_VXLAN 13078 13011 .ndo_add_vxlan_port = bnx2x_add_vxlan_port, 13079 13012 .ndo_del_vxlan_port = bnx2x_del_vxlan_port, 13013 + #endif 13014 + #if IS_ENABLED(CONFIG_GENEVE) 13015 + .ndo_add_geneve_port = bnx2x_add_geneve_port, 13016 + .ndo_del_geneve_port = bnx2x_del_geneve_port, 13080 13017 #endif 13081 13018 }; 13082 13019