Skip to contentSkip to conversation

cleanup logs in main PMDs

PATCH Superseded David Marchand 3 participants 17 messages Aug 26, 2014 – Aug 29, 2014 5 messages not in the archive

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover cleanup logs in main PMDs

Here is a patchset that reworks the log macro in e1000, ixgbe and i40e PMDs. The idea behind this is to make it easier to debug some init failures and to be sure of the datapath selected in these PMDs (rx / tx handlers selection).

The PMDs changes involve adding more debug messages in the default build. A new eal option has been added to set the default log level, so that you can render the eal a little less noisy.

I did not change the default log level for now, as some eal log messages are marked as DEBUG while being interesting (from my point of view). I suppose we can change the default log level later once the eal has been cleaned up.

Signature · 38 lines
David Marchand

David Marchand (11):
  ixgbe: clean log messages
  ixgbe: always log init messages
  ixgbe: add a message when forcing scatter mode
  ixgbe: add log messages when rx bulk mode is not usable
  i40e: clean log messages
  i40e: always log init messages
  i40e: add log messages when rx bulk mode is not usable
  e1000: clean log messages
  e1000: always log init messages
  e1000: add a message when forcing scatter mode
  eal: set log level from command line

 lib/librte_eal/bsdapp/eal/eal.c                    |   43 +++++++++
 .../bsdapp/eal/include/eal_internal_cfg.h          |    1 +
 lib/librte_eal/linuxapp/eal/eal.c                  |   43 +++++++++
 .../linuxapp/eal/include/eal_internal_cfg.h        |    1 +
 lib/librte_pmd_e1000/e1000_logs.h                  |   17 ++--
 lib/librte_pmd_e1000/em_ethdev.c                   |   47 +++++-----
 lib/librte_pmd_e1000/em_rxtx.c                     |   39 ++++----
 lib/librte_pmd_e1000/igb_ethdev.c                  |   75 +++++++--------
 lib/librte_pmd_e1000/igb_rxtx.c                    |   23 ++++-
 lib/librte_pmd_i40e/i40e/i40e_osdep.h              |    2 +-
 lib/librte_pmd_i40e/i40e_ethdev.c                  |   43 ++++-----
 lib/librte_pmd_i40e/i40e_ethdev_vf.c               |    4 +-
 lib/librte_pmd_i40e/i40e_logs.h                    |   17 ++--
 lib/librte_pmd_i40e/i40e_pf.c                      |    4 +-
 lib/librte_pmd_i40e/i40e_rxtx.c                    |   35 +++++--
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c                |   99 ++++++++++----------
 lib/librte_pmd_ixgbe/ixgbe_fdir.c                  |   12 +--
 lib/librte_pmd_ixgbe/ixgbe_logs.h                  |   17 ++--
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c                  |   51 +++++++---
 19 files changed, 360 insertions(+), 213 deletions(-)

-- 
1.7.10.4
#2 lore raw

PATCH 1/11 ixgbe: clean log messages

In reply to a message not in the archive

Clean log messages:
- remove superfluous \n in log macros and add some \n where needed,
- remove leading \n in some messages,
- split multi lines messages,
- replace some PMD_INIT_LOG(DEBUG, "some_func\n") with PMD_INIT_FUNC_TRACE().

---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   99 +++++++++++++++++------------------
 lib/librte_pmd_ixgbe/ixgbe_fdir.c   |   12 ++---
 lib/librte_pmd_ixgbe/ixgbe_logs.h   |   12 ++---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |   14 ++---
 4 files changed, 68 insertions(+), 69 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +49 -50
index 59122a1..ac00323 100644
@@ -737,7 +737,7 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 #endif /* RTE_NIC_BYPASS */
 
 	if (diag != IXGBE_SUCCESS) {
-		PMD_INIT_LOG(ERR, "Shared code init failed: %d", diag);
+		PMD_INIT_LOG(ERR, "Shared code init failed: %d\n", diag);
 		return -EIO;
 	}
 
@@ -763,7 +763,7 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 	/* Make sure we have a good EEPROM before we read from it */
 	diag = ixgbe_validate_eeprom_checksum(hw, &csum);
 	if (diag != IXGBE_SUCCESS) {
-		PMD_INIT_LOG(ERR, "The EEPROM checksum is not valid: %d", diag);
+		PMD_INIT_LOG(ERR, "The EEPROM checksum is not valid: %d\n", diag);
 		return -EIO;
 	}
 
@@ -791,13 +791,14 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 	if (diag == IXGBE_ERR_EEPROM_VERSION) {
 		PMD_INIT_LOG(ERR, "This device is a pre-production adapter/"
 		    "LOM.  Please be aware there may be issues associated "
-		    "with your hardware.\n If you are experiencing problems "
+		    "with your hardware.\n");
+		PMD_INIT_LOG(ERR, "If you are experiencing problems "
 		    "please contact your Intel or hardware representative "
 		    "who provided you with this hardware.\n");
 	} else if (diag == IXGBE_ERR_SFP_NOT_SUPPORTED)
 		PMD_INIT_LOG(ERR, "Unsupported SFP+ Module\n");
 	if (diag) {
-		PMD_INIT_LOG(ERR, "Hardware Initialization Failure: %d", diag);
+		PMD_INIT_LOG(ERR, "Hardware Initialization Failure: %d\n", diag);
 		return -EIO;
 	}
 
@@ -813,7 +814,7 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 	if (eth_dev->data->mac_addrs == NULL) {
 		PMD_INIT_LOG(ERR,
 			"Failed to allocate %u bytes needed to store "
-			"MAC addresses",
+			"MAC addresses\n",
 			ETHER_ADDR_LEN * hw->mac.num_rar_entries);
 		return -ENOMEM;
 	}
@@ -826,7 +827,8 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 			IXGBE_VMDQ_NUM_UC_MAC, 0);
 	if (eth_dev->data->hash_mac_addrs == NULL) {
 		PMD_INIT_LOG(ERR,
-			"Failed to allocate %d bytes needed to store MAC addresses",
+			"Failed to allocate %d bytes needed to store "
+			"MAC addresses\n",
 			ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC);
 		return -ENOMEM;
 	}
@@ -850,14 +852,14 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 
 	if (ixgbe_is_sfp(hw) && hw->phy.sfp_type != ixgbe_sfp_type_not_present)
 		PMD_INIT_LOG(DEBUG,
-			     "MAC: %d, PHY: %d, SFP+: %d<n",
+			     "MAC: %d, PHY: %d, SFP+: %d\n",
 			     (int) hw->mac.type, (int) hw->phy.type,
 			     (int) hw->phy.sfp_type);
 	else
 		PMD_INIT_LOG(DEBUG, "MAC: %d, PHY: %d\n",
 			     (int) hw->mac.type, (int) hw->phy.type);
 
-	PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
+	PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x\n",
 			eth_dev->data->port_id, pci_dev->id.vendor_id,
 			pci_dev->id.device_id);
 
@@ -933,7 +935,7 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 		IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private);
 	struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr;
 
-	PMD_INIT_LOG(DEBUG, "eth_ixgbevf_dev_init");
+	PMD_INIT_FUNC_TRACE();
 
 	eth_dev->dev_ops = &ixgbevf_eth_dev_ops;
 	eth_dev->rx_pkt_burst = &ixgbe_recv_pkts;
@@ -963,7 +965,8 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 	/* Initialize the shared code (base driver) */
 	diag = ixgbe_init_shared_code(hw);
 	if (diag != IXGBE_SUCCESS) {
-		PMD_INIT_LOG(ERR, "Shared code init failed for ixgbevf: %d", diag);
+		PMD_INIT_LOG(ERR, "Shared code init failed for ixgbevf: %d\n",
+			     diag);
 		return -EIO;
 	}
 
@@ -982,7 +985,7 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 	 * In this case, assign a random MAC address.
 	 */
 	if ((diag != IXGBE_SUCCESS) && (diag != IXGBE_ERR_INVALID_MAC_ADDR)) {
-		PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", diag);
+		PMD_INIT_LOG(ERR, "VF Initialization Failure: %d\n", diag);
 		return (diag);
 	}
 
@@ -998,7 +1001,7 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 	if (eth_dev->data->mac_addrs == NULL) {
 		PMD_INIT_LOG(ERR,
 			"Failed to allocate %u bytes needed to store "
-			"MAC addresses",
+			"MAC addresses\n",
 			ETHER_ADDR_LEN * hw->mac.num_rar_entries);
 		return -ENOMEM;
 	}
@@ -1034,11 +1037,12 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
 			break;
 
 		default:
-			PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", diag);
+			PMD_INIT_LOG(ERR, "VF Initialization Failure: %d\n",
+				     diag);
 			return (-EIO);
 	}
 
-	PMD_INIT_LOG(DEBUG, "\nport %d vendorID=0x%x deviceID=0x%x mac.type=%s\n",
+	PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x mac.type=%s\n",
 			 eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id,
 			 "ixgbe_mac_82599_vf");
 
@@ -1207,7 +1211,7 @@ ixgbe_vlan_hw_strip_disable(struct rte_eth_dev *dev, uint16_t queue)
 
 	if (hw->mac.type == ixgbe_mac_82598EB) {
 		/* No queue level support */
-		PMD_INIT_LOG(INFO, "82598EB not support queue level hw strip");
+		PMD_INIT_LOG(INFO, "82598EB not support queue level hw strip\n");
 		return;
 	}
 	else {
@@ -1231,7 +1235,7 @@ ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue)
 
 	if (hw->mac.type == ixgbe_mac_82598EB) {
 		/* No queue level supported */
-		PMD_INIT_LOG(INFO, "82598EB not support queue level hw strip");
+		PMD_INIT_LOG(INFO, "82598EB not support queue level hw strip\n");
 		return;
 	}
 	else {
@@ -1543,7 +1547,7 @@ skip_link_setup:
 	return (0);
 
 error:
-	PMD_INIT_LOG(ERR, "failure in ixgbe_dev_start(): %d", err);
+	PMD_INIT_LOG(ERR, "failure in ixgbe_dev_start(): %d\n", err);
 	ixgbe_dev_clear_queues(dev);
 	return -EIO;
 }
@@ -1599,10 +1603,8 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 #ifdef RTE_NIC_BYPASS
 		if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) {
 			/* Not suported in bypass mode */
-			PMD_INIT_LOG(ERR,
-				"\nSet link up is not supported "
-				"by device id 0x%x\n",
-				hw->device_id);
+			PMD_INIT_LOG(ERR, "Set link up is not supported "
+				     "by device id 0x%x\n", hw->device_id);
 			return -ENOTSUP;
 		}
 #endif
@@ -1611,8 +1613,8 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 		return 0;
 	}
 
-	PMD_INIT_LOG(ERR, "\nSet link up is not supported by device id 0x%x\n",
-		hw->device_id);
+	PMD_INIT_LOG(ERR, "Set link up is not supported by device id 0x%x\n",
+		     hw->device_id);
 	return -ENOTSUP;
 }
 
@@ -1628,10 +1630,8 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 #ifdef RTE_NIC_BYPASS
 		if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) {
 			/* Not suported in bypass mode */
-			PMD_INIT_LOG(ERR,
-				"\nSet link down is not supported "
-				"by device id 0x%x\n",
-				 hw->device_id);
+			PMD_INIT_LOG(ERR, "Set link down is not supported "
+				     "by device id 0x%x\n", hw->device_id);
 			return -ENOTSUP;
 		}
 #endif
