* [net-next 02/13] ixgbe: remove unused enum latency_range
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Emil Tantilov, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Emil Tantilov <emil.s.tantilov@intel.com>
This enum is no longer needed after
commit: b4ded8327fe ("ixgbe: Update adaptive ITR algorithm")
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index b3a1a12712ac..43ca5b0d5999 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2517,13 +2517,6 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIAC, mask);
}
-enum latency_range {
- lowest_latency = 0,
- low_latency = 1,
- bulk_latency = 2,
- latency_invalid = 255
-};
-
/**
* ixgbe_update_itr - update the dynamic ITR value based on statistics
* @q_vector: structure containing interrupt and ring information
--
2.15.1
^ permalink raw reply related
* [net-next 12/13] ixgbe: Use ring values to test for Tx pending
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene,
Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
This patch simplifies the check for Tx pending traffic and makes it more
holistic as there being any difference between next_to_use and
next_to_clean is much more informative than if head and tail are equal, as
it is possible for us to either not update tail, or not be notified of
completed work in which case next_to_clean would not be equal to head.
In addition the simplification makes it so that we don't have to read
hardware which allows us to drop a number of variables that were previously
being used in the call.
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/ixgbe/ixgbe_main.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 144674c6c293..6b61edba8c73 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1064,24 +1064,12 @@ static u64 ixgbe_get_tx_completed(struct ixgbe_ring *ring)
static u64 ixgbe_get_tx_pending(struct ixgbe_ring *ring)
{
- struct ixgbe_adapter *adapter;
- struct ixgbe_hw *hw;
- u32 head, tail;
+ unsigned int head, tail;
- if (ring->l2_accel_priv)
- adapter = ring->l2_accel_priv->real_adapter;
- else
- adapter = netdev_priv(ring->netdev);
+ head = ring->next_to_clean;
+ tail = ring->next_to_use;
- hw = &adapter->hw;
- head = IXGBE_READ_REG(hw, IXGBE_TDH(ring->reg_idx));
- tail = IXGBE_READ_REG(hw, IXGBE_TDT(ring->reg_idx));
-
- if (head != tail)
- return (head < tail) ?
- tail - head : (tail + ring->count - head);
-
- return 0;
+ return ((head <= tail) ? tail : tail + ring->count) - head;
}
static inline bool ixgbe_check_tx_hang(struct ixgbe_ring *tx_ring)
--
2.15.1
^ permalink raw reply related
* [net-next 04/13] ixgbe: extend firmware version support
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Paul Greenwalt, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Paul Greenwalt <paul.greenwalt@intel.com>
Extend FW version reporting by displaying information from the iSCSI
or OEM block in the EEPROM.
This will allow us to more accurately identify the FW.
Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 3 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 112 +++++++++++++++++++++++
drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | 6 ++
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 7 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 7 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 38 +++++++-
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 39 ++++++++
7 files changed, 198 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 8611763d6129..08fb589399d2 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -723,8 +723,7 @@ struct ixgbe_adapter {
u16 bridge_mode;
- u16 eeprom_verh;
- u16 eeprom_verl;
+ char eeprom_id[NVM_VER_SIZE];
u16 eeprom_cap;
u32 interrupt_event;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index 9bef255f6a18..1948e4208fb4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -4028,6 +4028,118 @@ s32 ixgbe_init_thermal_sensor_thresh_generic(struct ixgbe_hw *hw)
return 0;
}
+/**
+ * ixgbe_get_orom_version - Return option ROM from EEPROM
+ *
+ * @hw: pointer to hardware structure
+ * @nvm_ver: pointer to output structure
+ *
+ * if valid option ROM version, nvm_ver->or_valid set to true
+ * else nvm_ver->or_valid is false.
+ **/
+void ixgbe_get_orom_version(struct ixgbe_hw *hw,
+ struct ixgbe_nvm_version *nvm_ver)
+{
+ u16 offset, eeprom_cfg_blkh, eeprom_cfg_blkl;
+
+ nvm_ver->or_valid = false;
+ /* Option Rom may or may not be present. Start with pointer */
+ hw->eeprom.ops.read(hw, NVM_OROM_OFFSET, &offset);
+
+ /* make sure offset is valid */
+ if (offset == 0x0 || offset == NVM_INVALID_PTR)
+ return;
+
+ hw->eeprom.ops.read(hw, offset + NVM_OROM_BLK_HI, &eeprom_cfg_blkh);
+ hw->eeprom.ops.read(hw, offset + NVM_OROM_BLK_LOW, &eeprom_cfg_blkl);
+
+ /* option rom exists and is valid */
+ if ((eeprom_cfg_blkl | eeprom_cfg_blkh) == 0x0 ||
+ eeprom_cfg_blkl == NVM_VER_INVALID ||
+ eeprom_cfg_blkh == NVM_VER_INVALID)
+ return;
+
+ nvm_ver->or_valid = true;
+ nvm_ver->or_major = eeprom_cfg_blkl >> NVM_OROM_SHIFT;
+ nvm_ver->or_build = (eeprom_cfg_blkl << NVM_OROM_SHIFT) |
+ (eeprom_cfg_blkh >> NVM_OROM_SHIFT);
+ nvm_ver->or_patch = eeprom_cfg_blkh & NVM_OROM_PATCH_MASK;
+}
+
+/**
+ * ixgbe_get_oem_prod_version Etrack ID from EEPROM
+ *
+ * @hw: pointer to hardware structure
+ * @nvm_ver: pointer to output structure
+ *
+ * if valid OEM product version, nvm_ver->oem_valid set to true
+ * else nvm_ver->oem_valid is false.
+ **/
+void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw,
+ struct ixgbe_nvm_version *nvm_ver)
+{
+ u16 rel_num, prod_ver, mod_len, cap, offset;
+
+ nvm_ver->oem_valid = false;
+ hw->eeprom.ops.read(hw, NVM_OEM_PROD_VER_PTR, &offset);
+
+ /* Return is offset to OEM Product Version block is invalid */
+ if (offset == 0x0 && offset == NVM_INVALID_PTR)
+ return;
+
+ /* Read product version block */
+ hw->eeprom.ops.read(hw, offset, &mod_len);
+ hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_CAP_OFF, &cap);
+
+ /* Return if OEM product version block is invalid */
+ if (mod_len != NVM_OEM_PROD_VER_MOD_LEN ||
+ (cap & NVM_OEM_PROD_VER_CAP_MASK) != 0x0)
+ return;
+
+ hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_OFF_L, &prod_ver);
+ hw->eeprom.ops.read(hw, offset + NVM_OEM_PROD_VER_OFF_H, &rel_num);
+
+ /* Return if version is invalid */
+ if ((rel_num | prod_ver) == 0x0 ||
+ rel_num == NVM_VER_INVALID || prod_ver == NVM_VER_INVALID)
+ return;
+
+ nvm_ver->oem_major = prod_ver >> NVM_VER_SHIFT;
+ nvm_ver->oem_minor = prod_ver & NVM_VER_MASK;
+ nvm_ver->oem_release = rel_num;
+ nvm_ver->oem_valid = true;
+}
+
+/**
+ * ixgbe_get_etk_id - Return Etrack ID from EEPROM
+ *
+ * @hw: pointer to hardware structure
+ * @nvm_ver: pointer to output structure
+ *
+ * word read errors will return 0xFFFF
+ **/
+void ixgbe_get_etk_id(struct ixgbe_hw *hw,
+ struct ixgbe_nvm_version *nvm_ver)
+{
+ u16 etk_id_l, etk_id_h;
+
+ if (hw->eeprom.ops.read(hw, NVM_ETK_OFF_LOW, &etk_id_l))
+ etk_id_l = NVM_VER_INVALID;
+ if (hw->eeprom.ops.read(hw, NVM_ETK_OFF_HI, &etk_id_h))
+ etk_id_h = NVM_VER_INVALID;
+
+ /* The word order for the version format is determined by high order
+ * word bit 15.
+ */
+ if ((etk_id_h & NVM_ETK_VALID) == 0) {
+ nvm_ver->etk_id = etk_id_h;
+ nvm_ver->etk_id |= (etk_id_l << NVM_ETK_SHIFT);
+ } else {
+ nvm_ver->etk_id = etk_id_l;
+ nvm_ver->etk_id |= (etk_id_h << NVM_ETK_SHIFT);
+ }
+}
+
void ixgbe_disable_rx_generic(struct ixgbe_hw *hw)
{
u32 rxctrl;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
index a01409e2e06c..4d4c02366cb3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
@@ -139,6 +139,12 @@ extern const u32 ixgbe_mvals_8259X[IXGBE_MVALS_IDX_LIMIT];
s32 ixgbe_get_thermal_sensor_data_generic(struct ixgbe_hw *hw);
s32 ixgbe_init_thermal_sensor_thresh_generic(struct ixgbe_hw *hw);
+void ixgbe_get_etk_id(struct ixgbe_hw *hw,
+ struct ixgbe_nvm_version *nvm_ver);
+void ixgbe_get_oem_prod_version(struct ixgbe_hw *hw,
+ struct ixgbe_nvm_version *nvm_ver);
+void ixgbe_get_orom_version(struct ixgbe_hw *hw,
+ struct ixgbe_nvm_version *nvm_ver);
void ixgbe_disable_rx_generic(struct ixgbe_hw *hw);
void ixgbe_enable_rx_generic(struct ixgbe_hw *hw);
s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 0aaf70b3cfcd..3bcf58b27d8b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -1014,16 +1014,13 @@ static void ixgbe_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo)
{
struct ixgbe_adapter *adapter = netdev_priv(netdev);
- u32 nvm_track_id;
strlcpy(drvinfo->driver, ixgbe_driver_name, sizeof(drvinfo->driver));
strlcpy(drvinfo->version, ixgbe_driver_version,
sizeof(drvinfo->version));
- nvm_track_id = (adapter->eeprom_verh << 16) |
- adapter->eeprom_verl;
- snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "0x%08x",
- nvm_track_id);
+ strlcpy(drvinfo->fw_version, adapter->eeprom_id,
+ sizeof(drvinfo->fw_version));
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
sizeof(drvinfo->bus_info));
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
index a23c2b5411a0..6e6b3c175267 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
@@ -1034,11 +1034,8 @@ int ixgbe_fcoe_get_hbainfo(struct net_device *netdev,
ixgbe_driver_name,
ixgbe_driver_version);
/* Firmware Version */
- snprintf(info->firmware_version,
- sizeof(info->firmware_version),
- "0x%08x",
- (adapter->eeprom_verh << 16) |
- adapter->eeprom_verl);
+ strlcpy(info->firmware_version, adapter->eeprom_id,
+ sizeof(info->firmware_version));
/* Model */
if (hw->mac.type == ixgbe_mac_82599EB) {
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 07d929bf4b50..cfe02893c875 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -10234,6 +10234,41 @@ bool ixgbe_wol_supported(struct ixgbe_adapter *adapter, u16 device_id,
return false;
}
+/**
+ * ixgbe_set_fw_version - Set FW version
+ * @adapter: the adapter private structure
+ *
+ * This function is used by probe and ethtool to determine the FW version to
+ * format to display. The FW version is taken from the EEPROM/NVM.
+ */
+static void ixgbe_set_fw_version(struct ixgbe_adapter *adapter)
+{
+ struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_nvm_version nvm_ver;
+
+ ixgbe_get_oem_prod_version(hw, &nvm_ver);
+ if (nvm_ver.oem_valid) {
+ snprintf(adapter->eeprom_id, sizeof(adapter->eeprom_id),
+ "%x.%x.%x", nvm_ver.oem_major, nvm_ver.oem_minor,
+ nvm_ver.oem_release);
+ return;
+ }
+
+ ixgbe_get_etk_id(hw, &nvm_ver);
+ ixgbe_get_orom_version(hw, &nvm_ver);
+
+ if (nvm_ver.or_valid) {
+ snprintf(adapter->eeprom_id, sizeof(adapter->eeprom_id),
+ "0x%08x, %d.%d.%d", nvm_ver.etk_id, nvm_ver.or_major,
+ nvm_ver.or_build, nvm_ver.or_patch);
+ return;
+ }
+
+ /* Set ETrack ID format */
+ snprintf(adapter->eeprom_id, sizeof(adapter->eeprom_id),
+ "0x%08x", nvm_ver.etk_id);
+}
+
/**
* ixgbe_probe - Device Initialization Routine
* @pdev: PCI device information struct
@@ -10570,8 +10605,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
/* save off EEPROM version number */
- hw->eeprom.ops.read(hw, 0x2e, &adapter->eeprom_verh);
- hw->eeprom.ops.read(hw, 0x2d, &adapter->eeprom_verl);
+ ixgbe_set_fw_version(adapter);
/* pick up the PCI bus settings for reporting later */
if (ixgbe_pcie_from_parent(hw))
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
index ffa0ee5cd0f5..21eb79ae3c30 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
@@ -235,6 +235,45 @@ struct ixgbe_thermal_sensor_data {
struct ixgbe_thermal_diode_data sensor[IXGBE_MAX_SENSORS];
};
+#define NVM_OROM_OFFSET 0x17
+#define NVM_OROM_BLK_LOW 0x83
+#define NVM_OROM_BLK_HI 0x84
+#define NVM_OROM_PATCH_MASK 0xFF
+#define NVM_OROM_SHIFT 8
+
+#define NVM_VER_MASK 0x00FF /* version mask */
+#define NVM_VER_SHIFT 8 /* version bit shift */
+#define NVM_OEM_PROD_VER_PTR 0x1B /* OEM Product version block pointer */
+#define NVM_OEM_PROD_VER_CAP_OFF 0x1 /* OEM Product version format offset */
+#define NVM_OEM_PROD_VER_OFF_L 0x2 /* OEM Product version offset low */
+#define NVM_OEM_PROD_VER_OFF_H 0x3 /* OEM Product version offset high */
+#define NVM_OEM_PROD_VER_CAP_MASK 0xF /* OEM Product version cap mask */
+#define NVM_OEM_PROD_VER_MOD_LEN 0x3 /* OEM Product version module length */
+#define NVM_ETK_OFF_LOW 0x2D /* version low order word */
+#define NVM_ETK_OFF_HI 0x2E /* version high order word */
+#define NVM_ETK_SHIFT 16 /* high version word shift */
+#define NVM_VER_INVALID 0xFFFF
+#define NVM_ETK_VALID 0x8000
+#define NVM_INVALID_PTR 0xFFFF
+#define NVM_VER_SIZE 32 /* version sting size */
+
+struct ixgbe_nvm_version {
+ u32 etk_id;
+ u8 nvm_major;
+ u16 nvm_minor;
+ u8 nvm_id;
+
+ bool oem_valid;
+ u8 oem_major;
+ u8 oem_minor;
+ u16 oem_release;
+
+ bool or_valid;
+ u8 or_major;
+ u16 or_build;
+ u8 or_patch;
+};
+
/* Interrupt Registers */
#define IXGBE_EICR 0x00800
#define IXGBE_EICS 0x00808
--
2.15.1
^ permalink raw reply related
* [net-next 03/13] ixgbe: advertise highest capable link speed
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Paul Greenwalt, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Paul Greenwalt <paul.greenwalt@intel.com>
On module insert advertise highest capable link speed. If module is
capable of 10G, then advertise 10G, else advertise modules capable
link speeds.
Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 43ca5b0d5999..07d929bf4b50 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7656,6 +7656,7 @@ static void ixgbe_sfp_detection_subtask(struct ixgbe_adapter *adapter)
static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
+ u32 cap_speed;
u32 speed;
bool autoneg = false;
@@ -7668,16 +7669,14 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
adapter->flags &= ~IXGBE_FLAG_NEED_LINK_CONFIG;
- speed = hw->phy.autoneg_advertised;
- if ((!speed) && (hw->mac.ops.get_link_capabilities)) {
- hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg);
+ hw->mac.ops.get_link_capabilities(hw, &cap_speed, &autoneg);
- /* setup the highest link when no autoneg */
- if (!autoneg) {
- if (speed & IXGBE_LINK_SPEED_10GB_FULL)
- speed = IXGBE_LINK_SPEED_10GB_FULL;
- }
- }
+ /* advertise highest capable link speed */
+ if (!autoneg && (cap_speed & IXGBE_LINK_SPEED_10GB_FULL))
+ speed = IXGBE_LINK_SPEED_10GB_FULL;
+ else
+ speed = cap_speed & (IXGBE_LINK_SPEED_10GB_FULL |
+ IXGBE_LINK_SPEED_1GB_FULL);
if (hw->mac.ops.setup_link)
hw->mac.ops.setup_link(hw, speed, true);
--
2.15.1
^ permalink raw reply related
* [net-next 01/13] ixgbe: enable multicast on shutdown for WOL
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Emil Tantilov, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Emil Tantilov <emil.s.tantilov@intel.com>
Previously we only enabled the reception of multicast packets when
wake on multicast is set, but we also need this to allow waking with
IPv6 magic packets.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 95aba975b391..b3a1a12712ac 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6791,7 +6791,7 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
struct net_device *netdev = adapter->netdev;
struct ixgbe_hw *hw = &adapter->hw;
- u32 ctrl, fctrl;
+ u32 ctrl;
u32 wufc = adapter->wol;
#ifdef CONFIG_PM
int retval = 0;
@@ -6816,18 +6816,18 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
hw->mac.ops.stop_link_on_d3(hw);
if (wufc) {
+ u32 fctrl;
+
ixgbe_set_rx_mode(netdev);
/* enable the optics for 82599 SFP+ fiber as we can WoL */
if (hw->mac.ops.enable_tx_laser)
hw->mac.ops.enable_tx_laser(hw);
- /* turn on all-multi mode if wake on multicast is enabled */
- if (wufc & IXGBE_WUFC_MC) {
- fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
- fctrl |= IXGBE_FCTRL_MPE;
- IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
- }
+ /* enable the reception of multicast packets */
+ fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
+ fctrl |= IXGBE_FCTRL_MPE;
+ IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
ctrl = IXGBE_READ_REG(hw, IXGBE_CTRL);
ctrl |= IXGBE_CTRL_GIO_DIS;
--
2.15.1
^ permalink raw reply related
* [net-next 05/13] ixgbe: Remove an obsolete comment about ITR
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Tonghao Zhang, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
The InterruptThrottleRate has been removed from ixgbe. Then Update
the comment.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index cfe02893c875..f31254d23146 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2529,8 +2529,6 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
* based on theoretical maximum wire speed and thresholds were set based
* on testing data as well as attempting to minimize response time
* while increasing bulk throughput.
- * this functionality is controlled by the InterruptThrottleRate module
- * parameter (see ixgbe_param.c)
**/
static void ixgbe_update_itr(struct ixgbe_q_vector *q_vector,
struct ixgbe_ring_container *ring_container)
--
2.15.1
^ permalink raw reply related
* [net-next 07/13] ixgbe: Fix interaction between SR-IOV and macvlan offload
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene,
Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
When SR-IOV was enabled the macvlan offload was configuring several filters
with the wrong pool value. This would result in the macvlan interfaces not
being able to receive traffic that had to pass over the physical interface.
To fix it wrap the pool argument in the VMDQ_P macro which will add the
necessary offset to get to the actual VMDq pool
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/ixgbe/ixgbe_main.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index f31254d23146..952663744fc7 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5428,10 +5428,11 @@ static int ixgbe_fwd_ring_up(struct net_device *vdev,
goto fwd_queue_err;
if (is_valid_ether_addr(vdev->dev_addr))
- ixgbe_add_mac_filter(adapter, vdev->dev_addr, accel->pool);
+ ixgbe_add_mac_filter(adapter, vdev->dev_addr,
+ VMDQ_P(accel->pool));
ixgbe_fwd_psrtype(accel);
- ixgbe_macvlan_set_rx_mode(vdev, accel->pool, adapter);
+ ixgbe_macvlan_set_rx_mode(vdev, VMDQ_P(accel->pool), adapter);
return err;
fwd_queue_err:
ixgbe_fwd_ring_down(vdev, accel);
@@ -9042,6 +9043,7 @@ static int get_macvlan_queue(struct net_device *upper, void *_data)
static int handle_redirect_action(struct ixgbe_adapter *adapter, int ifindex,
u8 *queue, u64 *action)
{
+ struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
unsigned int num_vfs = adapter->num_vfs, vf;
struct upper_walk_data data;
struct net_device *upper;
@@ -9050,11 +9052,7 @@ static int handle_redirect_action(struct ixgbe_adapter *adapter, int ifindex,
for (vf = 0; vf < num_vfs; ++vf) {
upper = pci_get_drvdata(adapter->vfinfo[vf].vfdev);
if (upper->ifindex == ifindex) {
- if (adapter->num_rx_pools > 1)
- *queue = vf * 2;
- else
- *queue = vf * adapter->num_rx_queues_per_pool;
-
+ *queue = vf * __ALIGN_MASK(1, ~vmdq->mask);
*action = vf + 1;
*action <<= ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
return 0;
--
2.15.1
^ permalink raw reply related
* [net-next 13/13] ixgbe: Drop l2_accel_priv data pointer from ring struct
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene,
Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
The l2 acceleration private pointer isn't needed in the ring struct. It
isn't really used anywhere other than to test and see if we are supporting
an offloaded macvlan netdev, and it is much easier to test netdev for not
being ixgbe based to verify that.
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/ixgbe/ixgbe.h | 1 -
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 23 +++++++++++++----------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index f656f2bdc570..03a4df0bed96 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -333,7 +333,6 @@ struct ixgbe_ring {
struct net_device *netdev; /* netdev ring belongs to */
struct bpf_prog *xdp_prog;
struct device *dev; /* device for DMA mapping */
- struct ixgbe_fwd_adapter *l2_accel_priv;
void *desc; /* descriptor ring memory */
union {
struct ixgbe_tx_buffer *tx_buffer_info;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 6b61edba8c73..e47e0c470508 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -192,6 +192,13 @@ static struct workqueue_struct *ixgbe_wq;
static bool ixgbe_check_cfg_remove(struct ixgbe_hw *hw, struct pci_dev *pdev);
static void ixgbe_watchdog_link_is_down(struct ixgbe_adapter *);
+static const struct net_device_ops ixgbe_netdev_ops;
+
+static bool netif_is_ixgbe(struct net_device *dev)
+{
+ return dev && (dev->netdev_ops == &ixgbe_netdev_ops);
+}
+
static int ixgbe_read_pci_cfg_word_parent(struct ixgbe_adapter *adapter,
u32 reg, u16 *value)
{
@@ -4481,8 +4488,9 @@ static void ixgbe_vlan_strip_disable(struct ixgbe_adapter *adapter)
for (i = 0; i < adapter->num_rx_queues; i++) {
struct ixgbe_ring *ring = adapter->rx_ring[i];
- if (ring->l2_accel_priv)
+ if (!netif_is_ixgbe(ring->netdev))
continue;
+
j = ring->reg_idx;
vlnctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(j));
vlnctrl &= ~IXGBE_RXDCTL_VME;
@@ -4518,8 +4526,9 @@ static void ixgbe_vlan_strip_enable(struct ixgbe_adapter *adapter)
for (i = 0; i < adapter->num_rx_queues; i++) {
struct ixgbe_ring *ring = adapter->rx_ring[i];
- if (ring->l2_accel_priv)
+ if (!netif_is_ixgbe(ring->netdev))
continue;
+
j = ring->reg_idx;
vlnctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(j));
vlnctrl |= IXGBE_RXDCTL_VME;
@@ -5333,7 +5342,6 @@ static void ixgbe_disable_fwd_ring(struct ixgbe_fwd_adapter *vadapter,
usleep_range(10000, 20000);
ixgbe_irq_disable_queues(adapter, BIT_ULL(index));
ixgbe_clean_rx_ring(rx_ring);
- rx_ring->l2_accel_priv = NULL;
}
static int ixgbe_fwd_ring_down(struct net_device *vdev,
@@ -5351,10 +5359,8 @@ static int ixgbe_fwd_ring_down(struct net_device *vdev,
adapter->rx_ring[rxbase + i]->netdev = adapter->netdev;
}
- for (i = 0; i < adapter->num_rx_queues_per_pool; i++) {
- adapter->tx_ring[txbase + i]->l2_accel_priv = NULL;
+ for (i = 0; i < adapter->num_rx_queues_per_pool; i++)
adapter->tx_ring[txbase + i]->netdev = adapter->netdev;
- }
return 0;
@@ -5384,14 +5390,11 @@ static int ixgbe_fwd_ring_up(struct net_device *vdev,
for (i = 0; i < adapter->num_rx_queues_per_pool; i++) {
adapter->rx_ring[rxbase + i]->netdev = vdev;
- adapter->rx_ring[rxbase + i]->l2_accel_priv = accel;
ixgbe_configure_rx_ring(adapter, adapter->rx_ring[rxbase + i]);
}
- for (i = 0; i < adapter->num_rx_queues_per_pool; i++) {
+ for (i = 0; i < adapter->num_rx_queues_per_pool; i++)
adapter->tx_ring[txbase + i]->netdev = vdev;
- adapter->tx_ring[txbase + i]->l2_accel_priv = accel;
- }
queues = min_t(unsigned int,
adapter->num_rx_queues_per_pool, vdev->num_tx_queues);
--
2.15.1
^ permalink raw reply related
* [net-next 06/13] ixgbevf: remove redundant setting of xcast_mode
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Emil Tantilov, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Emil Tantilov <emil.s.tantilov@intel.com>
Removed leftover assignment of xcast_mode.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 1f4a69134ade..573f743b556a 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -1896,10 +1896,6 @@ static void ixgbevf_set_rx_mode(struct net_device *netdev)
unsigned int flags = netdev->flags;
int xcast_mode;
- xcast_mode = (flags & IFF_ALLMULTI) ? IXGBEVF_XCAST_MODE_ALLMULTI :
- (flags & (IFF_BROADCAST | IFF_MULTICAST)) ?
- IXGBEVF_XCAST_MODE_MULTI : IXGBEVF_XCAST_MODE_NONE;
-
/* request the most inclusive mode we need */
if (flags & IFF_PROMISC)
xcast_mode = IXGBEVF_XCAST_MODE_PROMISC;
--
2.15.1
^ permalink raw reply related
* [net-next 08/13] ixgbe: Perform reinit any time number of VFs change
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene,
Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
If the number of VFs are changed we need to reinitialize the part since the
offset for the device and the number of pools will be incorrect. Without
this change we can end up seeing Tx hangs and dropped Rx frames for
incoming traffic.
In addition we should drop the code that is arbitrarily changing the
default pool and queue configuration. Instead we should wait until the port
is reset and reconfigured via ixgbe_sriov_reinit.
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/ixgbe/ixgbe_sriov.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 112d24c6c9ce..15d89258fbc3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -227,9 +227,6 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter, unsigned int max_vfs)
int ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
{
unsigned int num_vfs = adapter->num_vfs, vf;
- struct ixgbe_hw *hw = &adapter->hw;
- u32 gpie;
- u32 vmdctl;
int rss;
/* set num VFs to 0 to prevent access to vfinfo */
@@ -271,18 +268,6 @@ int ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
pci_disable_sriov(adapter->pdev);
#endif
- /* turn off device IOV mode */
- IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, 0);
- gpie = IXGBE_READ_REG(hw, IXGBE_GPIE);
- gpie &= ~IXGBE_GPIE_VTMODE_MASK;
- IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
-
- /* set default pool back to 0 */
- vmdctl = IXGBE_READ_REG(hw, IXGBE_VT_CTL);
- vmdctl &= ~IXGBE_VT_CTL_POOL_MASK;
- IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl);
- IXGBE_WRITE_FLUSH(hw);
-
/* Disable VMDq flag so device will be set in VM mode */
if (adapter->ring_feature[RING_F_VMDQ].limit == 1) {
adapter->flags &= ~IXGBE_FLAG_VMDQ_ENABLED;
@@ -378,13 +363,15 @@ static int ixgbe_pci_sriov_disable(struct pci_dev *dev)
int err;
#ifdef CONFIG_PCI_IOV
u32 current_flags = adapter->flags;
+ int prev_num_vf = pci_num_vf(dev);
#endif
err = ixgbe_disable_sriov(adapter);
/* Only reinit if no error and state changed */
#ifdef CONFIG_PCI_IOV
- if (!err && current_flags != adapter->flags)
+ if (!err && (current_flags != adapter->flags ||
+ prev_num_vf != pci_num_vf(dev)))
ixgbe_sriov_reinit(adapter);
#endif
--
2.15.1
^ permalink raw reply related
* [net-next 11/13] ixgbe: Fix limitations on macvlan so we can support up to 63 offloaded devices
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene,
Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
This change is a fix of the macvlan offload so that we correctly handle
macvlan offloaded devices. Specifically we were configuring our limits based
on the assumption that we were going to max out the RSS indices for every
mode. As a result when we went to 15 or more macvlan interfaces we were
forced into the 2 queue RSS mode on VFs even though they could have still
supported 4.
This change splits the logic up so that we limit either the total number of
macvlan instances if DCB is enabled, or limit the number of RSS queues used
per macvlan (instead of per pool) if SR-IOV is enabled. By doing this we
can make best use of the part.
In addition I have increased the maximum number of supported interfaces to
63 with one queue per offloaded interface as this more closely reflects the
actual values supported by the interface.
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/ixgbe/ixgbe.h | 6 ++---
drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 9 +++++--
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 35 +++++++++++---------------
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 27 +++++++-------------
4 files changed, 34 insertions(+), 43 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 08fb589399d2..f656f2bdc570 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -397,8 +397,7 @@ enum ixgbe_ring_f_enum {
#define MAX_XDP_QUEUES (IXGBE_MAX_FDIR_INDICES + 1)
#define IXGBE_MAX_L2A_QUEUES 4
#define IXGBE_BAD_L2A_QUEUE 3
-#define IXGBE_MAX_MACVLANS 31
-#define IXGBE_MAX_DCBMACVLANS 8
+#define IXGBE_MAX_MACVLANS 63
struct ixgbe_ring_feature {
u16 limit; /* upper limit on feature indices */
@@ -767,7 +766,8 @@ struct ixgbe_adapter {
#endif /*CONFIG_DEBUG_FS*/
u8 default_up;
- unsigned long fwd_bitmask; /* Bitmask indicating in use pools */
+ /* Bitmask indicating in use pools */
+ DECLARE_BITMAP(fwd_bitmask, IXGBE_MAX_MACVLANS + 1);
#define IXGBE_MAX_LINK_HANDLE 10
struct ixgbe_jump_table *jump_tables[IXGBE_MAX_LINK_HANDLE];
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 56622adc76dc..cceafbc3f1db 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -350,6 +350,9 @@ static bool ixgbe_set_dcb_sriov_queues(struct ixgbe_adapter *adapter)
if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
return false;
+ /* limit VMDq instances on the PF by number of Tx queues */
+ vmdq_i = min_t(u16, vmdq_i, MAX_TX_QUEUES / tcs);
+
/* Add starting offset to total pool count */
vmdq_i += adapter->ring_feature[RING_F_VMDQ].offset;
@@ -512,12 +515,14 @@ static bool ixgbe_set_sriov_queues(struct ixgbe_adapter *adapter)
#ifdef IXGBE_FCOE
u16 fcoe_i = 0;
#endif
- bool pools = (find_first_zero_bit(&adapter->fwd_bitmask, 32) > 1);
/* only proceed if SR-IOV is enabled */
if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
return false;
+ /* limit l2fwd RSS based on total Tx queue limit */
+ rss_i = min_t(u16, rss_i, MAX_TX_QUEUES / vmdq_i);
+
/* Add starting offset to total pool count */
vmdq_i += adapter->ring_feature[RING_F_VMDQ].offset;
@@ -525,7 +530,7 @@ static bool ixgbe_set_sriov_queues(struct ixgbe_adapter *adapter)
vmdq_i = min_t(u16, IXGBE_MAX_VMDQ_INDICES, vmdq_i);
/* 64 pool mode with 2 queues per pool */
- if ((vmdq_i > 32) || (vmdq_i > 16 && pools)) {
+ if (vmdq_i > 32) {
vmdq_m = IXGBE_82599_VMDQ_2Q_MASK;
rss_m = IXGBE_RSS_2Q_MASK;
rss_i = min_t(u16, rss_i, 2);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 4efb2b078f20..144674c6c293 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5379,14 +5379,13 @@ static int ixgbe_fwd_ring_up(struct net_device *vdev,
unsigned int rxbase, txbase, queues;
int i, baseq, err = 0;
- if (!test_bit(accel->pool, &adapter->fwd_bitmask))
+ if (!test_bit(accel->pool, adapter->fwd_bitmask))
return 0;
baseq = accel->pool * adapter->num_rx_queues_per_pool;
- netdev_dbg(vdev, "pool %i:%i queues %i:%i VSI bitmask %lx\n",
+ netdev_dbg(vdev, "pool %i:%i queues %i:%i\n",
accel->pool, adapter->num_rx_pools,
- baseq, baseq + adapter->num_rx_queues_per_pool,
- adapter->fwd_bitmask);
+ baseq, baseq + adapter->num_rx_queues_per_pool);
accel->netdev = vdev;
accel->rx_base_queue = rxbase = baseq;
@@ -6284,7 +6283,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,
}
/* PF holds first pool slot */
- set_bit(0, &adapter->fwd_bitmask);
+ set_bit(0, adapter->fwd_bitmask);
set_bit(__IXGBE_DOWN, &adapter->state);
return 0;
@@ -8856,7 +8855,6 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
{
struct ixgbe_adapter *adapter = netdev_priv(dev);
struct ixgbe_hw *hw = &adapter->hw;
- bool pools;
/* Hardware supports up to 8 traffic classes */
if (tc > adapter->dcb_cfg.num_tcs.pg_tcs)
@@ -8865,10 +8863,6 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc)
if (hw->mac.type == ixgbe_mac_82598EB && tc && tc < MAX_TRAFFIC_CLASS)
return -EINVAL;
- pools = (find_first_zero_bit(&adapter->fwd_bitmask, 32) > 1);
- if (tc && pools && adapter->num_rx_pools > IXGBE_MAX_DCBMACVLANS)
- return -EBUSY;
-
/* Hardware has to reinitialize queues and interrupts to
* match packet buffer alignment. Unfortunately, the
* hardware is not flexible enough to do this dynamically.
@@ -9807,6 +9801,7 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
struct ixgbe_fwd_adapter *fwd_adapter = NULL;
struct ixgbe_adapter *adapter = netdev_priv(pdev);
int used_pools = adapter->num_vfs + adapter->num_rx_pools;
+ int tcs = netdev_get_num_tc(pdev) ? : 1;
unsigned int limit;
int pool, err;
@@ -9834,7 +9829,7 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
}
if (((adapter->flags & IXGBE_FLAG_DCB_ENABLED) &&
- adapter->num_rx_pools > IXGBE_MAX_DCBMACVLANS - 1) ||
+ adapter->num_rx_pools >= (MAX_TX_QUEUES / tcs)) ||
(adapter->num_rx_pools > IXGBE_MAX_MACVLANS))
return ERR_PTR(-EBUSY);
@@ -9842,9 +9837,9 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
if (!fwd_adapter)
return ERR_PTR(-ENOMEM);
- pool = find_first_zero_bit(&adapter->fwd_bitmask, 32);
- set_bit(pool, &adapter->fwd_bitmask);
- limit = find_last_bit(&adapter->fwd_bitmask, 32);
+ pool = find_first_zero_bit(adapter->fwd_bitmask, adapter->num_rx_pools);
+ set_bit(pool, adapter->fwd_bitmask);
+ limit = find_last_bit(adapter->fwd_bitmask, adapter->num_rx_pools + 1);
/* Enable VMDq flag so device will be set in VM mode */
adapter->flags |= IXGBE_FLAG_VMDQ_ENABLED | IXGBE_FLAG_SRIOV_ENABLED;
@@ -9870,7 +9865,7 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
/* unwind counter and free adapter struct */
netdev_info(pdev,
"%s: dfwd hardware acceleration failed\n", vdev->name);
- clear_bit(pool, &adapter->fwd_bitmask);
+ clear_bit(pool, adapter->fwd_bitmask);
kfree(fwd_adapter);
return ERR_PTR(err);
}
@@ -9881,9 +9876,9 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv)
struct ixgbe_adapter *adapter = fwd_adapter->real_adapter;
unsigned int limit;
- clear_bit(fwd_adapter->pool, &adapter->fwd_bitmask);
+ clear_bit(fwd_adapter->pool, adapter->fwd_bitmask);
- limit = find_last_bit(&adapter->fwd_bitmask, 32);
+ limit = find_last_bit(adapter->fwd_bitmask, adapter->num_rx_pools);
adapter->ring_feature[RING_F_VMDQ].limit = limit + 1;
ixgbe_fwd_ring_down(fwd_adapter->netdev, fwd_adapter);
@@ -9898,11 +9893,11 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv)
}
ixgbe_setup_tc(pdev, netdev_get_num_tc(pdev));
- netdev_dbg(pdev, "pool %i:%i queues %i:%i VSI bitmask %lx\n",
+ netdev_dbg(pdev, "pool %i:%i queues %i:%i\n",
fwd_adapter->pool, adapter->num_rx_pools,
fwd_adapter->rx_base_queue,
- fwd_adapter->rx_base_queue + adapter->num_rx_queues_per_pool,
- adapter->fwd_bitmask);
+ fwd_adapter->rx_base_queue +
+ adapter->num_rx_queues_per_pool);
kfree(fwd_adapter);
}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 15d89258fbc3..0085f4632966 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -290,10 +290,9 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)
{
#ifdef CONFIG_PCI_IOV
struct ixgbe_adapter *adapter = pci_get_drvdata(dev);
- int err = 0;
- u8 num_tc;
- int i;
int pre_existing_vfs = pci_num_vf(dev);
+ int err = 0, num_rx_pools, i, limit;
+ u8 num_tc;
if (pre_existing_vfs && pre_existing_vfs != num_vfs)
err = ixgbe_disable_sriov(adapter);
@@ -316,22 +315,14 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)
* other values out of range.
*/
num_tc = netdev_get_num_tc(adapter->netdev);
+ num_rx_pools = adapter->num_rx_pools;
+ limit = (num_tc > 4) ? IXGBE_MAX_VFS_8TC :
+ (num_tc > 1) ? IXGBE_MAX_VFS_4TC : IXGBE_MAX_VFS_1TC;
- if (num_tc > 4) {
- if ((num_vfs + adapter->num_rx_pools) > IXGBE_MAX_VFS_8TC) {
- e_dev_err("Currently the device is configured with %d TCs, Creating more than %d VFs is not allowed\n", num_tc, IXGBE_MAX_VFS_8TC);
- return -EPERM;
- }
- } else if ((num_tc > 1) && (num_tc <= 4)) {
- if ((num_vfs + adapter->num_rx_pools) > IXGBE_MAX_VFS_4TC) {
- e_dev_err("Currently the device is configured with %d TCs, Creating more than %d VFs is not allowed\n", num_tc, IXGBE_MAX_VFS_4TC);
- return -EPERM;
- }
- } else {
- if ((num_vfs + adapter->num_rx_pools) > IXGBE_MAX_VFS_1TC) {
- e_dev_err("Currently the device is configured with %d TCs, Creating more than %d VFs is not allowed\n", num_tc, IXGBE_MAX_VFS_1TC);
- return -EPERM;
- }
+ if (num_vfs > (limit - num_rx_pools)) {
+ e_dev_err("Currently configured with %d TCs, and %d offloaded macvlans. Creating more than %d VFs is not allowed\n",
+ num_tc, num_rx_pools - 1, limit - num_rx_pools);
+ return -EPERM;
}
err = __ixgbe_enable_sriov(adapter, num_vfs);
--
2.15.1
^ permalink raw reply related
* [net-next 09/13] ixgbe: Add support for macvlan offload RSS on X550 and clean-up pool handling
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene,
Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
In order for RSS to work on the macvlan pools of the X550 we need to
populate the MRQC, RETA, and RSS key values for each pool. This patch makes
it so that we now take care of that.
In addition I have dropped the macvlan specific configuration of psrtype
since it is redundant with the code that already exists for configuring
this value.
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/ixgbe/ixgbe_main.c | 62 +++++++++++----------------
1 file changed, 25 insertions(+), 37 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 952663744fc7..5ccc3b6ccab1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3846,16 +3846,20 @@ static void ixgbe_store_vfreta(struct ixgbe_adapter *adapter)
u32 i, reta_entries = ixgbe_rss_indir_tbl_entries(adapter);
struct ixgbe_hw *hw = &adapter->hw;
u32 vfreta = 0;
- unsigned int pf_pool = adapter->num_vfs;
/* Write redirection table to HW */
for (i = 0; i < reta_entries; i++) {
+ u16 pool = adapter->num_rx_pools;
+
vfreta |= (u32)adapter->rss_indir_tbl[i] << (i & 0x3) * 8;
- if ((i & 3) == 3) {
- IXGBE_WRITE_REG(hw, IXGBE_PFVFRETA(i >> 2, pf_pool),
+ if ((i & 3) != 3)
+ continue;
+
+ while (pool--)
+ IXGBE_WRITE_REG(hw,
+ IXGBE_PFVFRETA(i >> 2, VMDQ_P(pool)),
vfreta);
- vfreta = 0;
- }
+ vfreta = 0;
}
}
@@ -3892,13 +3896,17 @@ static void ixgbe_setup_vfreta(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
- unsigned int pf_pool = adapter->num_vfs;
int i, j;
/* Fill out hash function seeds */
- for (i = 0; i < 10; i++)
- IXGBE_WRITE_REG(hw, IXGBE_PFVFRSSRK(i, pf_pool),
- *(adapter->rss_key + i));
+ for (i = 0; i < 10; i++) {
+ u16 pool = adapter->num_rx_pools;
+
+ while (pool--)
+ IXGBE_WRITE_REG(hw,
+ IXGBE_PFVFRSSRK(i, VMDQ_P(pool)),
+ *(adapter->rss_key + i));
+ }
/* Fill out the redirection table */
for (i = 0, j = 0; i < 64; i++, j++) {
@@ -3964,7 +3972,7 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)
if ((hw->mac.type >= ixgbe_mac_X550) &&
(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) {
- unsigned int pf_pool = adapter->num_vfs;
+ u16 pool = adapter->num_rx_pools;
/* Enable VF RSS mode */
mrqc |= IXGBE_MRQC_MULTIPLE_RSS;
@@ -3974,7 +3982,11 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)
ixgbe_setup_vfreta(adapter);
vfmrqc = IXGBE_MRQC_RSSEN;
vfmrqc |= rss_field;
- IXGBE_WRITE_REG(hw, IXGBE_PFVFMRQC(pf_pool), vfmrqc);
+
+ while (pool--)
+ IXGBE_WRITE_REG(hw,
+ IXGBE_PFVFMRQC(VMDQ_P(pool)),
+ vfmrqc);
} else {
ixgbe_setup_reta(adapter);
mrqc |= rss_field;
@@ -4137,7 +4149,7 @@ static void ixgbe_setup_psrtype(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
int rss_i = adapter->ring_feature[RING_F_RSS].indices;
- u16 pool;
+ u16 pool = adapter->num_rx_pools;
/* PSRTYPE must be initialized in non 82598 adapters */
u32 psrtype = IXGBE_PSRTYPE_TCPHDR |
@@ -4154,7 +4166,7 @@ static void ixgbe_setup_psrtype(struct ixgbe_adapter *adapter)
else if (rss_i > 1)
psrtype |= 1u << 29;
- for_each_set_bit(pool, &adapter->fwd_bitmask, 32)
+ while (pool--)
IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(VMDQ_P(pool)), psrtype);
}
@@ -5270,29 +5282,6 @@ static void ixgbe_macvlan_set_rx_mode(struct net_device *dev, unsigned int pool,
IXGBE_WRITE_REG(hw, IXGBE_VMOLR(pool), vmolr);
}
-static void ixgbe_fwd_psrtype(struct ixgbe_fwd_adapter *vadapter)
-{
- struct ixgbe_adapter *adapter = vadapter->real_adapter;
- int rss_i = adapter->num_rx_queues_per_pool;
- struct ixgbe_hw *hw = &adapter->hw;
- u16 pool = vadapter->pool;
- u32 psrtype = IXGBE_PSRTYPE_TCPHDR |
- IXGBE_PSRTYPE_UDPHDR |
- IXGBE_PSRTYPE_IPV4HDR |
- IXGBE_PSRTYPE_L2HDR |
- IXGBE_PSRTYPE_IPV6HDR;
-
- if (hw->mac.type == ixgbe_mac_82598EB)
- return;
-
- if (rss_i > 3)
- psrtype |= 2u << 29;
- else if (rss_i > 1)
- psrtype |= 1u << 29;
-
- IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(VMDQ_P(pool)), psrtype);
-}
-
/**
* ixgbe_clean_rx_ring - Free Rx Buffers per Queue
* @rx_ring: ring to free buffers from
@@ -5431,7 +5420,6 @@ static int ixgbe_fwd_ring_up(struct net_device *vdev,
ixgbe_add_mac_filter(adapter, vdev->dev_addr,
VMDQ_P(accel->pool));
- ixgbe_fwd_psrtype(accel);
ixgbe_macvlan_set_rx_mode(vdev, VMDQ_P(accel->pool), adapter);
return err;
fwd_queue_err:
--
2.15.1
^ permalink raw reply related
* [net-next 10/13] ixgbe: There is no need to update num_rx_pools in L2 fwd offload
From: Jeff Kirsher @ 2018-01-09 19:02 UTC (permalink / raw)
To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene,
Jeff Kirsher
In-Reply-To: <20180109190233.15206-1-jeffrey.t.kirsher@intel.com>
From: Alexander Duyck <alexander.h.duyck@intel.com>
The num_rx_pools value is overwritten when we reinitialize the queue
configuration. In reality we shouldn't need to be updating the value since
it is redone every time we call into ixgbe_setup_tc so for now just drop
the spots where we were incrementing or decrementing the value.
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/ixgbe/ixgbe_lib.c | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 8e2a957aca18..56622adc76dc 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -701,7 +701,7 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
adapter->num_rx_queues = 1;
adapter->num_tx_queues = 1;
adapter->num_xdp_queues = 0;
- adapter->num_rx_pools = adapter->num_rx_queues;
+ adapter->num_rx_pools = 1;
adapter->num_rx_queues_per_pool = 1;
#ifdef CONFIG_IXGBE_DCB
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 5ccc3b6ccab1..4efb2b078f20 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -9843,7 +9843,6 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
return ERR_PTR(-ENOMEM);
pool = find_first_zero_bit(&adapter->fwd_bitmask, 32);
- adapter->num_rx_pools++;
set_bit(pool, &adapter->fwd_bitmask);
limit = find_last_bit(&adapter->fwd_bitmask, 32);
@@ -9872,7 +9871,6 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
netdev_info(pdev,
"%s: dfwd hardware acceleration failed\n", vdev->name);
clear_bit(pool, &adapter->fwd_bitmask);
- adapter->num_rx_pools--;
kfree(fwd_adapter);
return ERR_PTR(err);
}
@@ -9884,7 +9882,6 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv)
unsigned int limit;
clear_bit(fwd_adapter->pool, &adapter->fwd_bitmask);
- adapter->num_rx_pools--;
limit = find_last_bit(&adapter->fwd_bitmask, 32);
adapter->ring_feature[RING_F_VMDQ].limit = limit + 1;
--
2.15.1
^ permalink raw reply related
* Re: [RFC PATCH 3/3] tcp: Add tunable parameters for TSQ
From: Eric Dumazet @ 2018-01-09 19:04 UTC (permalink / raw)
To: Natale Patriciello; +Cc: netdev, carloaugusto.grazia
In-Reply-To: <20180106192212.vb2okckpvvh5tx7k@judith.localdomain>
On Sat, 2018-01-06 at 20:22 +0100, Natale Patriciello wrote:
> Thank you, Eric and David, for the time spent in reviewing our work.
> Some comments inline:
>
> On 05/01/18 at 03:53am, Eric Dumazet wrote:
>
> > I do not want to add yet another condition in fast path.
> > Just put an arbitrary large value in the existing sysctl, no need for
> > extra code.
>
> Due to the minimum statement at the line 2202, the algorithm will ignore
> the arbitrarily large value and will use ~1 ms of data at the current
> rate or 2 segments instead. Therefore, right now there is not the
> possibility to completely disable TSQ, while there was in the first
> version of it.
We do not want to disable TSQ, or even allow someone to disable it.
limit = max(2 * skb->truesize,
sk->sk_pacing_rate >> sk->sk_pacing_shift);
limit = min_t(u32, limit,
sock_net(sk)->ipv4.sysctl_tcp_limit_output_bytes);
Meaning that if you set sk_pacing_shift to 0, you allow to fill the NIC
with 1 second of TCP data per flow. Which is insanely high.
>
> > You provide dubious reasons, and no real tests done on various
> > hardwares.
>
> We did perform some test internally on a 4.13 kernel for an academic
> submission. By varying the parameters, we were able to double the
> throughput reachable by any congestion {avoidance, control} algorithm on
> top of 2.4GHz networks with a channel of 40 MHz, and to reduce latency
> (maybe there is some kind of data waiting that is done at
> driver/firmware/hardware level).
Right, we know that bufferbloat helps to get high throughput on a
single flow in a controlled environment.
> Then we saw the patch, and we became
> aware of the community interest in the topic and decided to ask for
> feedback on a revised version.
No driver uses yet the infra, yet you want to revise it ?
This makes no sense.
>
> We will for sure increase the number of test cases (including CPU usage)
> and report as soon as the academic world allows us. We are happily using
> Flent for the testing phase.
>
> > A linux host can have one 10Gbit NIC and a wifi adapter, they require
> > different tunings.
>
> This is an excellent example that we did not consider while developing
> the patch. Thanks.
>
> > This is why we added sk_pacing_shift_update(). If this needs
> > refinement, lets talk.
>
> We believe that it is fundamental to give the user the runtime control
> of the algorithm, which right now starts with latency-saving default
> values but is tailored for a specific kind of network. As you pointed
> out, these should be tuned per-interface. In the following days, we will
> perform more focused testing, trying to assess if there are cases in
> which a fine-tuning is preferable to a logarithmic one.
fine-tuning looks overkill here, especially if you need an extra divide
or more socket space...
>
> Meanwhile, what would be the best way to expose sk_pacing_shift to the
> userspace?
>
sk_pacing_shift is not yet part of the ABI. We do not know if it will
be enough or not.
There is no point exposing it, unless we want to keep it for the years
to come (ABI is in stone) and believe user should get it.
^ permalink raw reply
* Re: [patch iproute2 v7 2/2] tc: Add batchsize feature for filter and actions
From: Marcelo Ricardo Leitner @ 2018-01-09 19:13 UTC (permalink / raw)
To: Chris Mi; +Cc: netdev, gerlitz.or, stephen, dsahern, phil
In-Reply-To: <20180109065908.19754-3-chrism@mellanox.com>
On Tue, Jan 09, 2018 at 03:59:08PM +0900, Chris Mi wrote:
> Currently in tc batch mode, only one command is read from the batch
> file and sent to kernel to process. With this support, at most 128
> commands can be accumulated before sending to kernel.
>
> Now it only works for the following successive commands:
> filter and actions add/delete/change/replace.
>
> Signed-off-by: Chris Mi <chrism@mellanox.com>
> ---
> tc/m_action.c | 60 +++++++++++++++++----------
> tc/tc.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
> tc/tc_common.h | 5 ++-
> tc/tc_filter.c | 97 +++++++++++++++++++++++++------------------
> 4 files changed, 210 insertions(+), 79 deletions(-)
>
> diff --git a/tc/m_action.c b/tc/m_action.c
> index fc422364..e5c53a80 100644
> --- a/tc/m_action.c
> +++ b/tc/m_action.c
> @@ -546,40 +546,56 @@ bad_val:
> return ret;
> }
>
> +struct tc_action_req {
> + struct nlmsghdr n;
> + struct tcamsg t;
> + char buf[MAX_MSG];
> +};
> +
> static int tc_action_modify(int cmd, unsigned int flags,
> - int *argc_p, char ***argv_p)
> + int *argc_p, char ***argv_p,
> + void *buf)
> {
> - int argc = *argc_p;
> + struct tc_action_req *req, action_req;
> char **argv = *argv_p;
> + struct rtattr *tail;
> + int argc = *argc_p;
> + struct iovec iov;
> int ret = 0;
> - struct {
> - struct nlmsghdr n;
> - struct tcamsg t;
> - char buf[MAX_MSG];
> - } req = {
> - .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcamsg)),
> - .n.nlmsg_flags = NLM_F_REQUEST | flags,
> - .n.nlmsg_type = cmd,
> - .t.tca_family = AF_UNSPEC,
> - };
> - struct rtattr *tail = NLMSG_TAIL(&req.n);
> +
> + if (buf)
> + req = buf;
> + else
> + req = &action_req;
> +
> + req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcamsg));
> + req->n.nlmsg_flags = NLM_F_REQUEST | flags;
> + req->n.nlmsg_type = cmd;
> + req->t.tca_family = AF_UNSPEC;
> + tail = NLMSG_TAIL(&req->n);
>
> argc -= 1;
> argv += 1;
> - if (parse_action(&argc, &argv, TCA_ACT_TAB, &req.n)) {
> + if (parse_action(&argc, &argv, TCA_ACT_TAB, &req->n)) {
> fprintf(stderr, "Illegal \"action\"\n");
> return -1;
> }
> - tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail;
> + tail->rta_len = (void *) NLMSG_TAIL(&req->n) - (void *) tail;
> +
> + *argc_p = argc;
> + *argv_p = argv;
>
> - if (rtnl_talk(&rth, &req.n, NULL) < 0) {
> + iov.iov_base = &req->n;
> + iov.iov_len = req->n.nlmsg_len;
> +
> + if (buf)
> + return 0;
> +
> + if (rtnl_talk_iov(&rth, &iov, 1, NULL) < 0) {
> fprintf(stderr, "We have an error talking to the kernel\n");
> ret = -1;
> }
>
> - *argc_p = argc;
> - *argv_p = argv;
> -
> return ret;
> }
>
> @@ -679,7 +695,7 @@ bad_val:
> return ret;
> }
>
> -int do_action(int argc, char **argv)
> +int do_action(int argc, char **argv, void *buf)
> {
>
> int ret = 0;
> @@ -689,12 +705,12 @@ int do_action(int argc, char **argv)
> if (matches(*argv, "add") == 0) {
> ret = tc_action_modify(RTM_NEWACTION,
> NLM_F_EXCL | NLM_F_CREATE,
> - &argc, &argv);
> + &argc, &argv, buf);
> } else if (matches(*argv, "change") == 0 ||
> matches(*argv, "replace") == 0) {
> ret = tc_action_modify(RTM_NEWACTION,
> NLM_F_CREATE | NLM_F_REPLACE,
> - &argc, &argv);
> + &argc, &argv, buf);
> } else if (matches(*argv, "delete") == 0) {
> argc -= 1;
> argv += 1;
> diff --git a/tc/tc.c b/tc/tc.c
> index ad9f07e9..f32e4978 100644
> --- a/tc/tc.c
> +++ b/tc/tc.c
> @@ -193,16 +193,16 @@ static void usage(void)
> " -nm | -nam[es] | { -cf | -conf } path } | -j[son]\n");
> }
>
> -static int do_cmd(int argc, char **argv)
> +static int do_cmd(int argc, char **argv, void *buf)
> {
> if (matches(*argv, "qdisc") == 0)
> return do_qdisc(argc-1, argv+1);
> if (matches(*argv, "class") == 0)
> return do_class(argc-1, argv+1);
> if (matches(*argv, "filter") == 0)
> - return do_filter(argc-1, argv+1);
> + return do_filter(argc-1, argv+1, buf);
> if (matches(*argv, "actions") == 0)
> - return do_action(argc-1, argv+1);
> + return do_action(argc-1, argv+1, buf);
> if (matches(*argv, "monitor") == 0)
> return do_tcmonitor(argc-1, argv+1);
> if (matches(*argv, "exec") == 0)
> @@ -217,11 +217,39 @@ static int do_cmd(int argc, char **argv)
> return -1;
> }
>
> +static bool batchsize_enabled(int argc, char *argv[])
> +{
> + if (argc < 2)
> + return false;
> + if ((strcmp(argv[0], "filter") && strcmp(argv[0], "action"))
> + || (strcmp(argv[1], "add") && strcmp(argv[1], "delete")
> + && strcmp(argv[1], "change") && strcmp(argv[1], "replace")))
> + return false;
> +
> + return true;
> +}
> +
> +struct batch_buf {
> + struct batch_buf *next;
> + char buf[16420]; /* sizeof (struct nlmsghdr) +
> + sizeof (struct tcmsg) +
> + MAX_MSG */
> +};
> +
> static int batch(const char *name)
> {
> - char *line = NULL;
> + struct batch_buf *head = NULL, *tail = NULL, *buf;
Hi. Overall it looks much better IMHO.
Maybe declare *buf in the two sections that it is used, to make it
clear that it cannot be reused between them? (minor, yes..)
> + char *largv[100], *largv_next[100];
A define for the 100 is probably welcomed,
> + char *line, *line_next = NULL;
> + bool bs_enabled_next = false;
> + bool bs_enabled = false;
> + bool lastline = false;
> + int largc, largc_next;
> + bool bs_enabled_saved;
> + int batchsize = 0;
> size_t len = 0;
> - int ret = 0;
> + int ret = 0, i;
> + bool send;
>
> batch_mode = 1;
> if (name && strcmp(name, "-") != 0) {
> @@ -240,23 +268,92 @@ static int batch(const char *name)
> }
>
> cmdlineno = 0;
> - while (getcmdline(&line, &len, stdin) != -1) {
> - char *largv[100];
> - int largc;
> + if (getcmdline(&line, &len, stdin) == -1)
> + goto Exit;
> + largc = makeargs(line, largv, 100);
> + bs_enabled = batchsize_enabled(largc, largv);
> + bs_enabled_saved = bs_enabled;
> + do {
> + if (getcmdline(&line_next, &len, stdin) == -1)
> + lastline = true;
> +
> + largc_next = makeargs(line_next, largv_next, 100);
> + bs_enabled_next = batchsize_enabled(largc_next, largv_next);
> + if (bs_enabled) {
> + buf = calloc(1, sizeof (struct batch_buf));
if (!buf) .. ?
> + if (head == NULL) {
> + head = tail = buf;
> + buf->next = NULL;
this
> + } else {
> + buf->next = NULL;
and this NULL assignments are not needed because you used calloc(), so
it's already zeroed.
> + tail->next = buf;
> + tail = buf;
> + }
> + ++batchsize;
> + }
> +
> + /*
> + * In batch mode, if we haven't accumulated enough commands
> + * and this is not the last command and this command & next
> + * command both support the batchsize feature, don't send the
> + * message immediately.
> + */
> + if (!lastline && bs_enabled && bs_enabled_next
> + && batchsize != MSG_IOV_MAX)
> + send = false;
> + else
> + send = true;
> +
> + line = line_next;
> + line_next = NULL;
> + len = 0;
> + bs_enabled_saved = bs_enabled;
> + bs_enabled = bs_enabled_next;
> + bs_enabled_next = false;
>
> - largc = makeargs(line, largv, 100);
> if (largc == 0)
> continue; /* blank line */
>
> - if (do_cmd(largc, largv)) {
> - fprintf(stderr, "Command failed %s:%d\n", name, cmdlineno);
> + ret = do_cmd(largc, largv, tail == NULL ? NULL : tail->buf);
> + if (ret != 0) {
> + fprintf(stderr, "Command failed %s:%d\n", name,
> + cmdlineno - 1);
> ret = 1;
> if (!force)
> break;
> }
> - }
> - if (line)
> - free(line);
> + largc = largc_next;
> + for (i = 0; i < largc; i ++)
> + largv[i] = largv_next[i];
This loop can be a single memcpy()
memcpy(largv, largv_next, sizeof(largv));
> +
> + if (send && bs_enabled_saved) {
> + struct iovec *iov, *iovs;
> + struct nlmsghdr *n;
> + iov = iovs = malloc(batchsize * sizeof (struct iovec));
> + for (buf = head; buf != NULL; buf = buf->next, ++iov) {
> + n = (struct nlmsghdr *)&buf->buf;
> + iov->iov_base = n;
> + iov->iov_len = n->nlmsg_len;
> + }
> +
> + ret = rtnl_talk_iov(&rth, iovs, batchsize, NULL);
> + if (ret < 0) {
> + fprintf(stderr, "Command failed %s:%d\n", name,
> + cmdlineno - (batchsize + ret) - 1);
> + return 2;
> + }
> + for (buf = head; buf != NULL; buf = head) {
> + head = buf->next;
> + free(buf);
Maybe we could reuse these buffers? Put them in another list when free
and pull from it when allocating. And allocate a new one if the
recycle pool is empty. But maybe glibc already does some work for
that.
That's all my comments in this patchset. Thanks Chris.
> + }
> + head = tail = NULL;
> + batchsize = 0;
> + free(iovs);
> + }
> + } while (!lastline);
> +
> +Exit:
> + free(line);
>
> rtnl_close(&rth);
> return ret;
> @@ -341,7 +438,7 @@ int main(int argc, char **argv)
> goto Exit;
> }
>
> - ret = do_cmd(argc-1, argv+1);
> + ret = do_cmd(argc-1, argv+1, NULL);
> Exit:
> rtnl_close(&rth);
>
> diff --git a/tc/tc_common.h b/tc/tc_common.h
> index 264fbdac..59018da5 100644
> --- a/tc/tc_common.h
> +++ b/tc/tc_common.h
> @@ -1,13 +1,14 @@
> /* SPDX-License-Identifier: GPL-2.0 */
>
> #define TCA_BUF_MAX (64*1024)
> +#define MSG_IOV_MAX 128
>
> extern struct rtnl_handle rth;
>
> extern int do_qdisc(int argc, char **argv);
> extern int do_class(int argc, char **argv);
> -extern int do_filter(int argc, char **argv);
> -extern int do_action(int argc, char **argv);
> +extern int do_filter(int argc, char **argv, void *buf);
> +extern int do_action(int argc, char **argv, void *buf);
> extern int do_tcmonitor(int argc, char **argv);
> extern int do_exec(int argc, char **argv);
>
> diff --git a/tc/tc_filter.c b/tc/tc_filter.c
> index 545cc3a1..7db4964b 100644
> --- a/tc/tc_filter.c
> +++ b/tc/tc_filter.c
> @@ -42,28 +42,38 @@ static void usage(void)
> "OPTIONS := ... try tc filter add <desired FILTER_KIND> help\n");
> }
>
> -static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
> +struct tc_filter_req {
> + struct nlmsghdr n;
> + struct tcmsg t;
> + char buf[MAX_MSG];
> +};
> +
> +static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv,
> + void *buf)
> {
> - struct {
> - struct nlmsghdr n;
> - struct tcmsg t;
> - char buf[MAX_MSG];
> - } req = {
> - .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
> - .n.nlmsg_flags = NLM_F_REQUEST | flags,
> - .n.nlmsg_type = cmd,
> - .t.tcm_family = AF_UNSPEC,
> - };
> + struct tc_filter_req *req, filter_req;
> struct filter_util *q = NULL;
> - __u32 prio = 0;
> - __u32 protocol = 0;
> - int protocol_set = 0;
> - __u32 chain_index;
> + struct tc_estimator est = {};
> + char k[FILTER_NAMESZ] = {};
> int chain_index_set = 0;
> + char d[IFNAMSIZ] = {};
> + int protocol_set = 0;
> char *fhandle = NULL;
> - char d[IFNAMSIZ] = {};
> - char k[FILTER_NAMESZ] = {};
> - struct tc_estimator est = {};
> + __u32 protocol = 0;
> + __u32 chain_index;
> + struct iovec iov;
> + __u32 prio = 0;
> + int ret;
> +
> + if (buf)
> + req = buf;
> + else
> + req = &filter_req;
> +
> + req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg));
> + req->n.nlmsg_flags = NLM_F_REQUEST | flags;
> + req->n.nlmsg_type = cmd;
> + req->t.tcm_family = AF_UNSPEC;
>
> if (cmd == RTM_NEWTFILTER && flags & NLM_F_CREATE)
> protocol = htons(ETH_P_ALL);
> @@ -75,37 +85,37 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
> duparg("dev", *argv);
> strncpy(d, *argv, sizeof(d)-1);
> } else if (strcmp(*argv, "root") == 0) {
> - if (req.t.tcm_parent) {
> + if (req->t.tcm_parent) {
> fprintf(stderr,
> "Error: \"root\" is duplicate parent ID\n");
> return -1;
> }
> - req.t.tcm_parent = TC_H_ROOT;
> + req->t.tcm_parent = TC_H_ROOT;
> } else if (strcmp(*argv, "ingress") == 0) {
> - if (req.t.tcm_parent) {
> + if (req->t.tcm_parent) {
> fprintf(stderr,
> "Error: \"ingress\" is duplicate parent ID\n");
> return -1;
> }
> - req.t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
> + req->t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
> TC_H_MIN_INGRESS);
> } else if (strcmp(*argv, "egress") == 0) {
> - if (req.t.tcm_parent) {
> + if (req->t.tcm_parent) {
> fprintf(stderr,
> "Error: \"egress\" is duplicate parent ID\n");
> return -1;
> }
> - req.t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
> + req->t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
> TC_H_MIN_EGRESS);
> } else if (strcmp(*argv, "parent") == 0) {
> __u32 handle;
>
> NEXT_ARG();
> - if (req.t.tcm_parent)
> + if (req->t.tcm_parent)
> duparg("parent", *argv);
> if (get_tc_classid(&handle, *argv))
> invarg("Invalid parent ID", *argv);
> - req.t.tcm_parent = handle;
> + req->t.tcm_parent = handle;
> } else if (strcmp(*argv, "handle") == 0) {
> NEXT_ARG();
> if (fhandle)
> @@ -152,26 +162,26 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
> argc--; argv++;
> }
>
> - req.t.tcm_info = TC_H_MAKE(prio<<16, protocol);
> + req->t.tcm_info = TC_H_MAKE(prio<<16, protocol);
>
> if (chain_index_set)
> - addattr32(&req.n, sizeof(req), TCA_CHAIN, chain_index);
> + addattr32(&req->n, sizeof(*req), TCA_CHAIN, chain_index);
>
> if (k[0])
> - addattr_l(&req.n, sizeof(req), TCA_KIND, k, strlen(k)+1);
> + addattr_l(&req->n, sizeof(*req), TCA_KIND, k, strlen(k)+1);
>
> if (d[0]) {
> ll_init_map(&rth);
>
> - req.t.tcm_ifindex = ll_name_to_index(d);
> - if (req.t.tcm_ifindex == 0) {
> + req->t.tcm_ifindex = ll_name_to_index(d);
> + if (req->t.tcm_ifindex == 0) {
> fprintf(stderr, "Cannot find device \"%s\"\n", d);
> return 1;
> }
> }
>
> if (q) {
> - if (q->parse_fopt(q, fhandle, argc, argv, &req.n))
> + if (q->parse_fopt(q, fhandle, argc, argv, &req->n))
> return 1;
> } else {
> if (fhandle) {
> @@ -190,10 +200,17 @@ static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
> }
>
> if (est.ewma_log)
> - addattr_l(&req.n, sizeof(req), TCA_RATE, &est, sizeof(est));
> + addattr_l(&req->n, sizeof(*req), TCA_RATE, &est, sizeof(est));
>
> - if (rtnl_talk(&rth, &req.n, NULL) < 0) {
> - fprintf(stderr, "We have an error talking to the kernel\n");
> + iov.iov_base = &req->n;
> + iov.iov_len = req->n.nlmsg_len;
> +
> + if (buf)
> + return 0;
> +
> + ret = rtnl_talk_iov(&rth, &iov, 1, NULL);
> + if (ret < 0) {
> + fprintf(stderr, "We have an error talking to the kernel, %d\n", ret);
> return 2;
> }
>
> @@ -636,20 +653,20 @@ static int tc_filter_list(int argc, char **argv)
> return 0;
> }
>
> -int do_filter(int argc, char **argv)
> +int do_filter(int argc, char **argv, void *buf)
> {
> if (argc < 1)
> return tc_filter_list(0, NULL);
> if (matches(*argv, "add") == 0)
> return tc_filter_modify(RTM_NEWTFILTER, NLM_F_EXCL|NLM_F_CREATE,
> - argc-1, argv+1);
> + argc-1, argv+1, buf);
> if (matches(*argv, "change") == 0)
> - return tc_filter_modify(RTM_NEWTFILTER, 0, argc-1, argv+1);
> + return tc_filter_modify(RTM_NEWTFILTER, 0, argc-1, argv+1, buf);
> if (matches(*argv, "replace") == 0)
> return tc_filter_modify(RTM_NEWTFILTER, NLM_F_CREATE, argc-1,
> - argv+1);
> + argv+1, buf);
> if (matches(*argv, "delete") == 0)
> - return tc_filter_modify(RTM_DELTFILTER, 0, argc-1, argv+1);
> + return tc_filter_modify(RTM_DELTFILTER, 0, argc-1, argv+1, buf);
> if (matches(*argv, "get") == 0)
> return tc_filter_get(RTM_GETTFILTER, 0, argc-1, argv+1);
> if (matches(*argv, "list") == 0 || matches(*argv, "show") == 0
> --
> 2.14.3
>
^ permalink raw reply
* Re: [patch iproute2 v7 1/2] lib/libnetlink: Add functions rtnl_talk_msg and rtnl_talk_iov
From: Phil Sutter @ 2018-01-09 19:24 UTC (permalink / raw)
To: Chris Mi; +Cc: netdev, gerlitz.or, stephen, dsahern, marcelo.leitner
In-Reply-To: <20180109065908.19754-2-chrism@mellanox.com>
Hi,
On Tue, Jan 09, 2018 at 03:59:07PM +0900, Chris Mi wrote:
[...]
> diff --git a/lib/libnetlink.c b/lib/libnetlink.c
> index 00e6ce0c..ae0059f9 100644
> --- a/lib/libnetlink.c
> +++ b/lib/libnetlink.c
> @@ -581,39 +581,43 @@ static void rtnl_talk_error(struct nlmsghdr *h, struct nlmsgerr *err,
> strerror(-err->error));
> }
>
> -static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
> - struct nlmsghdr **answer,
> - bool show_rtnl_err, nl_ext_ack_fn_t errfn)
> +static int __rtnl_talk_msg(struct rtnl_handle *rtnl, struct msghdr *m,
> + struct nlmsghdr **answer,
> + bool show_rtnl_err, nl_ext_ack_fn_t errfn)
> {
> - int status;
> - unsigned int seq;
> - struct nlmsghdr *h;
> struct sockaddr_nl nladdr = { .nl_family = AF_NETLINK };
> - struct iovec iov = {
> - .iov_base = n,
> - .iov_len = n->nlmsg_len
> - };
> + int i, status, iovlen = m->msg_iovlen;
> + struct iovec iov;
> struct msghdr msg = {
> .msg_name = &nladdr,
> .msg_namelen = sizeof(nladdr),
> .msg_iov = &iov,
> .msg_iovlen = 1,
> };
> - char *buf;
> -
> - n->nlmsg_seq = seq = ++rtnl->seq;
> + unsigned int seq = 0;
> + struct nlmsghdr *h;
>
> - if (answer == NULL)
> - n->nlmsg_flags |= NLM_F_ACK;
> + for (i = 0; i < iovlen; i++) {
> + struct iovec *v;
> + v = &m->msg_iov[i];
> + h = v->iov_base;
> + h->nlmsg_seq = seq = ++rtnl->seq;
> + if (answer == NULL)
> + h->nlmsg_flags |= NLM_F_ACK;
> + }
>
> - status = sendmsg(rtnl->fd, &msg, 0);
> + status = sendmsg(rtnl->fd, m, 0);
> if (status < 0) {
> perror("Cannot talk to rtnetlink");
> return -1;
> }
>
> + i = 0;
> while (1) {
for (i = 1; ; i++) ?
> + char *buf;
Why did you move this declaration?
> +next:
Drop this and use 'continue' instead of 'goto next' below?
> status = rtnl_recvmsg(rtnl->fd, &msg, &buf);
> + ++i;
>
> if (status < 0)
> return status;
> @@ -642,7 +646,7 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
>
> if (nladdr.nl_pid != 0 ||
> h->nlmsg_pid != rtnl->local.nl_pid ||
> - h->nlmsg_seq != seq) {
> + h->nlmsg_seq > seq || h->nlmsg_seq < seq - iovlen) {
> /* Don't forget to skip that message. */
> status -= NLMSG_ALIGN(len);
> h = (struct nlmsghdr *)((char *)h + NLMSG_ALIGN(len));
> @@ -662,7 +666,10 @@ static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,
> *answer = (struct nlmsghdr *)buf;
> else
> free(buf);
> - return 0;
> + if (h->nlmsg_seq == seq)
> + return 0;
> + else
> + goto next;
> }
>
> if (rtnl->proto != NETLINK_SOCK_DIAG &&
Cheers, Phil
^ permalink raw reply
* [PATCH] MAINTAINERS: Mark some staging directories as "Obsolete"
From: Joe Perches @ 2018-01-09 19:33 UTC (permalink / raw)
To: Greg KH, Andrew Morton; +Cc: LKML, Petr Vandrovec, Samuel Ortiz, netdev
Several staging directories have TODO files that indicate a
subsystem will be removed in the future.
Using a status entry of "S: Obsolete" helps indicate the
subsystem files should not be modified unnecessarily.
checkpatch also tests this setting and emits a warning that
the matching subsystem files should not be modified.
This might help avoid receiving patches that will be dropped.
Signed-off-by: Joe Perches <joe@perches.com>
---
MAINTAINERS | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 3d53de49e736..9edf41e051e0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7350,7 +7350,7 @@ F: drivers/tty/ipwireless/
IPX NETWORK LAYER
L: netdev@vger.kernel.org
-S: Odd fixes
+S: Obsolete
F: include/uapi/linux/ipx.h
F: drivers/staging/ipx/
@@ -7359,7 +7359,7 @@ M: Samuel Ortiz <samuel@sortiz.org>
L: irda-users@lists.sourceforge.net (subscribers-only)
L: netdev@vger.kernel.org
W: http://irda.sourceforge.net/
-S: Maintained
+S: Obsolete
T: git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/irda-2.6.git
F: Documentation/networking/irda.txt
F: drivers/staging/irda/
@@ -9439,7 +9439,7 @@ F: drivers/net/ethernet/natsemi/natsemi.c
NCP FILESYSTEM
M: Petr Vandrovec <petr@vandrovec.name>
-S: Odd Fixes
+S: Obsolete
F: drivers/staging/ncpfs/
NCR 5380 SCSI DRIVERS
^ permalink raw reply related
* Re: [PATCH 00/18] prevent bounds-check bypass via speculative execution
From: Jiri Kosina @ 2018-01-09 19:34 UTC (permalink / raw)
To: Dan Williams
Cc: linux-kernel, Mark Rutland, peterz, Alan Cox, Srinivas Pandruvada,
Will Deacon, Solomon Peachy, H. Peter Anvin, Christian Lamparter,
Elena Reshetova, linux-arch, Andi Kleen, James E.J. Bottomley,
linux-scsi, Jonathan Corbet, x86, Ingo Molnar, Alexey Kuznetsov,
Zhang Rui, linux-media, Arnd Bergmann, Jan Kara,
Eduardo Valentin <
In-Reply-To: <151520099201.32271.4677179499894422956.stgit@dwillia2-desk3.amr.corp.intel.com>
On Fri, 5 Jan 2018, Dan Williams wrote:
[ ... snip ... ]
> Andi Kleen (1):
> x86, barrier: stop speculation for failed access_ok
>
> Dan Williams (13):
> x86: implement nospec_barrier()
> [media] uvcvideo: prevent bounds-check bypass via speculative execution
> carl9170: prevent bounds-check bypass via speculative execution
> p54: prevent bounds-check bypass via speculative execution
> qla2xxx: prevent bounds-check bypass via speculative execution
> cw1200: prevent bounds-check bypass via speculative execution
> Thermal/int340x: prevent bounds-check bypass via speculative execution
> ipv6: prevent bounds-check bypass via speculative execution
> ipv4: prevent bounds-check bypass via speculative execution
> vfs, fdtable: prevent bounds-check bypass via speculative execution
> net: mpls: prevent bounds-check bypass via speculative execution
> udf: prevent bounds-check bypass via speculative execution
> userns: prevent bounds-check bypass via speculative execution
>
> Mark Rutland (4):
> asm-generic/barrier: add generic nospec helpers
> Documentation: document nospec helpers
> arm64: implement nospec_ptr()
> arm: implement nospec_ptr()
So considering the recent publication of [1], how come we all of a sudden
don't need the barriers in ___bpf_prog_run(), namely for LD_IMM_DW and
LDX_MEM_##SIZEOP, and something comparable for eBPF JIT?
Is this going to be handled in eBPF in some other way?
Without that in place, and considering Jann Horn's paper, it would seem
like PTI doesn't really lock it down fully, right?
[1] https://bugs.chromium.org/p/project-zero/issues/attachmentText?aid=287305
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: Mark some staging directories as "Obsolete"
From: Greg KH @ 2018-01-09 19:38 UTC (permalink / raw)
To: Joe Perches; +Cc: Andrew Morton, LKML, Petr Vandrovec, Samuel Ortiz, netdev
In-Reply-To: <1515526436.9619.112.camel@perches.com>
On Tue, Jan 09, 2018 at 11:33:56AM -0800, Joe Perches wrote:
> Several staging directories have TODO files that indicate a
> subsystem will be removed in the future.
>
> Using a status entry of "S: Obsolete" helps indicate the
> subsystem files should not be modified unnecessarily.
>
> checkpatch also tests this setting and emits a warning that
> the matching subsystem files should not be modified.
>
> This might help avoid receiving patches that will be dropped.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Ah nice, I didn't know about this, I'll go queue this up, thanks.
greg k-h
^ permalink raw reply
* Re: [PATCH net-next v3 06/10] net/mlx5e: Change Mellanox references in DIM code
From: Andy Gospodarek @ 2018-01-09 19:38 UTC (permalink / raw)
To: Tal Gilboa; +Cc: Saeed Mahameed, netdev, mchan, Talat Batheesh
In-Reply-To: <20e3eec7-8b4c-7c76-86a1-6cff0b6edadb@mellanox.com>
On Tue, Jan 09, 2018 at 08:22:15PM +0200, Tal Gilboa wrote:
> On 1/9/2018 6:06 PM, Andy Gospodarek wrote:
> > On Mon, Jan 08, 2018 at 11:06:28PM -0800, Saeed Mahameed wrote:
> > >
> > >
> > > On 01/08/2018 10:13 PM, Andy Gospodarek wrote:
> > > > From: Andy Gospodarek <gospo@broadcom.com>
> > > >
> > > > Change all appropriate mlx5_am* and MLX5_AM* references to net_dim and
> > > > NET_DIM, respectively, in code that handles dynamic interrupt
> > > > moderation. Also change all references from 'am' to 'dim' when used as
> > > > local variables and add generic profile references.
> > > >
> > > > Signed-off-by: Andy Gospodarek <gospo@broadcom.com>
> > > > Acked-by: Tal Gilboa <talgi@mellanox.com>
> > > > Acked-by: Saeed Mahameed <saeedm@mellanox.com>
> > > > ---
> > > > drivers/net/ethernet/mellanox/mlx5/core/en.h | 9 +-
> > > > drivers/net/ethernet/mellanox/mlx5/core/en_dim.c | 14 +-
> > > > .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 6 +-
> > > > drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 40 ++-
> > > > drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 8 +-
> > > > drivers/net/ethernet/mellanox/mlx5/core/net_dim.c | 286 ++++++++++-----------
> > > > drivers/net/ethernet/mellanox/mlx5/core/net_dim.h | 63 ++---
> > > > 7 files changed, 225 insertions(+), 201 deletions(-)
> > > >
> > >
> > > [...]
> > >
> > > > #define IS_SIGNIFICANT_DIFF(val, ref) \
> > > > (((100 * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */
> > > > -static int mlx5e_am_stats_compare(struct mlx5e_rx_am_stats *curr,
> > > > - struct mlx5e_rx_am_stats *prev)
> > > > +static int net_dim_stats_compare(struct net_dim_stats *curr,
> > > > + struct net_dim_stats *prev)
> > > > {
> > > > if (!prev->bpms)
> > > > - return curr->bpms ? MLX5E_AM_STATS_BETTER :
> > > > - MLX5E_AM_STATS_SAME;
> > > > + return curr->bpms ? NET_DIM_STATS_BETTER :
> > > > + NET_DIM_STATS_SAME;
> > > > if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms))
> > > > - return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER :
> > > > - MLX5E_AM_STATS_WORSE;
> > > > + return (curr->bpms > prev->bpms) ? NET_DIM_STATS_BETTER :
> > > > + NET_DIM_STATS_WORSE;
> > >
> > > Hey Andy,
> > >
> > > I am currently reviewing a patch internally that fixes a bug in this area,
> > > prev->ppms can be 0 and could cause IS_SIGNIFICANT_DIFF ouch !
> > > same goes for prev->eppm, for some reason we had a broken assumption that if
> > > ppms is 0 for some reason then the bpms is 0 and the above condition will
> > > cover us.
> > >
> > > Anyway the patch will go to net, which means when this series gets accepted
> > > then net-next will fail to merge with net and we need to manually push the
> > > fix to the new DIM library.
> > >
> > > But for now I don't think anything is required for this series other than
> > > bringing this division by 0 issue and the future merge conflict to your
> > > attention.
> > >
> >
> > Thanks for bringing that to everyone's attention. I agree there is
> > probably not much that should be done at this point -- hopefully the
> > merge should go pretty smoothly, since net_dim.h is seen as a rename
> > from en_rx_am.c.
>
> I talked with Talat, who is submitting the fix. He will apply it over these
> patches after they are accepted.
>
Awesome! Thanks for doing that. v4 coming in a few mins -- hopefully the
last. :-)
> >
> >
> > > > if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms))
> > > > - return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER :
> > > > - MLX5E_AM_STATS_WORSE;
> > > > + return (curr->ppms > prev->ppms) ? NET_DIM_STATS_BETTER :
> > > > + NET_DIM_STATS_WORSE;
> > > > if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms))
> > > > - return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER :
> > > > - MLX5E_AM_STATS_WORSE;
> > > > + return (curr->epms < prev->epms) ? NET_DIM_STATS_BETTER :
> > > > + NET_DIM_STATS_WORSE;
> > > > - return MLX5E_AM_STATS_SAME;
> > > > + return NET_DIM_STATS_SAME;
> > > > }
^ permalink raw reply
* Re: [PATCH 00/18] prevent bounds-check bypass via speculative execution
From: Dan Williams @ 2018-01-09 19:44 UTC (permalink / raw)
To: Jiri Kosina
Cc: Linux Kernel Mailing List, Mark Rutland, Peter Zijlstra, Alan Cox,
Srinivas Pandruvada, Will Deacon, Solomon Peachy, H. Peter Anvin,
Christian Lamparter, Elena Reshetova, linux-arch, Andi Kleen,
James E.J. Bottomley, linux-scsi, Jonathan Corbet, X86 ML,
Ingo Molnar, Alexey Kuznetsov, Zhang Rui,
"Linux-media@vger.ker
In-Reply-To: <alpine.LRH.2.00.1801092017330.27010@gjva.wvxbf.pm>
On Tue, Jan 9, 2018 at 11:34 AM, Jiri Kosina <jikos@kernel.org> wrote:
> On Fri, 5 Jan 2018, Dan Williams wrote:
>
> [ ... snip ... ]
>> Andi Kleen (1):
>> x86, barrier: stop speculation for failed access_ok
>>
>> Dan Williams (13):
>> x86: implement nospec_barrier()
>> [media] uvcvideo: prevent bounds-check bypass via speculative execution
>> carl9170: prevent bounds-check bypass via speculative execution
>> p54: prevent bounds-check bypass via speculative execution
>> qla2xxx: prevent bounds-check bypass via speculative execution
>> cw1200: prevent bounds-check bypass via speculative execution
>> Thermal/int340x: prevent bounds-check bypass via speculative execution
>> ipv6: prevent bounds-check bypass via speculative execution
>> ipv4: prevent bounds-check bypass via speculative execution
>> vfs, fdtable: prevent bounds-check bypass via speculative execution
>> net: mpls: prevent bounds-check bypass via speculative execution
>> udf: prevent bounds-check bypass via speculative execution
>> userns: prevent bounds-check bypass via speculative execution
>>
>> Mark Rutland (4):
>> asm-generic/barrier: add generic nospec helpers
>> Documentation: document nospec helpers
>> arm64: implement nospec_ptr()
>> arm: implement nospec_ptr()
>
> So considering the recent publication of [1], how come we all of a sudden
> don't need the barriers in ___bpf_prog_run(), namely for LD_IMM_DW and
> LDX_MEM_##SIZEOP, and something comparable for eBPF JIT?
>
> Is this going to be handled in eBPF in some other way?
>
> Without that in place, and considering Jann Horn's paper, it would seem
> like PTI doesn't really lock it down fully, right?
Here is the latest (v3) bpf fix:
https://patchwork.ozlabs.org/patch/856645/
I currently have v2 on my 'nospec' branch and will move that to v3 for
the next update, unless it goes upstream before then.
^ permalink raw reply
* [net-next PATCH 1/1] tipc: add back tipc prefix to log messages
From: John Thompson @ 2018-01-09 19:50 UTC (permalink / raw)
To: davem, netdev; +Cc: tipc-discussion
The tipc prefix to log messages generated by tipc was
removed in commit 07f6c4bc0 ("tipc: convert tipc reference
table to use generic rhashtable").
This is still a useful prefix and so add it back.
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: John Thompson <thompa.atl@gmail.com>
---
net/tipc/core.c | 2 --
net/tipc/core.h | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 0b982d048fb9..4cd9e57446ec 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -34,8 +34,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
#include "core.h"
#include "name_table.h"
#include "subscr.h"
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 964342689f2c..f89f9a3c18c2 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -37,6 +37,8 @@
#ifndef _TIPC_CORE_H
#define _TIPC_CORE_H
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/tipc.h>
#include <linux/tipc_config.h>
#include <linux/tipc_netlink.h>
--
2.15.0
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply related
* Re: [PATCH net-next] ibmvnic: Don't handle RX interrupts when not up.
From: Thomas Falcon @ 2018-01-09 20:33 UTC (permalink / raw)
To: Nathan Fontenot, netdev; +Cc: jallen
In-Reply-To: <151542776271.7885.5034544146387685418.stgit@ltcalpine2-lp14.aus.stglabs.ibm.com>
On 01/08/2018 10:09 AM, Nathan Fontenot wrote:
> Initiating a kdump via the command line can cause a pending interrupt
> to be handled by the ibmvnic driver when initializing the sub-CRQ
> irqs during driver initialization.
>
> NIP [d000000000ca34f0] ibmvnic_interrupt_rx+0x40/0xd0 [ibmvnic]
> LR [c000000008132ef0] __handle_irq_event_percpu+0xa0/0x2f0
> Call Trace:
> [c000000047fcfde0] [c000000008132ef0] __handle_irq_event_percpu+0xa0/0x2f0
> [c000000047fcfea0] [c00000000813317c] handle_irq_event_percpu+0x3c/0x90
> [c000000047fcfee0] [c00000000813323c] handle_irq_event+0x6c/0xd0
> [c000000047fcff10] [c0000000081385e0] handle_fasteoi_irq+0xf0/0x250
> [c000000047fcff40] [c0000000081320a0] generic_handle_irq+0x50/0x80
> [c000000047fcff60] [c000000008014984] __do_irq+0x84/0x1d0
> [c000000047fcff90] [c000000008027564] call_do_irq+0x14/0x24
> [c00000003c92af00] [c000000008014b70] do_IRQ+0xa0/0x120
> [c00000003c92af50] [c000000008002594] hardware_interrupt_common+0x114/0x180
> --- interrupt: 501 at arch_local_irq_restore+0x74/0x90
> LR = arch_local_irq_restore+0x74/0x90
> [c00000003c92b240] [c000000008138a20] irq_startup+0xa0/0xe0 (unreliable)
> [c00000003c92b260] [c0000000087fc440] _raw_spin_unlock_irqrestore+0x40/0x70
> [c00000003c92b280] [c0000000081361f4] __setup_irq+0x584/0x7a0
> [c00000003c92b420] [c0000000081366a0] request_threaded_irq+0x140/0x290
> [c00000003c92b480] [d000000000ca3754] init_sub_crq_irqs+0x1d4/0x370 [ibmvnic]
> [c00000003c92b520] [d000000000ca6b50] ibmvnic_init+0x140/0x760 [ibmvnic]
> [c00000003c92b5c0] [d000000000ca7308] ibmvnic_probe+0x198/0x330 [ibmvnic]
> [c00000003c92b650] [c000000008037270] vio_bus_probe+0x1c0/0x480
> [c00000003c92b6f0] [c00000000859a140] driver_probe_device+0x1f0/0x540
> [c00000003c92b780] [c00000000859a59c] __driver_attach+0x10c/0x110
> [c00000003c92b7c0] [c000000008596dac] bus_for_each_dev+0x8c/0xf0
> [c00000003c92b810] [c000000008599798] driver_attach+0x38/0x50
> [c00000003c92b830] [c000000008598f68] bus_add_driver+0x2b8/0x380
> [c00000003c92b8c0] [c00000000859b660] driver_register+0xa0/0x180
> [c00000003c92b930] [c000000008035c5c] __vio_register_driver+0x7c/0xc0
> [c00000003c92b9b0] [d000000000caaf3c] ibmvnic_module_init+0x5c/0x70 [ibmvnic]
> [c00000003c92ba10] [c00000000800b6cc] do_one_initcall+0x12c/0x280
> [c00000003c92bae0] [c000000008805614] do_init_module+0x98/0x24c
> [c00000003c92bb70] [c000000008181a80] load_module+0x1470/0x16c0
> [c00000003c92bd40] [c000000008181fb0] SyS_finit_module+0xd0/0x120
> [c00000003c92be30] [c000000008009204] system_call+0x38/0xb4
>
> At this poibnt the driver is not prepared to handle traffic and
> should not try to handle the interrupt. This patch adds a check to
> ensure the driver is up when handling RX interrupots.
>
> Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
> ---
Minor comments:
There is a typo in the commit message.
> drivers/net/ethernet/ibm/ibmvnic.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 6911b7cc06c5..46990b84cb2d 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -2453,6 +2453,9 @@ static irqreturn_t ibmvnic_interrupt_rx(int irq, void *instance)
> struct ibmvnic_sub_crq_queue *scrq = instance;
> struct ibmvnic_adapter *adapter = scrq->adapter;
>
> + if (adapter->state != VNIC_OPEN)
> + return IRQ_NONE;
> +
Could you include a comment that this is a kdump specific check, since in any other case interrupts should be disabled if the device is closed? Maybe you could use unlikely() here too.
Thanks,
Tom
> adapter->rx_stats_buffers[scrq->scrq_num].interrupts++;
>
> if (napi_schedule_prep(&adapter->napi[scrq->scrq_num])) {
>
^ permalink raw reply
* Re: net: memory leak in socket
From: Al Viro @ 2018-01-09 20:53 UTC (permalink / raw)
To: David Miller
Cc: netdev, LKML, Alexey Kuznetsov, Hideaki YOSHIFUJI, Eric Dumazet,
Willem de Bruijn, syzkaller, Dmitry Vyukov
In-Reply-To: <CACT4Y+Yi=CNxCo0Fg5kuTOpDjjAx1WxMzW74GDP975bJuUhdiA@mail.gmail.com>
On Tue, Jan 09, 2018 at 07:58:08PM +0100, Dmitry Vyukov wrote:
> > Argh... Got broken by "make sock_alloc_file() do sock_release() on failures" -
> > cleanup after sock_map_fd() failure got pulled all the way into sock_alloc_file(),
> > but it used to serve the case when sock_map_fd() failed *before* getting to
> > sock_alloc_file().
> >
> > Fixes: commit 8e1611e23579 (make sock_alloc_file() do sock_release() on failures)
> > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
>
> Please add:
>
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
Sure, no problem. Dave, which tree should that go through? Do you pick it, or
should I send the below directly to Linus?
----
Fix a leak in socket(2) when we fail to allocate a file descriptor.
Got broken by "make sock_alloc_file() do sock_release() on failures" -
cleanup after sock_map_fd() failure got pulled all the way into
sock_alloc_file(), but it used to serve the case when sock_map_fd()
failed *before* getting to sock_alloc_file() as well, and that got
lost. Trivial to fix, fortunately.
Fixes: commit 8e1611e23579 (make sock_alloc_file() do sock_release() on failures)
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/net/socket.c b/net/socket.c
index bbd2e9ceb692..1536515b6437 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -430,8 +430,10 @@ static int sock_map_fd(struct socket *sock, int flags)
{
struct file *newfile;
int fd = get_unused_fd_flags(flags);
- if (unlikely(fd < 0))
+ if (unlikely(fd < 0)) {
+ sock_release(sock);
return fd;
+ }
newfile = sock_alloc_file(sock, flags, NULL);
if (likely(!IS_ERR(newfile))) {
^ permalink raw reply related
* [PATCH v4 00/36] Hardened usercopy whitelisting
From: Kees Cook @ 2018-01-09 20:55 UTC (permalink / raw)
To: linux-kernel
Cc: Kees Cook, Linus Torvalds, David Windsor, Alexander Viro,
Andrew Morton, Andy Lutomirski, Christoph Hellwig,
Christoph Lameter, David S. Miller, Laura Abbott, Mark Rutland,
Martin K. Petersen, Paolo Bonzini, Christian Borntraeger,
Christoffer Dall, Dave Kleikamp, Jan Kara, Luis de Bethencourt,
Marc Zyngier, Rik van Riel, Matthew Garrett, linux-fsdevel,
linux-arch
v4:
- refactor reporting to include offset and remove %p
- explicitly WARN by default for the whitelisting
- add KVM whitelists and harden ioctl handling
v3:
- added LKDTM update patch
- downgrade BUGs to WARNs and fail closed
- add Acks/Reviews from v2
v2:
- added tracing of allocation and usage
- refactored solutions for task_struct
- split up network patches for readability
I intend for this to land via my usercopy hardening tree, so Acks,
Reviewed, and Tested-bys would be greatly appreciated. FWIW, the bulk of
this series has survived for months in 0-day testing and -next, with the
more recently-added offset-reporting having existed there for a week.
Linus, getting your attention early on this -- instead of during the
merge window :) -- would be greatly appreciated. I'm hoping this is a
good time, in a slight lull in PTI and related things needing attention.
----
This series is modified from Brad Spengler/PaX Team's PAX_USERCOPY code
in the last public patch of grsecurity/PaX based on our understanding
of the code. Changes or omissions from the original code are ours and
don't reflect the original grsecurity/PaX code.
David Windsor did the bulk of the porting, refactoring, splitting,
testing, etc; I did some extra tweaks, hunk moving, traces, and extra
patches.
Description from patch 1:
Currently, hardened usercopy performs dynamic bounds checking on slab
cache objects. This is good, but still leaves a lot of kernel memory
available to be copied to/from userspace in the face of bugs. To further
restrict what memory is available for copying, this creates a way to
whitelist specific areas of a given slab cache object for copying to/from
userspace, allowing much finer granularity of access control. Slab caches
that are never exposed to userspace can declare no whitelist for their
objects, thereby keeping them unavailable to userspace via dynamic copy
operations. (Note, an implicit form of whitelisting is the use of constant
sizes in usercopy operations and get_user()/put_user(); these bypass
hardened usercopy checks since these sizes cannot change at runtime.)
To support this whitelist annotation, usercopy region offset and size
members are added to struct kmem_cache. The slab allocator receives a
new function, kmem_cache_create_usercopy(), that creates a new cache
with a usercopy region defined, suitable for declaring spans of fields
within the objects that get copied to/from userspace.
In this patch, the default kmem_cache_create() marks the entire allocation
as whitelisted, leaving it semantically unchanged. Once all fine-grained
whitelists have been added (in subsequent patches), this will be changed
to a usersize of 0, making caches created with kmem_cache_create() not
copyable to/from userspace.
After the entire usercopy whitelist series is applied, less than 15%
of the slab cache memory remains exposed to potential usercopy bugs
after a fresh boot:
Total Slab Memory: 48074720
Usercopyable Memory: 6367532 13.2%
task_struct 0.2% 4480/1630720
RAW 0.3% 300/96000
RAWv6 2.1% 1408/64768
ext4_inode_cache 3.0% 269760/8740224
dentry 11.1% 585984/5273856
mm_struct 29.1% 54912/188448
kmalloc-8 100.0% 24576/24576
kmalloc-16 100.0% 28672/28672
kmalloc-32 100.0% 81920/81920
kmalloc-192 100.0% 96768/96768
kmalloc-128 100.0% 143360/143360
names_cache 100.0% 163840/163840
kmalloc-64 100.0% 167936/167936
kmalloc-256 100.0% 339968/339968
kmalloc-512 100.0% 350720/350720
kmalloc-96 100.0% 455616/455616
kmalloc-8192 100.0% 655360/655360
kmalloc-1024 100.0% 812032/812032
kmalloc-4096 100.0% 819200/819200
kmalloc-2048 100.0% 1310720/1310720
After some kernel build workloads, the percentage (mainly driven by
dentry and inode caches expanding) drops under 10%:
Total Slab Memory: 95516184
Usercopyable Memory: 8497452 8.8%
task_struct 0.2% 4000/1456000
RAW 0.3% 300/96000
RAWv6 2.1% 1408/64768
ext4_inode_cache 3.0% 1217280/39439872
dentry 11.1% 1623200/14608800
mm_struct 29.1% 73216/251264
kmalloc-8 100.0% 24576/24576
kmalloc-16 100.0% 28672/28672
kmalloc-32 100.0% 94208/94208
kmalloc-192 100.0% 96768/96768
kmalloc-128 100.0% 143360/143360
names_cache 100.0% 163840/163840
kmalloc-64 100.0% 245760/245760
kmalloc-256 100.0% 339968/339968
kmalloc-512 100.0% 350720/350720
kmalloc-96 100.0% 563520/563520
kmalloc-8192 100.0% 655360/655360
kmalloc-1024 100.0% 794624/794624
kmalloc-4096 100.0% 819200/819200
kmalloc-2048 100.0% 1257472/1257472
------
The patches are broken in several stages of changes:
Report offsets and drop %p usage:
[PATCH 01/36] usercopy: Remove pointer from overflow report
[PATCH 02/36] usercopy: Include offset in overflow report
[PATCH 03/36] lkdtm/usercopy: Adjust test to include an offset to
Prepare and whitelist kmalloc:
[PATCH 04/36] usercopy: Prepare for usercopy whitelisting
[PATCH 05/36] usercopy: WARN() on slab cache usercopy region
[PATCH 06/36] usercopy: Mark kmalloc caches as usercopy caches
Update VFS layer for symlinks and other inline storage:
[PATCH 07/36] dcache: Define usercopy region in dentry_cache slab
[PATCH 08/36] vfs: Define usercopy region in names_cache slab caches
[PATCH 09/36] vfs: Copy struct mount.mnt_id to userspace using
[PATCH 10/36] ext4: Define usercopy region in ext4_inode_cache slab
[PATCH 11/36] ext2: Define usercopy region in ext2_inode_cache slab
[PATCH 12/36] jfs: Define usercopy region in jfs_ip slab cache
[PATCH 13/36] befs: Define usercopy region in befs_inode_cache slab
[PATCH 14/36] exofs: Define usercopy region in exofs_inode_cache slab
[PATCH 15/36] orangefs: Define usercopy region in
[PATCH 16/36] ufs: Define usercopy region in ufs_inode_cache slab
[PATCH 17/36] vxfs: Define usercopy region in vxfs_inode slab cache
[PATCH 18/36] cifs: Define usercopy region in cifs_request slab cache
Update scsi layer for inline storage:
[PATCH 19/36] scsi: Define usercopy region in scsi_sense_cache slab
Whitelist a few network protocol-specific areas of memory:
[PATCH 20/36] net: Define usercopy region in struct proto slab cache
[PATCH 21/36] ip: Define usercopy region in IP proto slab cache
[PATCH 22/36] caif: Define usercopy region in caif proto slab cache
[PATCH 23/36] sctp: Define usercopy region in SCTP proto slab cache
[PATCH 24/36] sctp: Copy struct sctp_sock.autoclose to userspace
[PATCH 25/36] net: Restrict unwhitelisted proto caches to size 0
Whitelist areas of process memory:
[PATCH 26/36] fork: Define usercopy region in mm_struct slab caches
[PATCH 27/36] fork: Define usercopy region in thread_stack slab
Deal with per-architecture thread_struct whitelisting:
[PATCH 28/36] fork: Provide usercopy whitelisting for task_struct
[PATCH 29/36] x86: Implement thread_struct whitelist for hardened
[PATCH 30/36] arm64: Implement thread_struct whitelist for hardened
[PATCH 31/36] arm: Implement thread_struct whitelist for hardened
Update KVM for whitelisting:
[PATCH 32/36] kvm: whitelist struct kvm_vcpu_arch
[PATCH 33/36] kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl
Make blacklisting the default, with optional fail-closed:
[PATCH 34/36] usercopy: Allow strict enforcement of whitelists
[PATCH 35/36] usercopy: Restrict non-usercopy caches to size 0
Update LKDTM:
[PATCH 36/36] lkdtm: Update usercopy tests for whitelisting
Thanks!
-Kees (and David)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox