aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-10-03 23:26:18 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-03 23:26:18 -0400
commit2f8fab7ad7de158c0df28b2df02760f98b1f4a18 (patch)
tree3484e5de9e330ff1ff47f07af38c8c22c3f8e119 /drivers/net
parentb462d22bf3a675dffbfe1cd7ad90eab633d822b7 (diff)
parentabd97a94ba913d121a920d5541aba1e568be6972 (diff)
Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 40GbE Intel Wired LAN Driver Updates 2016-10-03 This series contains fixes to i40e only. Stefan Assmann provides the changes in this series to resolve an issue where when we run out of MSIx vectors, iWARP gets disabled automatically. First adds a check for "no vectors left" during MSIx vector allocation for VMDq, which will prevent more vectors being allocated than available. Then fixed the MSIx vector redistribution when we reach the hardware limit for vectors so that additional features like VMDq, iWARP, etc do not get starved for vectors because the PF is hogging all the resources. Lastly, fix the issue for flow director by moving the check for the reaching the vector limit earlier in the code so that a decision can be made on disabling flow director. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c76
1 files changed, 47 insertions, 29 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 8176596932be..0044c29ca31e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7641,7 +7641,6 @@ static int i40e_init_msix(struct i40e_pf *pf)
7641 vectors_left--; 7641 vectors_left--;
7642 } else { 7642 } else {
7643 pf->num_fdsb_msix = 0; 7643 pf->num_fdsb_msix = 0;
7644 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED;
7645 } 7644 }
7646 } 7645 }
7647 7646
@@ -7661,6 +7660,8 @@ static int i40e_init_msix(struct i40e_pf *pf)
7661#endif 7660#endif
7662 /* can we reserve enough for iWARP? */ 7661 /* can we reserve enough for iWARP? */
7663 if (pf->flags & I40E_FLAG_IWARP_ENABLED) { 7662 if (pf->flags & I40E_FLAG_IWARP_ENABLED) {
7663 iwarp_requested = pf->num_iwarp_msix;
7664
7664 if (!vectors_left) 7665 if (!vectors_left)
7665 pf->num_iwarp_msix = 0; 7666 pf->num_iwarp_msix = 0;
7666 else if (vectors_left < pf->num_iwarp_msix) 7667 else if (vectors_left < pf->num_iwarp_msix)
@@ -7674,18 +7675,23 @@ static int i40e_init_msix(struct i40e_pf *pf)
7674 int vmdq_vecs_wanted = pf->num_vmdq_vsis * pf->num_vmdq_qps; 7675 int vmdq_vecs_wanted = pf->num_vmdq_vsis * pf->num_vmdq_qps;
7675 int vmdq_vecs = min_t(int, vectors_left, vmdq_vecs_wanted); 7676 int vmdq_vecs = min_t(int, vectors_left, vmdq_vecs_wanted);
7676 7677
7677 /* if we're short on vectors for what's desired, we limit 7678 if (!vectors_left) {
7678 * the queues per vmdq. If this is still more than are 7679 pf->num_vmdq_msix = 0;
7679 * available, the user will need to change the number of 7680 pf->num_vmdq_qps = 0;
7680 * queues/vectors used by the PF later with the ethtool 7681 } else {
7681 * channels command 7682 /* if we're short on vectors for what's desired, we limit
7682 */ 7683 * the queues per vmdq. If this is still more than are
7683 if (vmdq_vecs < vmdq_vecs_wanted) 7684 * available, the user will need to change the number of
7684 pf->num_vmdq_qps = 1; 7685 * queues/vectors used by the PF later with the ethtool
7685 pf->num_vmdq_msix = pf->num_vmdq_qps; 7686 * channels command
7687 */
7688 if (vmdq_vecs < vmdq_vecs_wanted)
7689 pf->num_vmdq_qps = 1;
7690 pf->num_vmdq_msix = pf->num_vmdq_qps;
7686 7691
7687 v_budget += vmdq_vecs; 7692 v_budget += vmdq_vecs;
7688 vectors_left -= vmdq_vecs; 7693 vectors_left -= vmdq_vecs;
7694 }
7689 } 7695 }
7690 7696
7691 pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry), 7697 pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry),
@@ -7697,21 +7703,6 @@ static int i40e_init_msix(struct i40e_pf *pf)
7697 pf->msix_entries[i].entry = i; 7703 pf->msix_entries[i].entry = i;
7698 v_actual = i40e_reserve_msix_vectors(pf, v_budget); 7704 v_actual = i40e_reserve_msix_vectors(pf, v_budget);
7699 7705
7700 if (v_actual != v_budget) {
7701 /* If we have limited resources, we will start with no vectors
7702 * for the special features and then allocate vectors to some
7703 * of these features based on the policy and at the end disable
7704 * the features that did not get any vectors.
7705 */
7706 iwarp_requested = pf->num_iwarp_msix;
7707 pf->num_iwarp_msix = 0;
7708#ifdef I40E_FCOE
7709 pf->num_fcoe_qps = 0;
7710 pf->num_fcoe_msix = 0;
7711#endif
7712 pf->num_vmdq_msix = 0;
7713 }
7714
7715 if (v_actual < I40E_MIN_MSIX) { 7706 if (v_actual < I40E_MIN_MSIX) {
7716 pf->flags &= ~I40E_FLAG_MSIX_ENABLED; 7707 pf->flags &= ~I40E_FLAG_MSIX_ENABLED;
7717 kfree(pf->msix_entries); 7708 kfree(pf->msix_entries);
@@ -7725,9 +7716,16 @@ static int i40e_init_msix(struct i40e_pf *pf)
7725 pf->num_lan_qps = 1; 7716 pf->num_lan_qps = 1;
7726 pf->num_lan_msix = 1; 7717 pf->num_lan_msix = 1;
7727 7718
7728 } else if (v_actual != v_budget) { 7719 } else if (!vectors_left) {
7720 /* If we have limited resources, we will start with no vectors
7721 * for the special features and then allocate vectors to some
7722 * of these features based on the policy and at the end disable
7723 * the features that did not get any vectors.
7724 */
7729 int vec; 7725 int vec;
7730 7726
7727 dev_info(&pf->pdev->dev,
7728 "MSI-X vector limit reached, attempting to redistribute vectors\n");
7731 /* reserve the misc vector */ 7729 /* reserve the misc vector */
7732 vec = v_actual - 1; 7730 vec = v_actual - 1;
7733 7731
@@ -7735,7 +7733,10 @@ static int i40e_init_msix(struct i40e_pf *pf)
7735 pf->num_vmdq_msix = 1; /* force VMDqs to only one vector */ 7733 pf->num_vmdq_msix = 1; /* force VMDqs to only one vector */
7736 pf->num_vmdq_vsis = 1; 7734 pf->num_vmdq_vsis = 1;
7737 pf->num_vmdq_qps = 1; 7735 pf->num_vmdq_qps = 1;
7738 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED; 7736#ifdef I40E_FCOE
7737 pf->num_fcoe_qps = 0;
7738 pf->num_fcoe_msix = 0;
7739#endif
7739 7740
7740 /* partition out the remaining vectors */ 7741 /* partition out the remaining vectors */
7741 switch (vec) { 7742 switch (vec) {
@@ -7767,9 +7768,14 @@ static int i40e_init_msix(struct i40e_pf *pf)
7767 pf->num_vmdq_vsis = min_t(int, (vec / 2), 7768 pf->num_vmdq_vsis = min_t(int, (vec / 2),
7768 I40E_DEFAULT_NUM_VMDQ_VSI); 7769 I40E_DEFAULT_NUM_VMDQ_VSI);
7769 } 7770 }
7771 if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
7772 pf->num_fdsb_msix = 1;
7773 vec--;
7774 }
7770 pf->num_lan_msix = min_t(int, 7775 pf->num_lan_msix = min_t(int,
7771 (vec - (pf->num_iwarp_msix + pf->num_vmdq_vsis)), 7776 (vec - (pf->num_iwarp_msix + pf->num_vmdq_vsis)),
7772 pf->num_lan_msix); 7777 pf->num_lan_msix);
7778 pf->num_lan_qps = pf->num_lan_msix;
7773#ifdef I40E_FCOE 7779#ifdef I40E_FCOE
7774 /* give one vector to FCoE */ 7780 /* give one vector to FCoE */
7775 if (pf->flags & I40E_FLAG_FCOE_ENABLED) { 7781 if (pf->flags & I40E_FLAG_FCOE_ENABLED) {
@@ -7781,6 +7787,11 @@ static int i40e_init_msix(struct i40e_pf *pf)
7781 } 7787 }
7782 } 7788 }
7783 7789
7790 if ((pf->flags & I40E_FLAG_FD_SB_ENABLED) &&
7791 (pf->num_fdsb_msix == 0)) {
7792 dev_info(&pf->pdev->dev, "Sideband Flowdir disabled, not enough MSI-X vectors\n");
7793 pf->flags &= ~I40E_FLAG_FD_SB_ENABLED;
7794 }
7784 if ((pf->flags & I40E_FLAG_VMDQ_ENABLED) && 7795 if ((pf->flags & I40E_FLAG_VMDQ_ENABLED) &&
7785 (pf->num_vmdq_msix == 0)) { 7796 (pf->num_vmdq_msix == 0)) {
7786 dev_info(&pf->pdev->dev, "VMDq disabled, not enough MSI-X vectors\n"); 7797 dev_info(&pf->pdev->dev, "VMDq disabled, not enough MSI-X vectors\n");
@@ -7799,6 +7810,13 @@ static int i40e_init_msix(struct i40e_pf *pf)
7799 pf->flags &= ~I40E_FLAG_FCOE_ENABLED; 7810 pf->flags &= ~I40E_FLAG_FCOE_ENABLED;
7800 } 7811 }
7801#endif 7812#endif
7813 i40e_debug(&pf->hw, I40E_DEBUG_INIT,
7814 "MSI-X vector distribution: PF %d, VMDq %d, FDSB %d, iWARP %d\n",
7815 pf->num_lan_msix,
7816 pf->num_vmdq_msix * pf->num_vmdq_vsis,
7817 pf->num_fdsb_msix,
7818 pf->num_iwarp_msix);
7819
7802 return v_actual; 7820 return v_actual;
7803} 7821}
7804 7822