@@ -1640,9 +1640,8 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 		return 0;
 	}
 
-	PMD_INIT_LOG(ERR,
-		"\nSet link down is not supported by device id 0x%x\n",
-		 hw->device_id);
+	PMD_INIT_LOG(ERR, "Set link down is not supported by device id 0x%x\n",
+		     hw->device_id);
 	return -ENOTSUP;
 }
 
@@ -2113,7 +2112,7 @@ ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev)
 
 	/* read-on-clear nic registers here */
 	eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
-	PMD_DRV_LOG(INFO, "eicr %x", eicr);
+	PMD_DRV_LOG(INFO, "eicr %x\n", eicr);
 
 	intr->flags = 0;
 	if (eicr & IXGBE_EICR_LSC) {
@@ -2145,16 +2144,16 @@ ixgbe_dev_link_status_print(struct rte_eth_dev *dev)
 	memset(&link, 0, sizeof(link));
 	rte_ixgbe_dev_atomic_read_link_status(dev, &link);
 	if (link.link_status) {
-		PMD_INIT_LOG(INFO, "Port %d: Link Up - speed %u Mbps - %s",
+		PMD_INIT_LOG(INFO, "Port %d: Link Up - speed %u Mbps - %s\n",
 					(int)(dev->data->port_id),
 					(unsigned)link.link_speed,
 			link.link_duplex == ETH_LINK_FULL_DUPLEX ?
 					"full-duplex" : "half-duplex");
 	} else {
-		PMD_INIT_LOG(INFO, " Port %d: Link Down",
+		PMD_INIT_LOG(INFO, " Port %d: Link Down\n",
 				(int)(dev->data->port_id));
 	}
-	PMD_INIT_LOG(INFO, "PCI Address: %04d:%02d:%02d:%d",
+	PMD_INIT_LOG(INFO, "PCI Address: %04d:%02d:%02d:%d\n",
 				dev->pci_dev->addr.domain,
 				dev->pci_dev->addr.bus,
 				dev->pci_dev->addr.devid,
@@ -2211,9 +2210,9 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev)
 	if (intr_enable_delay) {
 		if (rte_eal_alarm_set(timeout * 1000,
 				      ixgbe_dev_interrupt_delayed_handler, (void*)dev) < 0)
-			PMD_DRV_LOG(ERR, "Error setting alarm");
+			PMD_DRV_LOG(ERR, "Error setting alarm\n");
 	} else {
-		PMD_DRV_LOG(DEBUG, "enable intr immediately");
+		PMD_DRV_LOG(DEBUG, "enable intr immediately\n");
 		ixgbe_enable_intr(dev);
 		rte_intr_enable(&(dev->pci_dev->intr_handle));
 	}
@@ -2371,7 +2370,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	if (fc_conf->autoneg != !hw->fc.disable_fc_autoneg)
 		return -ENOTSUP;
 	rx_buf_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(0));
-	PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x \n", rx_buf_size);
+	PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x\n", rx_buf_size);
 
 	/*
 	 * At least reserve one Ethernet frame for watermark
@@ -2413,7 +2412,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		return 0;
 	}
 
-	PMD_INIT_LOG(ERR, "ixgbe_fc_enable = 0x%x \n", err);
+	PMD_INIT_LOG(ERR, "ixgbe_fc_enable = 0x%x\n", err);
 	return -EIO;
 }
 
@@ -2593,7 +2592,7 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p
 	ixgbe_dcb_unpack_map_cee(dcb_config, IXGBE_DCB_RX_CONFIG, map);
 	tc_num = map[pfc_conf->priority];
 	rx_buf_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(tc_num));
-	PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x \n", rx_buf_size);
+	PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x\n", rx_buf_size);
 	/*
 	 * At least reserve one Ethernet frame for watermark
 	 * high_water/low_water in kilo bytes for ixgbe
@@ -2618,7 +2617,7 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *p
 	if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED))
 		return 0;
 
-	PMD_INIT_LOG(ERR, "ixgbe_dcb_pfc_enable = 0x%x \n", err);
+	PMD_INIT_LOG(ERR, "ixgbe_dcb_pfc_enable = 0x%x\n", err);
 	return -EIO;
 }
 
@@ -2765,7 +2764,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 static void
 ixgbevf_intr_disable(struct ixgbe_hw *hw)
 {
-	PMD_INIT_LOG(DEBUG, "ixgbevf_intr_disable");
+	PMD_INIT_FUNC_TRACE();
 
 	/* Clear interrupt mask to stop from interrupts being generated */
 	IXGBE_WRITE_REG(hw, IXGBE_VTEIMC, IXGBE_VF_IRQ_CLEAR_MASK);
@@ -2778,8 +2777,8 @@ ixgbevf_dev_configure(struct rte_eth_dev *dev)
 {
 	struct rte_eth_conf* conf = &dev->data->dev_conf;
 
-	PMD_INIT_LOG(DEBUG, "\nConfigured Virtual Function port id: %d\n",
-		dev->data->port_id);
+	PMD_INIT_LOG(DEBUG, "Configured Virtual Function port id: %d\n",
+		     dev->data->port_id);
 
 	/*
 	 * VF has no ability to enable/disable HW CRC
@@ -2807,7 +2806,7 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
 		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	int err, mask = 0;
 
-	PMD_INIT_LOG(DEBUG, "ixgbevf_dev_start");
+	PMD_INIT_FUNC_TRACE();
 
 	hw->mac.ops.reset_hw(hw);
 
@@ -2842,7 +2841,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	PMD_INIT_LOG(DEBUG, "ixgbevf_dev_stop");
+	PMD_INIT_FUNC_TRACE();
 
 	hw->adapter_stopped = TRUE;
 	ixgbe_stop_adapter(hw);
@@ -2861,7 +2860,7 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	PMD_INIT_LOG(DEBUG, "ixgbevf_dev_close");
+	PMD_INIT_FUNC_TRACE();
 
 	ixgbe_reset_hw(hw);
 
@@ -2908,7 +2907,7 @@ ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	/* vind is not used in VF driver, set to 0, check ixgbe_set_vfta_vf */
 	ret = ixgbe_set_vfta(hw, vlan_id, 0, !!on);
 	if(ret){
-		PMD_INIT_LOG(ERR, "Unable to set VF vlan");
+		PMD_INIT_LOG(ERR, "Unable to set VF vlan\n");
 		return ret;
 	}
 	vid_idx = (uint32_t) ((vlan_id >> 5) & 0x7F);
@@ -3477,7 +3476,7 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
 	diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes);
 	if (diag == 0)
 		return;
-	PMD_DRV_LOG(ERR, "Unable to add MAC address - diag=%d", diag);
+	PMD_DRV_LOG(ERR, "Unable to add MAC address - diag=%d\n", diag);
 }
 
 static void
@@ -3517,7 +3516,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
 			PMD_DRV_LOG(ERR,
 				    "Adding again MAC address "
 				    "%02x:%02x:%02x:%02x:%02x:%02x failed "
-				    "diag=%d",
+				    "diag=%d\n",
 				    mac_addr->addr_bytes[0],
 				    mac_addr->addr_bytes[1],
 				    mac_addr->addr_bytes[2],
@@ -3806,7 +3805,7 @@ ixgbe_add_5tuple_filter(struct rte_eth_dev *dev, uint16_t index,
 		return -EINVAL;  /* filter index is out of range. */
 
 	if (filter->tcp_flags) {
-		PMD_INIT_LOG(INFO, "82599EB not tcp flags in 5tuple");
+		PMD_INIT_LOG(INFO, "82599EB not tcp flags in 5tuple\n");
 		return -EINVAL;
 	}
 
lib/librte_pmd_ixgbe/ixgbe_fdir.c +6 -6
index 6c0a530..c78a450 100644
@@ -139,7 +139,7 @@ configure_fdir_flags(struct rte_fdir_conf *conf, uint32_t *fdirctrl)
 		break;
 	default:
 		/* bad value */
-		PMD_INIT_LOG(ERR, "Invalid fdir_conf->pballoc value");
+		PMD_INIT_LOG(ERR, "Invalid fdir_conf->pballoc value\n");
 		return -EINVAL;
 	};
 
@@ -158,7 +158,7 @@ configure_fdir_flags(struct rte_fdir_conf *conf, uint32_t *fdirctrl)
 		break;
 	default:
 		/* bad value */
-		PMD_INIT_LOG(ERR, "Invalid fdir_conf->status value");
+		PMD_INIT_LOG(ERR, "Invalid fdir_conf->status value\n");
 		return -EINVAL;
 	};
 
@@ -395,7 +395,7 @@ fdir_filter_to_atr_input(struct rte_fdir_filter *fdir_filter,
 	if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP ||
 			fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) &&
 			(fdir_filter->port_src || fdir_filter->port_dst)) {
-		PMD_INIT_LOG(ERR, "Invalid fdir_filter");
+		PMD_INIT_LOG(ERR, "Invalid fdir_filter\n");
 		return -EINVAL;
 	}
 
@@ -420,7 +420,7 @@ fdir_filter_to_atr_input(struct rte_fdir_filter *fdir_filter,
 		input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV4;
 		break;
 	default:
-		PMD_INIT_LOG(ERR, " Error on l4type input");
+		PMD_INIT_LOG(ERR, " Error on l4type input\n");
 		return -EINVAL;
 	}
 
@@ -524,7 +524,7 @@ fdir_erase_filter_82599(struct ixgbe_hw *hw,
 	}
 
 	if (!retry_count) {
-		PMD_INIT_LOG(ERR, "Timeout querying for flow director filter");
+		PMD_INIT_LOG(ERR, "Timeout querying for flow director filter\n");
 		err = -EIO;
 	}
 
@@ -678,7 +678,7 @@ ixgbe_fdir_set_masks(struct rte_eth_dev *dev, struct rte_fdir_masks *fdir_masks)
 
 	err = ixgbe_reinit_fdir_tables_82599(hw);
 	if (err) {
-		PMD_INIT_LOG(ERR, "reinit of fdir tables failed");
+		PMD_INIT_LOG(ERR, "reinit of fdir tables failed\n");
 		return -EIO;
 	}
 
lib/librte_pmd_ixgbe/ixgbe_logs.h +6 -6
index 9f0a684..22d8cfb 100644
@@ -36,8 +36,8 @@
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_INIT
 #define PMD_INIT_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
-#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>\n")
 #else
 #define PMD_INIT_LOG(level, fmt, args...) do { } while(0)
 #define PMD_INIT_FUNC_TRACE() do { } while(0)
@@ -45,28 +45,28 @@
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_RX
 #define PMD_RX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_RX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_TX
 #define PMD_TX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_TX_FREE
 #define PMD_TX_FREE_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_DRIVER
 #define PMD_DRV_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_DRV_LOG(level, fmt, args...) do { } while(0)
 #endif
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +7 -7
index dfc2076..cbec821 100644
@@ -492,7 +492,7 @@ ixgbe_xmit_cleanup(struct igb_tx_queue *txq)
 	{
 		PMD_TX_FREE_LOG(DEBUG,
 				"TX descriptor %4u is not done"
-				"(port=%d queue=%d)",
+				"(port=%d queue=%d)\n",
 				desc_to_clean_to,
 				txq->port_id, txq->queue_id);
 		/* Failed to clean any descriptors, better luck next time */
@@ -509,7 +509,7 @@ ixgbe_xmit_cleanup(struct igb_tx_queue *txq)
 
 	PMD_TX_FREE_LOG(DEBUG,
 			"Cleaning %4u TX descriptors: %4u to %4u "
-			"(port=%d queue=%d)",
+			"(port=%d queue=%d)\n",
 			nb_tx_to_clean, last_desc_cleaned, desc_to_clean_to,
 			txq->port_id, txq->queue_id);
 
@@ -630,7 +630,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			PMD_TX_FREE_LOG(DEBUG,
 					"Not enough free TX descriptors "
 					"nb_used=%4u nb_free=%4u "
-					"(port=%d queue=%d)",
+					"(port=%d queue=%d)\n",
 					nb_used, txq->nb_tx_free,
 					txq->port_id, txq->queue_id);
 
@@ -650,7 +650,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 					"performance."
 					"nb_used=%4u nb_free=%4u "
 					"tx_rs_thresh=%4u. "
-					"(port=%d queue=%d)",
+					"(port=%d queue=%d)\n",
 					nb_used, txq->nb_tx_free,
 					txq->tx_rs_thresh,
 					txq->port_id, txq->queue_id);
@@ -782,7 +782,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		if (txq->nb_tx_used >= txq->tx_rs_thresh) {
 			PMD_TX_FREE_LOG(DEBUG,
 					"Setting RS bit on TXD id="
-					"%4u (port=%d queue=%d)",
+					"%4u (port=%d queue=%d)\n",
 					tx_last, txq->port_id, txq->queue_id);
 
 			cmd_type_len |= IXGBE_TXD_CMD_RS;
@@ -798,7 +798,7 @@ end_of_tx:
 	/*
 	 * Set the Transmit Descriptor Tail (TDT)
 	 */
-	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u",
+	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u\n",
 		   (unsigned) txq->port_id, (unsigned) txq->queue_id,
 		   (unsigned) tx_id, (unsigned) nb_tx);
 	IXGBE_PCI_REG_WRITE(txq->tdt_reg_addr, tx_id);
@@ -1383,7 +1383,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * to happen by sending specific "back-pressure" flow control
 		 * frames to its peer(s).
 		 */
-		PMD_RX_LOG(DEBUG, "\nport_id=%u queue_id=%u rx_id=%u "
+		PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_id=%u "
 			   "staterr=0x%x data_len=%u\n",
 			   (unsigned) rxq->port_id, (unsigned) rxq->queue_id,
 			   (unsigned) rx_id, (unsigned) staterr,
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH 2/11 ixgbe: always log init messages

In reply to a message not in the archive

'init' messages should always be logged and filtered at runtime by rte_log. All the more so as these messages are not in the datapath.

---
 lib/librte_pmd_ixgbe/ixgbe_logs.h |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_logs.h +4 -3
index 22d8cfb..88fa7d5 100644
@@ -34,12 +34,13 @@
 #ifndef _IXGBE_LOGS_H_
 #define _IXGBE_LOGS_H_
 
-#ifdef RTE_LIBRTE_IXGBE_DEBUG_INIT
 #define PMD_INIT_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
+	rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD, \
+		"PMD: %s(): " fmt, __func__, ##args)
+
+#ifdef RTE_LIBRTE_IXGBE_DEBUG_INIT
 #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>\n")
 #else
-#define PMD_INIT_LOG(level, fmt, args...) do { } while(0)
 #define PMD_INIT_FUNC_TRACE() do { } while(0)
 #endif
 
Signature · 1 line
1.7.10.4
#13 lore raw

PATCH 3/11 ixgbe: add a message when forcing scatter mode

In reply to a message not in the archive
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c |    8 ++++++++
 1 file changed, 8 insertions(+)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +8 -0
index cbec821..e2804bd 100644
@@ -3482,12 +3482,16 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
 		/* It adds dual VLAN length for supporting dual VLAN */
 		if ((dev->data->dev_conf.rxmode.max_rx_pkt_len +
 				2 * IXGBE_VLAN_TAG_SIZE) > buf_size){
+			if (!dev->data->scattered_rx)
+				PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 			dev->data->scattered_rx = 1;
 			dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
 		}
 	}
 
 	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		if (!dev->data->scattered_rx)
+			PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 		dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
 		dev->data->scattered_rx = 1;
 	}
