These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / net / ethernet / sfc / farch.c
index bb89e96..133e9e3 100644 (file)
@@ -20,6 +20,8 @@
 #include "efx.h"
 #include "nic.h"
 #include "farch_regs.h"
+#include "sriov.h"
+#include "siena_sriov.h"
 #include "io.h"
 #include "workarounds.h"
 
@@ -319,7 +321,9 @@ void efx_farch_tx_write(struct efx_tx_queue *tx_queue)
        unsigned write_ptr;
        unsigned old_write_count = tx_queue->write_count;
 
-       BUG_ON(tx_queue->write_count == tx_queue->insert_count);
+       tx_queue->xmit_more_available = false;
+       if (unlikely(tx_queue->write_count == tx_queue->insert_count))
+               return;
 
        do {
                write_ptr = tx_queue->write_count & tx_queue->ptr_mask;
@@ -1198,13 +1202,17 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
                netif_vdbg(efx, hw, efx->net_dev, "channel %d TXQ %d flushed\n",
                           channel->channel, ev_sub_data);
                efx_farch_handle_tx_flush_done(efx, event);
+#ifdef CONFIG_SFC_SRIOV
                efx_siena_sriov_tx_flush_done(efx, event);
+#endif
                break;
        case FSE_AZ_RX_DESCQ_FLS_DONE_EV:
                netif_vdbg(efx, hw, efx->net_dev, "channel %d RXQ %d flushed\n",
                           channel->channel, ev_sub_data);
                efx_farch_handle_rx_flush_done(efx, event);
+#ifdef CONFIG_SFC_SRIOV
                efx_siena_sriov_rx_flush_done(efx, event);
+#endif
                break;
        case FSE_AZ_EVQ_INIT_DONE_EV:
                netif_dbg(efx, hw, efx->net_dev,
@@ -1242,8 +1250,11 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
                                  " RX Q %d is disabled.\n", ev_sub_data,
                                  ev_sub_data);
                        efx_schedule_reset(efx, RESET_TYPE_DMA_ERROR);
-               } else
+               }
+#ifdef CONFIG_SFC_SRIOV
+               else
                        efx_siena_sriov_desc_fetch_err(efx, ev_sub_data);
+#endif
                break;
        case FSE_BZ_TX_DSC_ERROR_EV:
                if (ev_sub_data < EFX_VI_BASE) {
@@ -1252,8 +1263,11 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
                                  " TX Q %d is disabled.\n", ev_sub_data,
                                  ev_sub_data);
                        efx_schedule_reset(efx, RESET_TYPE_DMA_ERROR);
-               } else
+               }
+#ifdef CONFIG_SFC_SRIOV
+               else
                        efx_siena_sriov_desc_fetch_err(efx, ev_sub_data);
+#endif
                break;
        default:
                netif_vdbg(efx, hw, efx->net_dev,
@@ -1317,9 +1331,11 @@ int efx_farch_ev_process(struct efx_channel *channel, int budget)
                case FSE_AZ_EV_CODE_DRIVER_EV:
                        efx_farch_handle_driver_event(channel, &event);
                        break;
+#ifdef CONFIG_SFC_SRIOV
                case FSE_CZ_EV_CODE_USER_EV:
                        efx_siena_sriov_event(channel, &event);
                        break;
+#endif
                case FSE_CZ_EV_CODE_MCDI_EV:
                        efx_mcdi_process_event(channel, &event);
                        break;
@@ -1685,28 +1701,32 @@ void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw)
        vi_count = max(efx->n_channels, efx->n_tx_channels * EFX_TXQ_TYPES);
 
 #ifdef CONFIG_SFC_SRIOV
-       if (efx->type->sriov_wanted(efx)) {
-               unsigned vi_dc_entries, buftbl_free, entries_per_vf, vf_limit;
-
-               nic_data->vf_buftbl_base = buftbl_min;
-
-               vi_dc_entries = RX_DC_ENTRIES + TX_DC_ENTRIES;
-               vi_count = max(vi_count, EFX_VI_BASE);
-               buftbl_free = (sram_lim_qw - buftbl_min -
-                              vi_count * vi_dc_entries);
-
-               entries_per_vf = ((vi_dc_entries + EFX_VF_BUFTBL_PER_VI) *
-                                 efx_vf_size(efx));
-               vf_limit = min(buftbl_free / entries_per_vf,
-                              (1024U - EFX_VI_BASE) >> efx->vi_scale);
-
-               if (efx->vf_count > vf_limit) {
-                       netif_err(efx, probe, efx->net_dev,
-                                 "Reducing VF count from from %d to %d\n",
-                                 efx->vf_count, vf_limit);
-                       efx->vf_count = vf_limit;
+       if (efx->type->sriov_wanted) {
+               if (efx->type->sriov_wanted(efx)) {
+                       unsigned vi_dc_entries, buftbl_free;
+                       unsigned entries_per_vf, vf_limit;
+
+                       nic_data->vf_buftbl_base = buftbl_min;
+
+                       vi_dc_entries = RX_DC_ENTRIES + TX_DC_ENTRIES;
+                       vi_count = max(vi_count, EFX_VI_BASE);
+                       buftbl_free = (sram_lim_qw - buftbl_min -
+                                      vi_count * vi_dc_entries);
+
+                       entries_per_vf = ((vi_dc_entries +
+                                          EFX_VF_BUFTBL_PER_VI) *
+                                         efx_vf_size(efx));
+                       vf_limit = min(buftbl_free / entries_per_vf,
+                                      (1024U - EFX_VI_BASE) >> efx->vi_scale);
+
+                       if (efx->vf_count > vf_limit) {
+                               netif_err(efx, probe, efx->net_dev,
+                                         "Reducing VF count from from %d to %d\n",
+                                         efx->vf_count, vf_limit);
+                               efx->vf_count = vf_limit;
+                       }
+                       vi_count += efx->vf_count * efx_vf_size(efx);
                }
-               vi_count += efx->vf_count * efx_vf_size(efx);
        }
 #endif
 
@@ -2222,7 +2242,7 @@ efx_farch_filter_init_rx_auto(struct efx_nic *efx,
         */
        spec->priority = EFX_FILTER_PRI_AUTO;
        spec->flags = (EFX_FILTER_FLAG_RX |
-                      (efx->n_rx_channels > 1 ? EFX_FILTER_FLAG_RX_RSS : 0) |
+                      (efx_rss_enabled(efx) ? EFX_FILTER_FLAG_RX_RSS : 0) |
                       (efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0));
        spec->dmaq_id = 0;
 }