diff mbox

[net-next,2/3] bnxt_en: Log a message, if enabling NTUPLE filtering fails.

Message ID 1469416917-29659-3-git-send-email-michael.chan@broadcom.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Michael Chan July 25, 2016, 3:21 a.m. UTC
From: Vasundhara Volam <vasundhara-v.volam@broadcom.com>

If there are not enough resources to enable ntuple filtering,
log a warning message.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Joe Perches July 25, 2016, 2 p.m. UTC | #1
On Sun, 2016-07-24 at 23:21 -0400, Michael Chan wrote:
> If there are not enough resources to enable ntuple filtering,
> log a warning message.
[]
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
[]
> @@ -5790,8 +5790,14 @@ static bool bnxt_rfs_capable(struct bnxt *bp)
>  		return false;
>  
>  	vnics = 1 + bp->rx_nr_rings;
> -	if (vnics > pf->max_rsscos_ctxs || vnics > pf->max_vnics)
> +	if (vnics > pf->max_rsscos_ctxs || vnics > pf->max_vnics) {
> +		netdev_warn(bp->dev,
> +			    "Not enough resources to support NTUPLE filters");
> +		netdev_warn(bp->dev,
> +			    "Enough NTUPLE resources for up to %d rx rings",

Missing newline terminations and may be better as a single message
diff mbox

Patch

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 7de7d7a..398ecba 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -5790,8 +5790,14 @@  static bool bnxt_rfs_capable(struct bnxt *bp)
 		return false;
 
 	vnics = 1 + bp->rx_nr_rings;
-	if (vnics > pf->max_rsscos_ctxs || vnics > pf->max_vnics)
+	if (vnics > pf->max_rsscos_ctxs || vnics > pf->max_vnics) {
+		netdev_warn(bp->dev,
+			    "Not enough resources to support NTUPLE filters");
+		netdev_warn(bp->dev,
+			    "Enough NTUPLE resources for up to %d rx rings",
+			    min(pf->max_rsscos_ctxs - 1, pf->max_vnics - 1));
 		return false;
+	}
 
 	return true;
 #else
@@ -5804,7 +5810,7 @@  static netdev_features_t bnxt_fix_features(struct net_device *dev,
 {
 	struct bnxt *bp = netdev_priv(dev);
 
-	if (!bnxt_rfs_capable(bp))
+	if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
 		features &= ~NETIF_F_NTUPLE;
 
 	/* Both CTAG and STAG VLAN accelaration on the RX side have to be