@@ -3975,12 +3979,16 @@ ixgbevf_dev_rx_init(struct rte_eth_dev *dev)
 		/* It adds dual VLAN length for supporting dual VLAN */
 		if ((dev->data->dev_conf.rxmode.max_rx_pkt_len +
 				2 * IXGBE_VLAN_TAG_SIZE) > buf_size) {
+			if (!dev->data->scattered_rx)
+				PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 			dev->data->scattered_rx = 1;
 			dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
 		}
 	}
 
 	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		if (!dev->data->scattered_rx)
+			PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 		dev->rx_pkt_burst = ixgbe_recv_scattered_pkts;
 		dev->data->scattered_rx = 1;
 	}
Signature · 1 line
1.7.10.4
#14 lore raw

PATCH 4/11 ixgbe: add log messages when rx bulk mode is not usable

In reply to a message not in the archive
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c |   29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +24 -5
index e2804bd..7d6c7ea 100644
@@ -1969,15 +1969,34 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused struct igb_rx_queue *rxq)
 	 * outside of this function.
 	 */
 #ifdef RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC
-	if (! (rxq->rx_free_thresh >= RTE_PMD_IXGBE_RX_MAX_BURST))
+	if (! (rxq->rx_free_thresh >= RTE_PMD_IXGBE_RX_MAX_BURST)) {
+		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
+			     "rxq->rx_free_thresh=%d, "
+			     "RTE_PMD_IXGBE_RX_MAX_BURST=%d\n",
+			     rxq->rx_free_thresh, RTE_PMD_IXGBE_RX_MAX_BURST);
 		ret = -EINVAL;
-	else if (! (rxq->rx_free_thresh < rxq->nb_rx_desc))
+	} else if (! (rxq->rx_free_thresh < rxq->nb_rx_desc)) {
+		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
+			     "rxq->rx_free_thresh=%d, "
+			     "rxq->nb_rx_desc=%d\n",
+			     rxq->rx_free_thresh, rxq->nb_rx_desc);
 		ret = -EINVAL;
-	else if (! ((rxq->nb_rx_desc % rxq->rx_free_thresh) == 0))
+	} else if (! ((rxq->nb_rx_desc % rxq->rx_free_thresh) == 0)) {
+		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
+			     "rxq->nb_rx_desc=%d, "
+			     "rxq->rx_free_thresh=%d\n",
+			     rxq->nb_rx_desc, rxq->rx_free_thresh);
 		ret = -EINVAL;
-	else if (! (rxq->nb_rx_desc <
-	       (IXGBE_MAX_RING_DESC - RTE_PMD_IXGBE_RX_MAX_BURST)))
+	} else if (! (rxq->nb_rx_desc <
+	       (IXGBE_MAX_RING_DESC - RTE_PMD_IXGBE_RX_MAX_BURST))) {
+		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
+			     "rxq->nb_rx_desc=%d, "
+			     "IXGBE_MAX_RING_DESC=%d, "
+			     "RTE_PMD_IXGBE_RX_MAX_BURST=%d\n",
+			     rxq->nb_rx_desc, IXGBE_MAX_RING_DESC,
+			     RTE_PMD_IXGBE_RX_MAX_BURST);
 		ret = -EINVAL;
+	}
 #else
 	ret = -EINVAL;
 #endif
Signature · 1 line
1.7.10.4
#15 lore raw

PATCH 5/11 i40e: clean log messages

In reply to a message not in the archive

Clean log messages:
- remove superfluous \n in log macros and add some \n where needed,
- remove leading \n in some messages,
- split multi lines messages,
- replace some PMD_INIT_LOG(DEBUG, "some_func\n") with PMD_INIT_FUNC_TRACE().

---
 lib/librte_pmd_i40e/i40e/i40e_osdep.h |    2 +-
 lib/librte_pmd_i40e/i40e_ethdev.c     |   43 +++++++++++++++++----------------
 lib/librte_pmd_i40e/i40e_ethdev_vf.c  |    4 +--
 lib/librte_pmd_i40e/i40e_logs.h       |   12 ++++-----
 lib/librte_pmd_i40e/i40e_pf.c         |    4 +--
 lib/librte_pmd_i40e/i40e_rxtx.c       |    6 ++---
 6 files changed, 36 insertions(+), 35 deletions(-)
lib/librte_pmd_i40e/i40e/i40e_osdep.h +1 -1
index 0ed4b65..5f1c98f 100644
@@ -112,7 +112,7 @@ typedef enum i40e_status_code i40e_status;
 #define i40e_debug(h, m, s, ...)                                \
 do {                                                            \
 	if (((m) & (h)->debug_mask))                            \
-		PMD_DRV_LOG(DEBUG, "i40e %02x.%x " s,           \
+		PMD_DRV_LOG(DEBUG, "i40e %02x.%x\n" s,          \
 			(h)->bus.device, (h)->bus.func,         \
 					##__VA_ARGS__);         \
 } while (0)
lib/librte_pmd_i40e/i40e_ethdev.c +22 -21

145 lines not on this page · raw message

lib/librte_pmd_i40e/i40e_ethdev_vf.c +2 -2
index d8552ad..7672aa8 100644
@@ -1101,7 +1101,7 @@ i40evf_dev_init(__rte_unused struct eth_driver *eth_drv,
 					ETHER_ADDR_LEN, 0);
 	if (eth_dev->data->mac_addrs == NULL) {
 		PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to "
-				"store MAC addresses", ETHER_ADDR_LEN);
+				"store MAC addresses\n", ETHER_ADDR_LEN);
 		return -ENOMEM;
 	}
 	ether_addr_copy((struct ether_addr *)hw->mac.addr,
@@ -1384,7 +1384,7 @@ i40evf_dev_start(struct rte_eth_dev *dev)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ether_addr mac_addr;
 
-	PMD_DRV_LOG(DEBUG, "i40evf_dev_start");
+	PMD_INIT_FUNC_TRACE();
 
 	vf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
 	if (dev->data->dev_conf.rxmode.jumbo_frame == 1) {
lib/librte_pmd_i40e/i40e_logs.h +6 -6
index f991dd2..b78e2a1 100644
@@ -36,8 +36,8 @@
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_INIT
 #define PMD_INIT_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
-#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>\n")
 #else
 #define PMD_INIT_LOG(level, fmt, args...) do { } while(0)
 #define PMD_INIT_FUNC_TRACE() do { } while(0)
@@ -45,28 +45,28 @@
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_RX
 #define PMD_RX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_RX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_TX
 #define PMD_TX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_TX_FREE
 #define PMD_TX_FREE_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_I40E_DEBUG_DRIVER
 #define PMD_DRV_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_DRV_LOG(level, fmt, args...) do { } while(0)
 #endif
lib/librte_pmd_i40e/i40e_pf.c +2 -2
index e8b154d..0a726d6 100644
@@ -439,7 +439,7 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 		/* Apply VF RX queue setting to HMC */
 		if (i40e_pf_host_hmc_config_rxq(hw, vf, &qpair[i].rxq)
 			!= I40E_SUCCESS) {
-			PMD_DRV_LOG(ERR, "Configure RX queue HMC failed");
+			PMD_DRV_LOG(ERR, "Configure RX queue HMC failed\n");
 			ret = I40E_ERR_PARAM;
 			goto send_msg;
 		}
@@ -447,7 +447,7 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,
 		/* Apply VF TX queue setting to HMC */
 		if (i40e_pf_host_hmc_config_txq(hw, vf, &qpair[i].txq)
 			!= I40E_SUCCESS) {
-			PMD_DRV_LOG(ERR, "Configure TX queue HMC failed");
+			PMD_DRV_LOG(ERR, "Configure TX queue HMC failed\n");
 			ret = I40E_ERR_PARAM;
 			goto send_msg;
 		}
lib/librte_pmd_i40e/i40e_rxtx.c +3 -3
index f153844..d592ad6 100644
@@ -507,7 +507,7 @@ i40e_xmit_cleanup(struct i40e_tx_queue *txq)
 	if (!(txd[desc_to_clean_to].cmd_type_offset_bsz &
 		rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))) {
 		PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done "
-			"(port=%d queue=%d)", desc_to_clean_to,
+				"(port=%d queue=%d)\n", desc_to_clean_to,
 				txq->port_id, txq->queue_id);
 		return -1;
 	}
