| .. | .. |
|---|
| 219 | 219 | { PCI_VDEVICE(BROADCOM, 0x1750), .driver_data = BCM57508 }, |
|---|
| 220 | 220 | { PCI_VDEVICE(BROADCOM, 0x1751), .driver_data = BCM57504 }, |
|---|
| 221 | 221 | { PCI_VDEVICE(BROADCOM, 0x1752), .driver_data = BCM57502 }, |
|---|
| 222 | | - { PCI_VDEVICE(BROADCOM, 0x1800), .driver_data = BCM57508_NPAR }, |
|---|
| 222 | + { PCI_VDEVICE(BROADCOM, 0x1800), .driver_data = BCM57502_NPAR }, |
|---|
| 223 | 223 | { PCI_VDEVICE(BROADCOM, 0x1801), .driver_data = BCM57504_NPAR }, |
|---|
| 224 | | - { PCI_VDEVICE(BROADCOM, 0x1802), .driver_data = BCM57502_NPAR }, |
|---|
| 225 | | - { PCI_VDEVICE(BROADCOM, 0x1803), .driver_data = BCM57508_NPAR }, |
|---|
| 224 | + { PCI_VDEVICE(BROADCOM, 0x1802), .driver_data = BCM57508_NPAR }, |
|---|
| 225 | + { PCI_VDEVICE(BROADCOM, 0x1803), .driver_data = BCM57502_NPAR }, |
|---|
| 226 | 226 | { PCI_VDEVICE(BROADCOM, 0x1804), .driver_data = BCM57504_NPAR }, |
|---|
| 227 | | - { PCI_VDEVICE(BROADCOM, 0x1805), .driver_data = BCM57502_NPAR }, |
|---|
| 227 | + { PCI_VDEVICE(BROADCOM, 0x1805), .driver_data = BCM57508_NPAR }, |
|---|
| 228 | 228 | { PCI_VDEVICE(BROADCOM, 0xd802), .driver_data = BCM58802 }, |
|---|
| 229 | 229 | { PCI_VDEVICE(BROADCOM, 0xd804), .driver_data = BCM58804 }, |
|---|
| 230 | 230 | #ifdef CONFIG_BNXT_SRIOV |
|---|
| .. | .. |
|---|
| 2404 | 2404 | struct rx_cmp_ext *rxcmp1; |
|---|
| 2405 | 2405 | u32 cp_cons, tmp_raw_cons; |
|---|
| 2406 | 2406 | u32 raw_cons = cpr->cp_raw_cons; |
|---|
| 2407 | + bool flush_xdp = false; |
|---|
| 2407 | 2408 | u32 rx_pkts = 0; |
|---|
| 2408 | 2409 | u8 event = 0; |
|---|
| 2409 | 2410 | |
|---|
| .. | .. |
|---|
| 2438 | 2439 | rx_pkts++; |
|---|
| 2439 | 2440 | else if (rc == -EBUSY) /* partial completion */ |
|---|
| 2440 | 2441 | break; |
|---|
| 2442 | + if (event & BNXT_REDIRECT_EVENT) |
|---|
| 2443 | + flush_xdp = true; |
|---|
| 2441 | 2444 | } else if (unlikely(TX_CMP_TYPE(txcmp) == |
|---|
| 2442 | 2445 | CMPL_BASE_TYPE_HWRM_DONE)) { |
|---|
| 2443 | 2446 | bnxt_hwrm_handler(bp, txcmp); |
|---|
| .. | .. |
|---|
| 2457 | 2460 | |
|---|
| 2458 | 2461 | if (event & BNXT_AGG_EVENT) |
|---|
| 2459 | 2462 | bnxt_db_write(bp, &rxr->rx_agg_db, rxr->rx_agg_prod); |
|---|
| 2463 | + if (flush_xdp) |
|---|
| 2464 | + xdp_do_flush(); |
|---|
| 2460 | 2465 | |
|---|
| 2461 | 2466 | if (!bnxt_has_work(bp, cpr) && rx_pkts < budget) { |
|---|
| 2462 | 2467 | napi_complete_done(napi, rx_pkts); |
|---|
| .. | .. |
|---|
| 2854 | 2859 | |
|---|
| 2855 | 2860 | static void bnxt_free_tpa_info(struct bnxt *bp) |
|---|
| 2856 | 2861 | { |
|---|
| 2857 | | - int i; |
|---|
| 2862 | + int i, j; |
|---|
| 2858 | 2863 | |
|---|
| 2859 | 2864 | for (i = 0; i < bp->rx_nr_rings; i++) { |
|---|
| 2860 | 2865 | struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i]; |
|---|
| .. | .. |
|---|
| 2862 | 2867 | kfree(rxr->rx_tpa_idx_map); |
|---|
| 2863 | 2868 | rxr->rx_tpa_idx_map = NULL; |
|---|
| 2864 | 2869 | if (rxr->rx_tpa) { |
|---|
| 2865 | | - kfree(rxr->rx_tpa[0].agg_arr); |
|---|
| 2866 | | - rxr->rx_tpa[0].agg_arr = NULL; |
|---|
| 2870 | + for (j = 0; j < bp->max_tpa; j++) { |
|---|
| 2871 | + kfree(rxr->rx_tpa[j].agg_arr); |
|---|
| 2872 | + rxr->rx_tpa[j].agg_arr = NULL; |
|---|
| 2873 | + } |
|---|
| 2867 | 2874 | } |
|---|
| 2868 | 2875 | kfree(rxr->rx_tpa); |
|---|
| 2869 | 2876 | rxr->rx_tpa = NULL; |
|---|
| .. | .. |
|---|
| 2872 | 2879 | |
|---|
| 2873 | 2880 | static int bnxt_alloc_tpa_info(struct bnxt *bp) |
|---|
| 2874 | 2881 | { |
|---|
| 2875 | | - int i, j, total_aggs = 0; |
|---|
| 2882 | + int i, j; |
|---|
| 2876 | 2883 | |
|---|
| 2877 | 2884 | bp->max_tpa = MAX_TPA; |
|---|
| 2878 | 2885 | if (bp->flags & BNXT_FLAG_CHIP_P5) { |
|---|
| 2879 | 2886 | if (!bp->max_tpa_v2) |
|---|
| 2880 | 2887 | return 0; |
|---|
| 2881 | 2888 | bp->max_tpa = max_t(u16, bp->max_tpa_v2, MAX_TPA_P5); |
|---|
| 2882 | | - total_aggs = bp->max_tpa * MAX_SKB_FRAGS; |
|---|
| 2883 | 2889 | } |
|---|
| 2884 | 2890 | |
|---|
| 2885 | 2891 | for (i = 0; i < bp->rx_nr_rings; i++) { |
|---|
| .. | .. |
|---|
| 2893 | 2899 | |
|---|
| 2894 | 2900 | if (!(bp->flags & BNXT_FLAG_CHIP_P5)) |
|---|
| 2895 | 2901 | continue; |
|---|
| 2896 | | - agg = kcalloc(total_aggs, sizeof(*agg), GFP_KERNEL); |
|---|
| 2897 | | - rxr->rx_tpa[0].agg_arr = agg; |
|---|
| 2898 | | - if (!agg) |
|---|
| 2899 | | - return -ENOMEM; |
|---|
| 2900 | | - for (j = 1; j < bp->max_tpa; j++) |
|---|
| 2901 | | - rxr->rx_tpa[j].agg_arr = agg + j * MAX_SKB_FRAGS; |
|---|
| 2902 | + for (j = 0; j < bp->max_tpa; j++) { |
|---|
| 2903 | + agg = kcalloc(MAX_SKB_FRAGS, sizeof(*agg), GFP_KERNEL); |
|---|
| 2904 | + if (!agg) |
|---|
| 2905 | + return -ENOMEM; |
|---|
| 2906 | + rxr->rx_tpa[j].agg_arr = agg; |
|---|
| 2907 | + } |
|---|
| 2902 | 2908 | rxr->rx_tpa_idx_map = kzalloc(sizeof(*rxr->rx_tpa_idx_map), |
|---|
| 2903 | 2909 | GFP_KERNEL); |
|---|
| 2904 | 2910 | if (!rxr->rx_tpa_idx_map) |
|---|
| .. | .. |
|---|
| 8336 | 8342 | goto err_out; |
|---|
| 8337 | 8343 | } |
|---|
| 8338 | 8344 | |
|---|
| 8345 | + if (BNXT_VF(bp)) |
|---|
| 8346 | + bnxt_hwrm_func_qcfg(bp); |
|---|
| 8347 | + |
|---|
| 8339 | 8348 | rc = bnxt_setup_vnic(bp, 0); |
|---|
| 8340 | 8349 | if (rc) |
|---|
| 8341 | 8350 | goto err_out; |
|---|
| .. | .. |
|---|
| 8761 | 8770 | netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc); |
|---|
| 8762 | 8771 | return rc; |
|---|
| 8763 | 8772 | } |
|---|
| 8764 | | - if (tcs && (bp->tx_nr_rings_per_tc * tcs != bp->tx_nr_rings)) { |
|---|
| 8773 | + if (tcs && (bp->tx_nr_rings_per_tc * tcs != |
|---|
| 8774 | + bp->tx_nr_rings - bp->tx_nr_rings_xdp)) { |
|---|
| 8765 | 8775 | netdev_err(bp->dev, "tx ring reservation failure\n"); |
|---|
| 8766 | 8776 | netdev_reset_tc(bp->dev); |
|---|
| 8767 | | - bp->tx_nr_rings_per_tc = bp->tx_nr_rings; |
|---|
| 8777 | + if (bp->tx_nr_rings_xdp) |
|---|
| 8778 | + bp->tx_nr_rings_per_tc = bp->tx_nr_rings_xdp; |
|---|
| 8779 | + else |
|---|
| 8780 | + bp->tx_nr_rings_per_tc = bp->tx_nr_rings; |
|---|
| 8768 | 8781 | return -ENOMEM; |
|---|
| 8769 | 8782 | } |
|---|
| 8770 | 8783 | return 0; |
|---|
| .. | .. |
|---|
| 12096 | 12109 | |
|---|
| 12097 | 12110 | #endif /* CONFIG_RFS_ACCEL */ |
|---|
| 12098 | 12111 | |
|---|
| 12099 | | -static int bnxt_udp_tunnel_sync(struct net_device *netdev, unsigned int table) |
|---|
| 12112 | +static int bnxt_udp_tunnel_set_port(struct net_device *netdev, unsigned int table, |
|---|
| 12113 | + unsigned int entry, struct udp_tunnel_info *ti) |
|---|
| 12100 | 12114 | { |
|---|
| 12101 | 12115 | struct bnxt *bp = netdev_priv(netdev); |
|---|
| 12102 | | - struct udp_tunnel_info ti; |
|---|
| 12103 | 12116 | unsigned int cmd; |
|---|
| 12104 | 12117 | |
|---|
| 12105 | | - udp_tunnel_nic_get_port(netdev, table, 0, &ti); |
|---|
| 12106 | | - if (ti.type == UDP_TUNNEL_TYPE_VXLAN) |
|---|
| 12118 | + if (ti->type == UDP_TUNNEL_TYPE_VXLAN) |
|---|
| 12107 | 12119 | cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN; |
|---|
| 12108 | 12120 | else |
|---|
| 12109 | 12121 | cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE; |
|---|
| 12110 | 12122 | |
|---|
| 12111 | | - if (ti.port) |
|---|
| 12112 | | - return bnxt_hwrm_tunnel_dst_port_alloc(bp, ti.port, cmd); |
|---|
| 12123 | + return bnxt_hwrm_tunnel_dst_port_alloc(bp, ti->port, cmd); |
|---|
| 12124 | +} |
|---|
| 12125 | + |
|---|
| 12126 | +static int bnxt_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table, |
|---|
| 12127 | + unsigned int entry, struct udp_tunnel_info *ti) |
|---|
| 12128 | +{ |
|---|
| 12129 | + struct bnxt *bp = netdev_priv(netdev); |
|---|
| 12130 | + unsigned int cmd; |
|---|
| 12131 | + |
|---|
| 12132 | + if (ti->type == UDP_TUNNEL_TYPE_VXLAN) |
|---|
| 12133 | + cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN; |
|---|
| 12134 | + else |
|---|
| 12135 | + cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE; |
|---|
| 12113 | 12136 | |
|---|
| 12114 | 12137 | return bnxt_hwrm_tunnel_dst_port_free(bp, cmd); |
|---|
| 12115 | 12138 | } |
|---|
| 12116 | 12139 | |
|---|
| 12117 | 12140 | static const struct udp_tunnel_nic_info bnxt_udp_tunnels = { |
|---|
| 12118 | | - .sync_table = bnxt_udp_tunnel_sync, |
|---|
| 12141 | + .set_port = bnxt_udp_tunnel_set_port, |
|---|
| 12142 | + .unset_port = bnxt_udp_tunnel_unset_port, |
|---|
| 12119 | 12143 | .flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP | |
|---|
| 12120 | 12144 | UDP_TUNNEL_NIC_INFO_OPEN_ONLY, |
|---|
| 12121 | 12145 | .tables = { |
|---|