]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
i40e: Clean up handling of msglevel flags and debug parameter
authorAlexander Duyck <alexander.h.duyck@intel.com>
Fri, 30 Sep 2016 12:21:46 +0000 (08:21 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Sat, 29 Oct 2016 06:28:39 +0000 (23:28 -0700)
So the i40e driver had a really convoluted configuration for how to handle
the debug flags contained in msg_level.  Part of the issue is that the
driver has its own 32 bit mask that it was using to track a separate set of
debug features.  From what I can tell it was trying to use the upper 4 bits
to determine if the value was meant to represent a bit-mask or the numeric
value provided by debug level.

What this patch does is clean this up by compressing those 4 bits into bit
31, as a result we just have to perform a check against the value being
negative to determine if we are looking at a debug level (positive), or a
debug mask (negative).  The debug level will populate the msg_level, and
the debug mask will populate the debug_mask in the hardware struct.

I added similar logic for ethtool.  If the value being provided has bit 31
set we assume the value being provided is a debug mask, otherwise we assume
it is a msg_enable mask.  For displaying we only provide the msg_enable,
and if debug_mask is in use we will print it to the dmesg log.

Lastly I removed the debugfs interface.  It is redundant with what we
already have in ethtool and really doesn't belong anyway.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_debugfs.c
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
drivers/net/ethernet/intel/i40e/i40e_main.c

index 0c1875b5b16d2d79839cf6f85d5194741ffb697e..0354632fe2f8dddf2729d473b40c51911e939a96 100644 (file)
@@ -1210,24 +1210,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
                        dev_info(&pf->pdev->dev,
                                 "dump debug fwdata <cluster_id> <table_id> <index>\n");
                }
-
-       } else if (strncmp(cmd_buf, "msg_enable", 10) == 0) {
-               u32 level;
-               cnt = sscanf(&cmd_buf[10], "%i", &level);
-               if (cnt) {
-                       if (I40E_DEBUG_USER & level) {
-                               pf->hw.debug_mask = level;
-                               dev_info(&pf->pdev->dev,
-                                        "set hw.debug_mask = 0x%08x\n",
-                                        pf->hw.debug_mask);
-                       }
-                       pf->msg_enable = level;
-                       dev_info(&pf->pdev->dev, "set msg_enable = 0x%08x\n",
-                                pf->msg_enable);
-               } else {
-                       dev_info(&pf->pdev->dev, "msg_enable = 0x%08x\n",
-                                pf->msg_enable);
-               }
        } else if (strncmp(cmd_buf, "pfr", 3) == 0) {
                dev_info(&pf->pdev->dev, "debugfs: forcing PFR\n");
                i40e_do_reset_safe(pf, BIT(__I40E_PF_RESET_REQUESTED));
@@ -1644,7 +1626,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
                dev_info(&pf->pdev->dev, "  dump desc aq\n");
                dev_info(&pf->pdev->dev, "  dump reset stats\n");
                dev_info(&pf->pdev->dev, "  dump debug fwdata <cluster_id> <table_id> <index>\n");
-               dev_info(&pf->pdev->dev, "  msg_enable [level]\n");
                dev_info(&pf->pdev->dev, "  read <reg>\n");
                dev_info(&pf->pdev->dev, "  write <reg> <value>\n");
                dev_info(&pf->pdev->dev, "  clear_stats vsi [seid]\n");
index 3a1f91efcae2c909c4cb3fd75f61dff3a6e6e6a1..fb4fb524eab22ddfd614b04b86f815961d00aba0 100644 (file)
@@ -978,6 +978,10 @@ static u32 i40e_get_msglevel(struct net_device *netdev)
 {
        struct i40e_netdev_priv *np = netdev_priv(netdev);
        struct i40e_pf *pf = np->vsi->back;
+       u32 debug_mask = pf->hw.debug_mask;
+
+       if (debug_mask)
+               netdev_info(netdev, "i40e debug_mask: 0x%08X\n", debug_mask);
 
        return pf->msg_enable;
 }
@@ -989,7 +993,8 @@ static void i40e_set_msglevel(struct net_device *netdev, u32 data)
 
        if (I40E_DEBUG_USER & data)
                pf->hw.debug_mask = data;
-       pf->msg_enable = data;
+       else
+               pf->msg_enable = data;
 }
 
 static int i40e_get_regs_len(struct net_device *netdev)
index 0c2328dab8f7963b3cf15555a9551548d6bade56..7fa535f578204bbdecd05416fc3b8041cd253182 100644 (file)
@@ -93,8 +93,8 @@ MODULE_DEVICE_TABLE(pci, i40e_pci_tbl);
 
 #define I40E_MAX_VF_COUNT 128
 static int debug = -1;
-module_param(debug, int, 0);
-MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
+module_param(debug, uint, 0);
+MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all), Debug mask (0x8XXXXXXX)");
 
 MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>");
 MODULE_DESCRIPTION("Intel(R) Ethernet Connection XL710 Network Driver");
@@ -8511,15 +8511,6 @@ static int i40e_sw_init(struct i40e_pf *pf)
        int err = 0;
        int size;
 
-       pf->msg_enable = netif_msg_init(I40E_DEFAULT_MSG_ENABLE,
-                               (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK));
-       if (debug != -1 && debug != I40E_DEFAULT_MSG_ENABLE) {
-               if (I40E_DEBUG_USER & debug)
-                       pf->hw.debug_mask = debug;
-               pf->msg_enable = netif_msg_init((debug & ~I40E_DEBUG_USER),
-                                               I40E_DEFAULT_MSG_ENABLE);
-       }
-
        /* Set default capability flags */
        pf->flags = I40E_FLAG_RX_CSUM_ENABLED |
                    I40E_FLAG_MSI_ENABLED     |
@@ -10825,10 +10816,12 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        mutex_init(&hw->aq.asq_mutex);
        mutex_init(&hw->aq.arq_mutex);
 
-       if (debug != -1) {
-               pf->msg_enable = pf->hw.debug_mask;
-               pf->msg_enable = debug;
-       }
+       pf->msg_enable = netif_msg_init(debug,
+                                       NETIF_MSG_DRV |
+                                       NETIF_MSG_PROBE |
+                                       NETIF_MSG_LINK);
+       if (debug < -1)
+               pf->hw.debug_mask = debug;
 
        /* do a special CORER for clearing PXE mode once at init */
        if (hw->revision_id == 0 &&