@@ -1219,7 +1219,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		if (txq->nb_tx_used >= txq->tx_rs_thresh) {
 			PMD_TX_FREE_LOG(DEBUG,
 					"Setting RS bit on TXD id="
-					"%4u (port=%d queue=%d)",
+					"%4u (port=%d queue=%d)\n",
 					tx_last, txq->port_id, txq->queue_id);
 
 			td_cmd |= I40E_TX_DESC_CMD_RS;
@@ -1236,7 +1236,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 end_of_tx:
 	rte_wmb();
 
-	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u",
+	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u\n",
 		   (unsigned) txq->port_id, (unsigned) txq->queue_id,
 		   (unsigned) tx_id, (unsigned) nb_tx);
 
Signature · 1 line
1.7.10.4
#16 lore raw

PATCH 6/11 i40e: always log init messages

In reply to a message not in the archive

'init' messages should always be logged and filtered at runtime by rte_log. All the more so as these messages are not in the datapath.

---
 lib/librte_pmd_i40e/i40e_logs.h |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
lib/librte_pmd_i40e/i40e_logs.h +4 -3
index b78e2a1..1430a32 100644
@@ -34,12 +34,13 @@
 #ifndef _I40E_LOGS_H_
 #define _I40E_LOGS_H_
 
-#ifdef RTE_LIBRTE_I40E_DEBUG_INIT
 #define PMD_INIT_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
+	rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD, \
+		"PMD: %s(): " fmt, __func__, ##args)
+
+#ifdef RTE_LIBRTE_I40E_DEBUG_INIT
 #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>\n")
 #else
-#define PMD_INIT_LOG(level, fmt, args...) do { } while(0)
 #define PMD_INIT_FUNC_TRACE() do { } while(0)
 #endif
 
Signature · 1 line
1.7.10.4
#17 lore raw

PATCH 7/11 i40e: add log messages when rx bulk mode is not usable

In reply to a message not in the archive
---
 lib/librte_pmd_i40e/i40e_rxtx.c |   29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
lib/librte_pmd_i40e/i40e_rxtx.c +24 -5
index d592ad6..de3701d 100644
@@ -537,15 +537,34 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused struct i40e_rx_queue *rxq)
 	int ret = 0;
 
 #ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
-	if (!(rxq->rx_free_thresh >= RTE_PMD_I40E_RX_MAX_BURST))
+	if (!(rxq->rx_free_thresh >= RTE_PMD_I40E_RX_MAX_BURST)) {
+		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
+			     "rxq->rx_free_thresh=%d, "
+			     "RTE_PMD_I40E_RX_MAX_BURST=%d\n",
+			     rxq->rx_free_thresh, RTE_PMD_I40E_RX_MAX_BURST);
 		ret = -EINVAL;
-	else if (!(rxq->rx_free_thresh < rxq->nb_rx_desc))
+	} else if (!(rxq->rx_free_thresh < rxq->nb_rx_desc)) {
+		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
+			     "rxq->rx_free_thresh=%d, "
+			     "rxq->nb_rx_desc=%d\n",
+			     rxq->rx_free_thresh, rxq->nb_rx_desc);
 		ret = -EINVAL;
-	else if (!(rxq->nb_rx_desc % rxq->rx_free_thresh) == 0)
+	} else if (!(rxq->nb_rx_desc % rxq->rx_free_thresh) == 0) {
+		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
+			     "rxq->nb_rx_desc=%d, "
+			     "rxq->rx_free_thresh=%d\n",
+			     rxq->nb_rx_desc, rxq->rx_free_thresh);
 		ret = -EINVAL;
-	else if (!(rxq->nb_rx_desc < (I40E_MAX_RING_DESC -
-				RTE_PMD_I40E_RX_MAX_BURST)))
+	} else if (!(rxq->nb_rx_desc < (I40E_MAX_RING_DESC -
+				RTE_PMD_I40E_RX_MAX_BURST))) {
+		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
+			     "rxq->nb_rx_desc=%d, "
+			     "I40E_MAX_RING_DESC=%d, "
+			     "RTE_PMD_I40E_RX_MAX_BURST=%d\n",
+			     rxq->nb_rx_desc, I40E_MAX_RING_DESC,
+			     RTE_PMD_I40E_RX_MAX_BURST);
 		ret = -EINVAL;
+	}
 #else
 	ret = -EINVAL;
 #endif
Signature · 1 line
1.7.10.4
#18 lore raw

PATCH 8/11 e1000: clean log messages

In reply to a message not in the archive

Clean log messages:
- remove superfluous \n in log macros and add some \n where needed,
- remove leading \n in some messages,
- split multi lines messages,
- introduce PMD_INIT_FUNC_TRACE and replace some PMD_INIT_LOG(DEBUG, "func\n").

---
 lib/librte_pmd_e1000/e1000_logs.h |   12 +++---
 lib/librte_pmd_e1000/em_ethdev.c  |   47 +++++++++++------------
 lib/librte_pmd_e1000/em_rxtx.c    |   35 ++++++++---------
 lib/librte_pmd_e1000/igb_ethdev.c |   75 ++++++++++++++++++-------------------
 lib/librte_pmd_e1000/igb_rxtx.c   |    9 +++--
 5 files changed, 85 insertions(+), 93 deletions(-)
lib/librte_pmd_e1000/e1000_logs.h +7 -5
index b6b3bb7..02f5930 100644
@@ -36,35 +36,37 @@
 
 #ifdef RTE_LIBRTE_E1000_DEBUG_INIT
 #define PMD_INIT_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>\n")
 #else
 #define PMD_INIT_LOG(level, fmt, args...) do { } while(0)
+#define PMD_INIT_FUNC_TRACE() do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_E1000_DEBUG_RX
 #define PMD_RX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_RX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_E1000_DEBUG_TX
 #define PMD_TX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE
 #define PMD_TX_FREE_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_E1000_DEBUG_DRIVER
 #define PMD_DRV_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_DRV_LOG(level, fmt, args...) do { } while(0)
 #endif
lib/librte_pmd_e1000/em_ethdev.c +22 -25

138 lines not on this page · raw message

lib/librte_pmd_e1000/em_rxtx.c +15 -20
index f254858..fd082f8 100644
@@ -317,10 +317,8 @@ em_xmit_cleanup(struct em_tx_queue *txq)
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
 	if (! (txr[desc_to_clean_to].upper.fields.status & E1000_TXD_STAT_DD))
 	{
-		PMD_TX_FREE_LOG(DEBUG,
-				"TX descriptor %4u is not done"
-				"(port=%d queue=%d)",
-				desc_to_clean_to,
+		PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done"
+				"(port=%d queue=%d)\n", desc_to_clean_to,
 				txq->port_id, txq->queue_id);
 		/* Failed to clean any descriptors, better luck next time */
 		return -(1);
@@ -334,11 +332,10 @@ em_xmit_cleanup(struct em_tx_queue *txq)
 		nb_tx_to_clean = (uint16_t)(desc_to_clean_to -
 						last_desc_cleaned);
 
-	PMD_TX_FREE_LOG(DEBUG,
-			"Cleaning %4u TX descriptors: %4u to %4u "
-			"(port=%d queue=%d)",
-			nb_tx_to_clean, last_desc_cleaned, desc_to_clean_to,
-			txq->port_id, txq->queue_id);
+	PMD_TX_FREE_LOG(DEBUG, "Cleaning %4u TX descriptors: %4u to %4u "
+			"(port=%d queue=%d)\n", nb_tx_to_clean,
+			last_desc_cleaned, desc_to_clean_to, txq->port_id,
+			txq->queue_id);
 
 	/*
 	 * The last descriptor to clean is done, so that means all the
@@ -464,10 +461,9 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		 * nb_used better be less than or equal to txq->tx_rs_thresh
 		 */
 		while (unlikely (nb_used > txq->nb_tx_free)) {
-			PMD_TX_FREE_LOG(DEBUG,
-					"Not enough free TX descriptors "
+			PMD_TX_FREE_LOG(DEBUG, "Not enough free TX descriptors "
 					"nb_used=%4u nb_free=%4u "
-					"(port=%d queue=%d)",
+					"(port=%d queue=%d)\n",
 					nb_used, txq->nb_tx_free,
 					txq->port_id, txq->queue_id);
 
@@ -588,9 +584,8 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 		/* Set RS bit only on threshold packets' last descriptor */
 		if (txq->nb_tx_used >= txq->tx_rs_thresh) {
-			PMD_TX_FREE_LOG(DEBUG,
-					"Setting RS bit on TXD id="
-					"%4u (port=%d queue=%d)",
+			PMD_TX_FREE_LOG(DEBUG, "Setting RS bit on TXD id=%4u "
+					"(port=%d queue=%d)\n",
 					tx_last, txq->port_id, txq->queue_id);
 
 			cmd_type_len |= E1000_TXD_CMD_RS;
@@ -606,9 +601,9 @@ end_of_tx:
 	/*
 	 * Set the Transmit Descriptor Tail (TDT)
 	 */
-	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u",
-		(unsigned) txq->port_id, (unsigned) txq->queue_id,
-		(unsigned) tx_id, (unsigned) nb_tx);
+	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u\n",
+		   (unsigned) txq->port_id, (unsigned) txq->queue_id,
+		   (unsigned) tx_id, (unsigned) nb_tx);
 	E1000_PCI_REG_WRITE(txq->tdt_reg_addr, tx_id);
 	txq->tx_tail = tx_id;
 
@@ -712,7 +707,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * to happen by sending specific "back-pressure" flow control
 		 * frames to its peer(s).
 		 */
-		PMD_RX_LOG(DEBUG, "\nport_id=%u queue_id=%u rx_id=%u "
+		PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_id=%u "
 			"status=0x%x pkt_len=%u\n",
 			(unsigned) rxq->port_id, (unsigned) rxq->queue_id,
 			(unsigned) rx_id, (unsigned) status,
@@ -892,7 +887,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * to happen by sending specific "back-pressure" flow control
 		 * frames to its peer(s).
 		 */
-		PMD_RX_LOG(DEBUG, "\nport_id=%u queue_id=%u rx_id=%u "
+		PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_id=%u "
 			"status=0x%x data_len=%u\n",
 			(unsigned) rxq->port_id, (unsigned) rxq->queue_id,
 			(unsigned) rx_id, (unsigned) status,
lib/librte_pmd_e1000/igb_ethdev.c +36 -39

229 lines not on this page · raw message

lib/librte_pmd_e1000/igb_rxtx.c +5 -4
index 977c4a2..9a34710 100644
@@ -555,7 +555,7 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 	 * Set the Transmit Descriptor Tail (TDT).
 	 */
 	E1000_PCI_REG_WRITE(txq->tdt_reg_addr, tx_id);
-	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u",
+	PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u\n",
 		   (unsigned) txq->port_id, (unsigned) txq->queue_id,
 		   (unsigned) tx_id, (unsigned) nb_tx);
 	txq->tx_tail = tx_id;
@@ -697,7 +697,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * to happen by sending specific "back-pressure" flow control
 		 * frames to its peer(s).
 		 */
-		PMD_RX_LOG(DEBUG, "\nport_id=%u queue_id=%u rx_id=%u "
+		PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_id=%u "
 			   "staterr=0x%x pkt_len=%u\n",
 			   (unsigned) rxq->port_id, (unsigned) rxq->queue_id,
 			   (unsigned) rx_id, (unsigned) staterr,
@@ -881,7 +881,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 * to happen by sending specific "back-pressure" flow control
 		 * frames to its peer(s).
 		 */
-		PMD_RX_LOG(DEBUG, "\nport_id=%u queue_id=%u rx_id=%u "
+		PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_id=%u "
 			   "staterr=0x%x data_len=%u\n",
 			   (unsigned) rxq->port_id, (unsigned) rxq->queue_id,
 			   (unsigned) rx_id, (unsigned) staterr,
@@ -1741,7 +1741,8 @@ igb_vmdq_rx_hw_configure(struct rte_eth_dev *dev)
 	uint32_t mrqc, vt_ctl, vmolr, rctl;
 	int i;
 
-	PMD_INIT_LOG(DEBUG, ">>");
+	PMD_INIT_FUNC_TRACE();
+
 	hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	cfg = &dev->data->dev_conf.rx_adv_conf.vmdq_rx_conf;
 
Signature · 1 line
1.7.10.4
#19 lore raw

PATCH 9/11 e1000: always log init messages

In reply to a message not in the archive

'init' messages should always be logged and filtered at runtime by rte_log. All the more so as these messages are not in the datapath.

---
 lib/librte_pmd_e1000/e1000_logs.h |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
lib/librte_pmd_e1000/e1000_logs.h +4 -3
index 02f5930..791705c 100644
@@ -34,12 +34,13 @@
 #ifndef _E1000_LOGS_H_
 #define _E1000_LOGS_H_
 
-#ifdef RTE_LIBRTE_E1000_DEBUG_INIT
 #define PMD_INIT_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
+	rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD, \
+		"PMD: %s(): " fmt, __func__, ##args)
+
+#ifdef RTE_LIBRTE_E1000_DEBUG_INIT
 #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>\n")
 #else
-#define PMD_INIT_LOG(level, fmt, args...) do { } while(0)
 #define PMD_INIT_FUNC_TRACE() do { } while(0)
 #endif
 
Signature · 1 line
1.7.10.4
#20 lore raw

PATCH 10/11 e1000: add a message when forcing scatter mode

In reply to a message not in the archive
---
 lib/librte_pmd_e1000/em_rxtx.c  |    4 ++++
 lib/librte_pmd_e1000/igb_rxtx.c |   14 ++++++++++++++
 2 files changed, 18 insertions(+)
lib/librte_pmd_e1000/em_rxtx.c +4 -0
index fd082f8..19d18e7 100644
@@ -1703,6 +1703,8 @@ eth_em_rx_init(struct rte_eth_dev *dev)
 		 */
 		if (dev->data->dev_conf.rxmode.jumbo_frame ||
 				rctl_bsize < ETHER_MAX_LEN) {
+			if (!dev->data->scattered_rx)
+				PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 			dev->rx_pkt_burst =
 				(eth_rx_burst_t)eth_em_recv_scattered_pkts;
 			dev->data->scattered_rx = 1;
@@ -1710,6 +1712,8 @@ eth_em_rx_init(struct rte_eth_dev *dev)
 	}
 
 	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		if (!dev->data->scattered_rx)
+			PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 		dev->rx_pkt_burst = eth_em_recv_scattered_pkts;
 		dev->data->scattered_rx = 1;
 	}
lib/librte_pmd_e1000/igb_rxtx.c +14 -0
index 9a34710..ddcd84c 100644
@@ -1980,6 +1980,9 @@ eth_igb_rx_init(struct rte_eth_dev *dev)
 			/* It adds dual VLAN length for supporting dual VLAN */
 			if ((dev->data->dev_conf.rxmode.max_rx_pkt_len +
 						2 * VLAN_TAG_SIZE) > buf_size){
+				if (!dev->data->scattered_rx)
+					PMD_INIT_LOG(DEBUG,
+						     "forcing scatter mode\n");
 				dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
 				dev->data->scattered_rx = 1;
 			}
@@ -1989,6 +1992,8 @@ eth_igb_rx_init(struct rte_eth_dev *dev)
 			 */
 			if ((rctl_bsize == 0) || (rctl_bsize > buf_size))
 				rctl_bsize = buf_size;
+			if (!dev->data->scattered_rx)
+				PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 			dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
 			dev->data->scattered_rx = 1;
 		}
@@ -2010,6 +2015,8 @@ eth_igb_rx_init(struct rte_eth_dev *dev)
 	}
 
 	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		if (!dev->data->scattered_rx)
+			PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 		dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
 		dev->data->scattered_rx = 1;
 	}
@@ -2244,6 +2251,9 @@ eth_igbvf_rx_init(struct rte_eth_dev *dev)
 			/* It adds dual VLAN length for supporting dual VLAN */
 			if ((dev->data->dev_conf.rxmode.max_rx_pkt_len +
 						2 * VLAN_TAG_SIZE) > buf_size){
+				if (!dev->data->scattered_rx)
+					PMD_INIT_LOG(DEBUG,
+						     "forcing scatter mode\n");
 				dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
 				dev->data->scattered_rx = 1;
 			}
@@ -2253,6 +2263,8 @@ eth_igbvf_rx_init(struct rte_eth_dev *dev)
 			 */
 			if ((rctl_bsize == 0) || (rctl_bsize > buf_size))
 				rctl_bsize = buf_size;
+			if (!dev->data->scattered_rx)
+				PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 			dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
 			dev->data->scattered_rx = 1;
 		}
@@ -2284,6 +2296,8 @@ eth_igbvf_rx_init(struct rte_eth_dev *dev)
 	}
 
 	if (dev->data->dev_conf.rxmode.enable_scatter) {
+		if (!dev->data->scattered_rx)
+			PMD_INIT_LOG(DEBUG, "forcing scatter mode\n");
 		dev->rx_pkt_burst = eth_igb_recv_scattered_pkts;
 		dev->data->scattered_rx = 1;
 	}
Signature · 1 line
1.7.10.4
#21 lore raw

PATCH 11/11 eal: set log level from command line

In reply to a message not in the archive

Add a --log-level option to set the default eal log level.

---
 lib/librte_eal/bsdapp/eal/eal.c                    |   43 ++++++++++++++++++++
 .../bsdapp/eal/include/eal_internal_cfg.h          |    1 +
 lib/librte_eal/linuxapp/eal/eal.c                  |   43 ++++++++++++++++++++
 .../linuxapp/eal/include/eal_internal_cfg.h        |    1 +
 4 files changed, 88 insertions(+)
lib/librte_eal/bsdapp/eal/eal.c +43 -0
index 38c6cfc..96b54e3 100644
@@ -94,6 +94,7 @@
 #define OPT_PCI_BLACKLIST "pci-blacklist"
 #define OPT_VDEV        "vdev"
 #define OPT_SYSLOG      "syslog"
+#define OPT_LOG_LEVEL   "log-level"
 
 #define RTE_EAL_BLACKLIST_SIZE	0x100
 
@@ -311,6 +312,7 @@ eal_usage(const char *prgname)
 	       "  -v           : Display version information on startup\n"
 	       "  -m MB        : memory to allocate\n"
 	       "  -r NUM       : force number of memory ranks (don't detect)\n"
+	       "  --"OPT_LOG_LEVEL"  : set default log level\n"
 	       "  --"OPT_PROC_TYPE"  : type of this process\n"
 	       "  --"OPT_PCI_BLACKLIST", -b: add a PCI device in black list.\n"
 	       "               Prevent EAL from using this PCI device. The argument\n"
@@ -458,6 +460,28 @@ eal_parse_syslog(const char *facility)
 	return -1;
 }
 
+static int
+eal_parse_log_level(const char *level, uint32_t *log_level)
+{
+	char *end;
+	unsigned long tmp;
+
+	errno = 0;
+	tmp = strtoul(level, &end, 0);
+
+	/* check for errors */
+	if ((errno != 0) || (level[0] == '\0') ||
+	    end == NULL || (*end != '\0'))
+		return -1;
+
+	/* log_level is a uint32_t */
+	if (tmp >= UINT32_MAX)
+		return -1;
+
+	*log_level = tmp;
+	return 0;
+}
+
 static inline size_t
 eal_get_hugepage_mem_size(void)
 {
@@ -512,6 +536,7 @@ eal_parse_args(int argc, char **argv)
 		{OPT_PCI_BLACKLIST, 1, 0, 0},
 		{OPT_VDEV, 1, 0, 0},
 		{OPT_SYSLOG, 1, NULL, 0},
+		{OPT_LOG_LEVEL, 1, NULL, 0},
 		{0, 0, 0, 0}
 	};
 
@@ -524,6 +549,8 @@ eal_parse_args(int argc, char **argv)
 	internal_config.hugepage_dir = NULL;
 	internal_config.force_sockets = 0;
 	internal_config.syslog_facility = LOG_DAEMON;
+	/* default value from build option */
+	internal_config.log_level = RTE_LOG_LEVEL;
 #ifdef RTE_LIBEAL_USE_HPET
 	internal_config.no_hpet = 0;
 #else
@@ -671,6 +698,19 @@ eal_parse_args(int argc, char **argv)
 					return -1;
 				}
 			}
+			else if (!strcmp(lgopts[option_index].name,
+					 OPT_LOG_LEVEL)) {
+				uint32_t log;
+
+				if (eal_parse_log_level(optarg, &log) < 0) {
+					RTE_LOG(ERR, EAL,
+						"invalid parameters for --"
+						OPT_LOG_LEVEL "\n");
+					eal_usage(prgname);
+					return -1;
+				}
+				internal_config.log_level = log;
+			}
 			break;
 
 		default:
@@ -811,6 +851,9 @@ rte_eal_init(int argc, char **argv)
 	if (fctret < 0)
 		exit(1);
 
+	/* set log level as early as possible */
+	rte_set_log_level(internal_config.log_level);
+
 	if (internal_config.no_hugetlbfs == 0 &&
 			internal_config.process_type != RTE_PROC_SECONDARY &&
 			eal_hugepage_info_init() < 0)
lib/librte_eal/bsdapp/eal/include/eal_internal_cfg.h +1 -0
index 2d06c7f..24cefc2 100644
@@ -75,6 +75,7 @@ struct internal_config {
 	volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */
 	uintptr_t base_virtaddr;          /**< base address to try and reserve memory from */
 	volatile int syslog_facility;	  /**< facility passed to openlog() */
+	volatile uint32_t log_level;	  /**< default log level */
 	const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
 	const char *hugepage_dir;         /**< specific hugetlbfs directory to use */
 
lib/librte_eal/linuxapp/eal/eal.c +43 -0

85 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/include/eal_internal_cfg.h +1 -0
index 498ade2..8749390 100644
@@ -77,6 +77,7 @@ struct internal_config {
 	volatile uint64_t socket_mem[RTE_MAX_NUMA_NODES]; /**< amount of memory per socket */
 	uintptr_t base_virtaddr;          /**< base address to try and reserve memory from */
 	volatile int syslog_facility;	  /**< facility passed to openlog() */
+	volatile uint32_t log_level;	  /**< default log level */
 	/** default interrupt mode for VFIO */
 	volatile enum rte_intr_mode vfio_intr_mode;
 	const char *hugefile_prefix;      /**< the base filename of hugetlbfs files */
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [PATCH 01/11] ixgbe: clean log messages

In reply to a message not in the archive

Why are you adding newlines to log message strings? Shouldn't that be up to whatever the messages end up getting routed to?

Jay

Quoted 632 lines · David Marchand

Clean log messages:
- remove superfluous \n in log macros and add some \n where needed,
- remove leading \n in some messages,
- split multi lines messages,
- replace some PMD_INIT_LOG(DEBUG, "some_func\n") with PMD_INIT_FUNC_TRACE().

---
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   99
+++++++++++++++++------------------
 lib/librte_pmd_ixgbe/ixgbe_fdir.c   |   12 ++---
 lib/librte_pmd_ixgbe/ixgbe_logs.h   |   12 ++---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |   14 ++---
 4 files changed, 68 insertions(+), 69 deletions(-)
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -2
index 59122a1..ac00323 100644
@@ -737,7 +737,7 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
 #endif /* RTE_NIC_BYPASS */
 
        if (diag != IXGBE_SUCCESS) {
-               PMD_INIT_LOG(ERR, "Shared code init failed: %d", diag);
+               PMD_INIT_LOG(ERR, "Shared code init failed: %d\n", diag);
                return -EIO;
        }
@@ -763,7 +763,7 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
        /* Make sure we have a good EEPROM before we read from it */
        diag = ixgbe_validate_eeprom_checksum(hw, &csum);
        if (diag != IXGBE_SUCCESS) {
-               PMD_INIT_LOG(ERR, "The EEPROM checksum is not valid: %d",
 diag);
+               PMD_INIT_LOG(ERR, "The EEPROM checksum is not valid:
 %d\n", diag);
                return -EIO;
        }
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0
@@ -791,13 +791,14 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
        if (diag == IXGBE_ERR_EEPROM_VERSION) {
                PMD_INIT_LOG(ERR, "This device is a pre-production

adapter/"
"LOM. Please be aware there may be issues associated "
- "with your hardware.\n If you are experiencing
problems "

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -1
+                   "with your hardware.\n");
+               PMD_INIT_LOG(ERR, "If you are experiencing problems "
                    "please contact your Intel or hardware representative "
                    "who provided you with this hardware.\n");
        } else if (diag == IXGBE_ERR_SFP_NOT_SUPPORTED)
                PMD_INIT_LOG(ERR, "Unsupported SFP+ Module\n");
        if (diag) {
-               PMD_INIT_LOG(ERR, "Hardware Initialization Failure: %d",

diag);
+ PMD_INIT_LOG(ERR, "Hardware Initialization Failure: %d\n",

diag);
                return -EIO;
        }
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -813,7 +814,7 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
        if (eth_dev->data->mac_addrs == NULL) {
                PMD_INIT_LOG(ERR,
                        "Failed to allocate %u bytes needed to store "
-                       "MAC addresses",
+                       "MAC addresses\n",
                        ETHER_ADDR_LEN * hw->mac.num_rar_entries);
                return -ENOMEM;
        }
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -1
@@ -826,7 +827,8 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
                        IXGBE_VMDQ_NUM_UC_MAC, 0);
        if (eth_dev->data->hash_mac_addrs == NULL) {
                PMD_INIT_LOG(ERR,
-                       "Failed to allocate %d bytes needed to store MAC
 addresses",
+                       "Failed to allocate %d bytes needed to store "
+                       "MAC addresses\n",
                        ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC);
                return -ENOMEM;
        }
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -2
@@ -850,14 +852,14 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
 
        if (ixgbe_is_sfp(hw) && hw->phy.sfp_type !=
 ixgbe_sfp_type_not_present)
                PMD_INIT_LOG(DEBUG,
-                            "MAC: %d, PHY: %d, SFP+: %d<n",
+                            "MAC: %d, PHY: %d, SFP+: %d\n",
                             (int) hw->mac.type, (int) hw->phy.type,
                             (int) hw->phy.sfp_type);
        else
                PMD_INIT_LOG(DEBUG, "MAC: %d, PHY: %d\n",
                             (int) hw->mac.type, (int) hw->phy.type);
 
-       PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
+       PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x\n",
                        eth_dev->data->port_id, pci_dev->id.vendor_id,
                        pci_dev->id.device_id);
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -933,7 +935,7 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
 
 IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private);
        struct ether_addr *perm_addr = (struct ether_addr *)
 hw->mac.perm_addr;
 
-       PMD_INIT_LOG(DEBUG, "eth_ixgbevf_dev_init");
+       PMD_INIT_FUNC_TRACE();
        eth_dev->dev_ops = &ixgbevf_eth_dev_ops;
        eth_dev->rx_pkt_burst = &ixgbe_recv_pkts;
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -1
@@ -963,7 +965,8 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
        /* Initialize the shared code (base driver) */
        diag = ixgbe_init_shared_code(hw);
        if (diag != IXGBE_SUCCESS) {
-               PMD_INIT_LOG(ERR, "Shared code init failed for ixgbevf:
 %d", diag);
+               PMD_INIT_LOG(ERR, "Shared code init failed for ixgbevf:
 %d\n",
+                            diag);
                return -EIO;
        }
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -982,7 +985,7 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
         * In this case, assign a random MAC address.
         */
        if ((diag != IXGBE_SUCCESS) && (diag !=
 IXGBE_ERR_INVALID_MAC_ADDR)) {
-               PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", diag);
+               PMD_INIT_LOG(ERR, "VF Initialization Failure: %d\n", diag);
                return (diag);
        }
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -998,7 +1001,7 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct
 eth_driver *eth_drv,
        if (eth_dev->data->mac_addrs == NULL) {
                PMD_INIT_LOG(ERR,
                        "Failed to allocate %u bytes needed to store "
-                       "MAC addresses",
+                       "MAC addresses\n",
                        ETHER_ADDR_LEN * hw->mac.num_rar_entries);
                return -ENOMEM;
        }
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -2
@@ -1034,11 +1037,12 @@ eth_ixgbevf_dev_init(__attribute__((unused))
 struct eth_driver *eth_drv,
                        break;
 
                default:
-                       PMD_INIT_LOG(ERR, "VF Initialization Failure: %d",
 diag);
+                       PMD_INIT_LOG(ERR, "VF Initialization Failure:
 %d\n",
+                                    diag);
                        return (-EIO);
        }
 
-       PMD_INIT_LOG(DEBUG, "\nport %d vendorID=0x%x deviceID=0x%x

mac.type=%s\n",
+ PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x
mac.type=%s\n",

                         eth_dev->data->port_id, pci_dev->id.vendor_id,
pci_dev->id.device_id,
                         "ixgbe_mac_82599_vf");
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -1207,7 +1211,7 @@ ixgbe_vlan_hw_strip_disable(struct rte_eth_dev *dev,
 uint16_t queue)
 
        if (hw->mac.type == ixgbe_mac_82598EB) {
                /* No queue level support */
-               PMD_INIT_LOG(INFO, "82598EB not support queue level hw
 strip");
+               PMD_INIT_LOG(INFO, "82598EB not support queue level hw
 strip\n");
                return;
        }
        else {
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -1231,7 +1235,7 @@ ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev,
 uint16_t queue)
 
        if (hw->mac.type == ixgbe_mac_82598EB) {
                /* No queue level supported */
-               PMD_INIT_LOG(INFO, "82598EB not support queue level hw
 strip");
+               PMD_INIT_LOG(INFO, "82598EB not support queue level hw
 strip\n");
                return;
        }
        else {
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +5 -7
@@ -1543,7 +1547,7 @@ skip_link_setup:
        return (0);
 
 error:
-       PMD_INIT_LOG(ERR, "failure in ixgbe_dev_start(): %d", err);
+       PMD_INIT_LOG(ERR, "failure in ixgbe_dev_start(): %d\n", err);
        ixgbe_dev_clear_queues(dev);
        return -EIO;
 }
@@ -1599,10 +1603,8 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
 #ifdef RTE_NIC_BYPASS
                if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) {
                        /* Not suported in bypass mode */
-                       PMD_INIT_LOG(ERR,
-                               "\nSet link up is not supported "
-                               "by device id 0x%x\n",
-                               hw->device_id);
+                       PMD_INIT_LOG(ERR, "Set link up is not supported "
+                                    "by device id 0x%x\n", hw->device_id);
                        return -ENOTSUP;
                }
 #endif
@@ -1611,8 +1613,8 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev)
                return 0;
        }
 
-       PMD_INIT_LOG(ERR, "\nSet link up is not supported by device id
 0x%x\n",
-               hw->device_id);
+       PMD_INIT_LOG(ERR, "Set link up is not supported by device id
 0x%x\n",
+                    hw->device_id);
        return -ENOTSUP;

}

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +5 -8
@@ -1628,10 +1630,8 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
 #ifdef RTE_NIC_BYPASS
                if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) {
                        /* Not suported in bypass mode */
-                       PMD_INIT_LOG(ERR,
-                               "\nSet link down is not supported "
-                               "by device id 0x%x\n",
-                                hw->device_id);
+                       PMD_INIT_LOG(ERR, "Set link down is not supported "
+                                    "by device id 0x%x\n", hw->device_id);
                        return -ENOTSUP;
                }
 #endif
@@ -1640,9 +1640,8 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev)
                return 0;
        }
 
-       PMD_INIT_LOG(ERR,
-               "\nSet link down is not supported by device id 0x%x\n",
-                hw->device_id);
+       PMD_INIT_LOG(ERR, "Set link down is not supported by device id
 0x%x\n",
+                    hw->device_id);
        return -ENOTSUP;
 }
@@ -2113,7 +2112,7 @@ ixgbe_dev_interrupt_get_status(struct rte_eth_dev
 *dev)
 
        /* read-on-clear nic registers here */
        eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
-       PMD_DRV_LOG(INFO, "eicr %x", eicr);
+       PMD_DRV_LOG(INFO, "eicr %x\n", eicr);
 
        intr->flags = 0;
        if (eicr & IXGBE_EICR_LSC) {
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +3 -3
@@ -2145,16 +2144,16 @@ ixgbe_dev_link_status_print(struct rte_eth_dev
 *dev)
        memset(&link, 0, sizeof(link));
        rte_ixgbe_dev_atomic_read_link_status(dev, &link);
        if (link.link_status) {
-               PMD_INIT_LOG(INFO, "Port %d: Link Up - speed %u Mbps - %s",
+               PMD_INIT_LOG(INFO, "Port %d: Link Up - speed %u Mbps -
 %s\n",
                                        (int)(dev->data->port_id),
                                        (unsigned)link.link_speed,
                        link.link_duplex == ETH_LINK_FULL_DUPLEX ?
                                        "full-duplex" : "half-duplex");
        } else {
-               PMD_INIT_LOG(INFO, " Port %d: Link Down",
+               PMD_INIT_LOG(INFO, " Port %d: Link Down\n",
                                (int)(dev->data->port_id));
        }
-       PMD_INIT_LOG(INFO, "PCI Address: %04d:%02d:%02d:%d",
+       PMD_INIT_LOG(INFO, "PCI Address: %04d:%02d:%02d:%d\n",
                                dev->pci_dev->addr.domain,
                                dev->pci_dev->addr.bus,
                                dev->pci_dev->addr.devid,
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -2
@@ -2211,9 +2210,9 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev)
        if (intr_enable_delay) {
                if (rte_eal_alarm_set(timeout * 1000,
                                      ixgbe_dev_interrupt_delayed_handler,
 (void*)dev) < 0)
-                       PMD_DRV_LOG(ERR, "Error setting alarm");
+                       PMD_DRV_LOG(ERR, "Error setting alarm\n");
        } else {
-               PMD_DRV_LOG(DEBUG, "enable intr immediately");
+               PMD_DRV_LOG(DEBUG, "enable intr immediately\n");
                ixgbe_enable_intr(dev);
                rte_intr_enable(&(dev->pci_dev->intr_handle));
        }
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -2371,7 +2370,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct
 rte_eth_fc_conf *fc_conf)
        if (fc_conf->autoneg != !hw->fc.disable_fc_autoneg)
                return -ENOTSUP;
        rx_buf_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(0));
-       PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x \n",
 rx_buf_size);
+       PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x\n", rx_buf_size);
 

/*
* At least reserve one Ethernet frame for watermark

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -2
@@ -2413,7 +2412,7 @@ ixgbe_flow_ctrl_set(struct rte_eth_dev *dev, struct
 rte_eth_fc_conf *fc_conf)
                return 0;
        }
 
-       PMD_INIT_LOG(ERR, "ixgbe_fc_enable = 0x%x \n", err);
+       PMD_INIT_LOG(ERR, "ixgbe_fc_enable = 0x%x\n", err);
        return -EIO;
 }
@@ -2593,7 +2592,7 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev
 *dev, struct rte_eth_pfc_conf *p
        ixgbe_dcb_unpack_map_cee(dcb_config, IXGBE_DCB_RX_CONFIG, map);
        tc_num = map[pfc_conf->priority];
        rx_buf_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(tc_num));
-       PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x \n",
 rx_buf_size);
+       PMD_INIT_LOG(DEBUG, "Rx packet buffer size = 0x%x\n", rx_buf_size);
        /*

* At least reserve one Ethernet frame for watermark
* high_water/low_water in kilo bytes for ixgbe

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -2
@@ -2618,7 +2617,7 @@ ixgbe_priority_flow_ctrl_set(struct rte_eth_dev
 *dev, struct rte_eth_pfc_conf *p
        if ((err == IXGBE_SUCCESS) || (err == IXGBE_ERR_FC_NOT_NEGOTIATED))
                return 0;
 
-       PMD_INIT_LOG(ERR, "ixgbe_dcb_pfc_enable = 0x%x \n", err);
+       PMD_INIT_LOG(ERR, "ixgbe_dcb_pfc_enable = 0x%x\n", err);
        return -EIO;
 }
@@ -2765,7 +2764,7 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t
 mtu)
 static void
 ixgbevf_intr_disable(struct ixgbe_hw *hw)
 {
-       PMD_INIT_LOG(DEBUG, "ixgbevf_intr_disable");
+       PMD_INIT_FUNC_TRACE();
 
        /* Clear interrupt mask to stop from interrupts being generated */
        IXGBE_WRITE_REG(hw, IXGBE_VTEIMC, IXGBE_VF_IRQ_CLEAR_MASK);
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +4 -4
@@ -2778,8 +2777,8 @@ ixgbevf_dev_configure(struct rte_eth_dev *dev)
 {
        struct rte_eth_conf* conf = &dev->data->dev_conf;
 
-       PMD_INIT_LOG(DEBUG, "\nConfigured Virtual Function port id: %d\n",
-               dev->data->port_id);
+       PMD_INIT_LOG(DEBUG, "Configured Virtual Function port id: %d\n",
+                    dev->data->port_id);
 
        /*
         * VF has no ability to enable/disable HW CRC
@@ -2807,7 +2806,7 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        int err, mask = 0;
 
-       PMD_INIT_LOG(DEBUG, "ixgbevf_dev_start");
+       PMD_INIT_FUNC_TRACE();
 
        hw->mac.ops.reset_hw(hw);
 
@@ -2842,7 +2841,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev)
 {
        struct ixgbe_hw *hw =
 IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-       PMD_INIT_LOG(DEBUG, "ixgbevf_dev_stop");
+       PMD_INIT_FUNC_TRACE();
 
        hw->adapter_stopped = TRUE;
        ixgbe_stop_adapter(hw);
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -2861,7 +2860,7 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)
 {
        struct ixgbe_hw *hw =
 IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-       PMD_INIT_LOG(DEBUG, "ixgbevf_dev_close");
+       PMD_INIT_FUNC_TRACE();
 
        ixgbe_reset_hw(hw);
@@ -2908,7 +2907,7 @@ ixgbevf_vlan_filter_set(struct rte_eth_dev *dev,
 uint16_t vlan_id, int on)
        /* vind is not used in VF driver, set to 0, check

ixgbe_set_vfta_vf */

        ret = ixgbe_set_vfta(hw, vlan_id, 0, !!on);
        if(ret){
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +2 -2
-               PMD_INIT_LOG(ERR, "Unable to set VF vlan");
+               PMD_INIT_LOG(ERR, "Unable to set VF vlan\n");
                return ret;
        }
        vid_idx = (uint32_t) ((vlan_id >> 5) & 0x7F);
@@ -3477,7 +3476,7 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct
 ether_addr *mac_addr,
        diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes);
        if (diag == 0)
                return;
-       PMD_DRV_LOG(ERR, "Unable to add MAC address - diag=%d", diag);
+       PMD_DRV_LOG(ERR, "Unable to add MAC address - diag=%d\n", diag);
 }
 

static void

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -3517,7 +3516,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev,
 uint32_t index)
                        PMD_DRV_LOG(ERR,
                                    "Adding again MAC address "
                                    "%02x:%02x:%02x:%02x:%02x:%02x failed "
-                                   "diag=%d",
+                                   "diag=%d\n",
                                    mac_addr->addr_bytes[0],
                                    mac_addr->addr_bytes[1],
                                    mac_addr->addr_bytes[2],
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -3806,7 +3805,7 @@ ixgbe_add_5tuple_filter(struct rte_eth_dev *dev,
 uint16_t index,
                return -EINVAL;  /* filter index is out of range. */
 
        if (filter->tcp_flags) {
-               PMD_INIT_LOG(INFO, "82599EB not tcp flags in 5tuple");
+               PMD_INIT_LOG(INFO, "82599EB not tcp flags in 5tuple\n");
                return -EINVAL;
        }
lib/librte_pmd_ixgbe/ixgbe_fdir.c +5 -5
index 6c0a530..c78a450 100644
@@ -139,7 +139,7 @@ configure_fdir_flags(struct rte_fdir_conf *conf,
 uint32_t *fdirctrl)
                break;
        default:
                /* bad value */
-               PMD_INIT_LOG(ERR, "Invalid fdir_conf->pballoc value");
+               PMD_INIT_LOG(ERR, "Invalid fdir_conf->pballoc value\n");
                return -EINVAL;
        };
@@ -158,7 +158,7 @@ configure_fdir_flags(struct rte_fdir_conf *conf,
 uint32_t *fdirctrl)
                break;
        default:
                /* bad value */
-               PMD_INIT_LOG(ERR, "Invalid fdir_conf->status value");
+               PMD_INIT_LOG(ERR, "Invalid fdir_conf->status value\n");
                return -EINVAL;
        };
@@ -395,7 +395,7 @@ fdir_filter_to_atr_input(struct rte_fdir_filter
 *fdir_filter,
        if ((fdir_filter->l4type == RTE_FDIR_L4TYPE_SCTP ||
                        fdir_filter->l4type == RTE_FDIR_L4TYPE_NONE) &&
                        (fdir_filter->port_src || fdir_filter->port_dst)) {
-               PMD_INIT_LOG(ERR, "Invalid fdir_filter");
+               PMD_INIT_LOG(ERR, "Invalid fdir_filter\n");
                return -EINVAL;
        }
@@ -420,7 +420,7 @@ fdir_filter_to_atr_input(struct rte_fdir_filter
 *fdir_filter,
                input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV4;
                break;
        default:
-               PMD_INIT_LOG(ERR, " Error on l4type input");
+               PMD_INIT_LOG(ERR, " Error on l4type input\n");
                return -EINVAL;
        }
@@ -524,7 +524,7 @@ fdir_erase_filter_82599(struct ixgbe_hw *hw,
        }
 
        if (!retry_count) {
-               PMD_INIT_LOG(ERR, "Timeout querying for flow director
 filter");
+               PMD_INIT_LOG(ERR, "Timeout querying for flow director
 filter\n");
                err = -EIO;
        }
lib/librte_pmd_ixgbe/ixgbe_fdir.c +1 -1
@@ -678,7 +678,7 @@ ixgbe_fdir_set_masks(struct rte_eth_dev *dev, struct
 rte_fdir_masks *fdir_masks)
 
        err = ixgbe_reinit_fdir_tables_82599(hw);
        if (err) {
-               PMD_INIT_LOG(ERR, "reinit of fdir tables failed");
+               PMD_INIT_LOG(ERR, "reinit of fdir tables failed\n");
                return -EIO;
        }
lib/librte_pmd_ixgbe/ixgbe_logs.h +6 -6
index 9f0a684..22d8cfb 100644
@@ -36,8 +36,8 @@
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_INIT
 #define PMD_INIT_LOG(level, fmt, args...) \
-       RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
-#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+       RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>\n")
 #else
 #define PMD_INIT_LOG(level, fmt, args...) do { } while(0)
 #define PMD_INIT_FUNC_TRACE() do { } while(0)
@@ -45,28 +45,28 @@
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_RX
 #define PMD_RX_LOG(level, fmt, args...) \
-       RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+       RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_RX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_TX
 #define PMD_TX_LOG(level, fmt, args...) \
-       RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+       RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_TX_FREE
 #define PMD_TX_FREE_LOG(level, fmt, args...) \
-       RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+       RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)
 #endif
 
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_DRIVER
 #define PMD_DRV_LOG(level, fmt, args...) \
-       RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+       RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
 #else
 #define PMD_DRV_LOG(level, fmt, args...) do { } while(0)
 #endif
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -1
index dfc2076..cbec821 100644
@@ -492,7 +492,7 @@ ixgbe_xmit_cleanup(struct igb_tx_queue *txq)
        {
                PMD_TX_FREE_LOG(DEBUG,
                                "TX descriptor %4u is not done"
-                               "(port=%d queue=%d)",
+                               "(port=%d queue=%d)\n",
                                desc_to_clean_to,
                                txq->port_id, txq->queue_id);
                /* Failed to clean any descriptors, better luck next time

*/

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +3 -3
@@ -509,7 +509,7 @@ ixgbe_xmit_cleanup(struct igb_tx_queue *txq)
 
        PMD_TX_FREE_LOG(DEBUG,
                        "Cleaning %4u TX descriptors: %4u to %4u "
-                       "(port=%d queue=%d)",
+                       "(port=%d queue=%d)\n",
                        nb_tx_to_clean, last_desc_cleaned,
 desc_to_clean_to,
                        txq->port_id, txq->queue_id);
@@ -630,7 +630,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts,
                        PMD_TX_FREE_LOG(DEBUG,
                                        "Not enough free TX descriptors "
                                        "nb_used=%4u nb_free=%4u "
-                                       "(port=%d queue=%d)",
+                                       "(port=%d queue=%d)\n",
                                        nb_used, txq->nb_tx_free,
                                        txq->port_id, txq->queue_id);
@@ -650,7 +650,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts,
                                        "performance."
                                        "nb_used=%4u nb_free=%4u "
                                        "tx_rs_thresh=%4u. "
-                                       "(port=%d queue=%d)",
+                                       "(port=%d queue=%d)\n",
                                        nb_used, txq->nb_tx_free,
                                        txq->tx_rs_thresh,
                                        txq->port_id, txq->queue_id);
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -1
@@ -782,7 +782,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf
 **tx_pkts,
                if (txq->nb_tx_used >= txq->tx_rs_thresh) {
                        PMD_TX_FREE_LOG(DEBUG,
                                        "Setting RS bit on TXD id="
-                                       "%4u (port=%d queue=%d)",
+                                       "%4u (port=%d queue=%d)\n",
                                        tx_last, txq->port_id,
 txq->queue_id);
                        cmd_type_len |= IXGBE_TXD_CMD_RS;
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -1
@@ -798,7 +798,7 @@ end_of_tx:
        /*
         * Set the Transmit Descriptor Tail (TDT)
         */
-       PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u",
+       PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u\n",
                   (unsigned) txq->port_id, (unsigned) txq->queue_id,
                   (unsigned) tx_id, (unsigned) nb_tx);
        IXGBE_PCI_REG_WRITE(txq->tdt_reg_addr, tx_id);
@@ -1383,7 +1383,7 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct
 rte_mbuf **rx_pkts,
                 * to happen by sending specific "back-pressure" flow

control
* frames to its peer(s).
*/

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -1
-               PMD_RX_LOG(DEBUG, "\nport_id=%u queue_id=%u rx_id=%u "
+               PMD_RX_LOG(DEBUG, "port_id=%u queue_id=%u rx_id=%u "
                           "staterr=0x%x data_len=%u\n",
                           (unsigned) rxq->port_id, (unsigned)

rxq->queue_id,
(unsigned) rx_id, (unsigned) staterr,
--
1.7.10.4

#6 lore raw

Re: [PATCH 01/11] ixgbe: clean log messages

In reply to a message not in the archive

Hello Jay,

Quoted 3 lines · Jay Rolette

Why are you adding newlines to log message strings? Shouldn't that be up to whatever the messages end up getting routed to?

Actually, I wanted to have consistent log formats in the PMDs so that the log messages displayed at runtime are aligned (and not bouncing with \n before or after the log message).
There was two solutions from my point of view :
- either always add a \n in the log macro and remove all trailing \n
- do the opposite

I preferred the latter as it let users of the macro set the message format as they want.

Before this change :

Configuring Port 0 (socket 1)
PMD: ixgbe_dev_tx_queue_setup(): sw_ring=0x7f3e59cd8080 hw_ring=0x7f3e59d02080 dma_addr=0x727702080

PMD: ixgbe_dev_tx_queue_setup(): Using simple tx code path

PMD: ixgbe_dev_tx_queue_setup(): Vector tx enabled.

PMD: ixgbe_dev_rx_queue_setup(): sw_ring=0x7f3e59cd57c0 hw_ring=0x7f3e59d12080 dma_addr=0x727712080

PMD: ixgbe_dev_rx_queue_setup(): Rx Burst Bulk Alloc Preconditions are satisfied. Rx Burst Bulk Alloc function will be used on port=0, queue=0.

PMD: ixgbe_dev_rx_queue_setup(): Vector rx enabled, please make sure RX burst size no less than 32.

After this change :

Configuring Port 0 (socket 1)
PMD: ixgbe_dev_tx_queue_setup(): sw_ring=0x7fd47ecd8080 hw_ring=0x7fd47ed02080 dma_addr=0x727702080
PMD: ixgbe_dev_tx_queue_setup(): Using simple tx code path
PMD: ixgbe_dev_tx_queue_setup(): Vector tx enabled.
PMD: ixgbe_dev_rx_queue_setup(): sw_ring=0x7fd47ecd57c0 hw_ring=0x7fd47ed12080 dma_addr=0x727712080
PMD: ixgbe_dev_rx_queue_setup(): Rx Burst Bulk Alloc Preconditions are satisfied. Rx Burst Bulk Alloc function will be used on port=0, queue=0.
PMD: ixgbe_dev_rx_queue_setup(): Vector rx enabled, please make sure RX burst size no less than 32.
Port 0: 90:E2:BA:29:DF:58

Signature · 1 line
David Marchand
#8 lore raw

Re: [PATCH 01/11] ixgbe: clean log messages

In reply to a message not in the archive

Hi David,

The updated output is definitely an improvement, but if you'll go with the first solution you described (adding \n in the log macro), it works much better for products using DPDK. For developer use, I think it ends up being a wash either way.

At least for my product (embedded network appliance), we want to capture anything that is logging in syslog. The log macros in DPDK make that very reasonable to do, but if there are embedded newlines, it ends up screwing up log parsing when someone wants to process logs later.

We end up having to remove all of those newlines, which makes it harder to merge as new releases coming out.

I'm assuming most products have similar requirements for logging. That's at least been the case for the products I've been involved with over the years.

If the PMDs are using PMD_LOG as a replacement macro for debugging printf's, I can see where this might be a little more pain, but having PMD_LOG is a lot more useful it if easily integrates with central logging facilities.

Thanks,
Jay

Quoted 59 lines · David Marchand

Hello Jay,

Quoted 3 lines · Jay Rolette

Why are you adding newlines to log message strings? Shouldn't that be up to whatever the messages end up getting routed to?

Actually, I wanted to have consistent log formats in the PMDs so that the log messages displayed at runtime are aligned (and not bouncing with \n before or after the log message).
There was two solutions from my point of view :
- either always add a \n in the log macro and remove all trailing \n
- do the opposite

I preferred the latter as it let users of the macro set the message format as they want.

Before this change :

Configuring Port 0 (socket 1)
PMD: ixgbe_dev_tx_queue_setup(): sw_ring=0x7f3e59cd8080 hw_ring=0x7f3e59d02080 dma_addr=0x727702080

PMD: ixgbe_dev_tx_queue_setup(): Using simple tx code path

PMD: ixgbe_dev_tx_queue_setup(): Vector tx enabled.

PMD: ixgbe_dev_rx_queue_setup(): sw_ring=0x7f3e59cd57c0 hw_ring=0x7f3e59d12080 dma_addr=0x727712080

PMD: ixgbe_dev_rx_queue_setup(): Rx Burst Bulk Alloc Preconditions are satisfied. Rx Burst Bulk Alloc function will be used on port=0, queue=0.

PMD: ixgbe_dev_rx_queue_setup(): Vector rx enabled, please make sure RX burst size no less than 32.

After this change :

Configuring Port 0 (socket 1)
PMD: ixgbe_dev_tx_queue_setup(): sw_ring=0x7fd47ecd8080 hw_ring=0x7fd47ed02080 dma_addr=0x727702080
PMD: ixgbe_dev_tx_queue_setup(): Using simple tx code path
PMD: ixgbe_dev_tx_queue_setup(): Vector tx enabled.
PMD: ixgbe_dev_rx_queue_setup(): sw_ring=0x7fd47ecd57c0 hw_ring=0x7fd47ed12080 dma_addr=0x727712080
PMD: ixgbe_dev_rx_queue_setup(): Rx Burst Bulk Alloc Preconditions are satisfied. Rx Burst Bulk Alloc function will be used on port=0, queue=0.
PMD: ixgbe_dev_rx_queue_setup(): Vector rx enabled, please make sure RX burst size no less than 32.
Port 0: 90:E2:BA:29:DF:58

--
David Marchand

#10 lore raw

Re: [PATCH 01/11] ixgbe: clean log messages

In reply to a message not in the archive
Quoted 4 lines · On Wed, 27 Aug 2014 08:53:46 -0500 Jay Rolette…

The updated output is definitely an improvement, but if you'll go with the first solution you described (adding \n in the log macro), it works much better for products using DPDK. For developer use, I think it ends up being a wash either way.

Also for driver consistency, all drivers must do the same thing. I.e the PMD_INIT_LOG macro should either add or not add newline in the same way in all drivers. I fixed virtio and vmxnet3 by just taking extra newlines out of messages and leaving the macro alone.

#11 lore raw

Re: [PATCH 01/11] ixgbe: clean log messages

Quoted 7 lines · Stephen Hemminger
Quoted 1 line · On Wed, 27 Aug 2014 08:53:46 -0500 Jay Rolette…

The updated output is definitely an improvement, but if you'll go with

the

Quoted 2 lines

first solution you described (adding \n in the log macro), it works much better for products using DPDK. For developer use, I think it ends up

Quoted 9 lines

being

Quoted 1 line

a wash either way.

Also for driver consistency, all drivers must do the same thing. I.e the PMD_INIT_LOG
macro should either add or not add newline in the same way in all drivers. I fixed virtio and vmxnet3 by just taking extra newlines out of messages and leaving the macro alone.

Not sure that we can talk about consistency at the moment ... (all the more so as if you only fixed two pmds).
Anyway.

If we go with this approach, there is still something that won't work. ixgbe shared code uses DEBUGOUT* macros which are called a lot in this shared code.
The macros call sites use trailing \n.
I suppose I will have a big NO from Intel guys if I remove the trailing \n, so I suppose we can use an alternate macro that calls RTE_LOG rather than PMD_DRV_LOG in ixgbe_os_dep.h.

I will also remove any reference to DEBUGOUT* in non-shared code.

Quoted 1 line

From my point of view, these macro are only here for compat with shared

code.

By the way, did you look at the other patches of this series ?

I want to send a v2 later (maybe not today), so any comment on the other patches are welcome.

Signature · 1 line
David Marchand