Commit 90602c25 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull networking fixes from Paolo Abeni:
 "Including fixes from WiFi, bluetooth and netfilter.

  No known new regressions outstanding.

  Current release - regressions:

   - wifi: mt76: do not increase mcu skb refcount if retry is not
     supported

  Current release - new code bugs:

   - wifi:
      - rtw88: fix the RX aggregation in USB 3 mode
      - mac80211: fix memory corruption bug in struct ieee80211_chanctx

  Previous releases - regressions:

   - sched:
      - stop qdisc_tree_reduce_backlog on TC_H_ROOT
      - sch_api: fix xa_insert() error path in tcf_block_get_ext()

   - wifi:
      - revert "wifi: iwlwifi: remove retry loops in start"
      - cfg80211: clear wdev->cqm_config pointer on free

   - netfilter: fix potential crash in nf_send_reset6()

   - ip_tunnel: fix suspicious RCU usage warning in ip_tunnel_find()

   - bluetooth: fix null-ptr-deref in hci_read_supported_codecs

   - eth: mlxsw: add missing verification before pushing Tx header

   - eth: hns3: fixed hclge_fetch_pf_reg accesses bar space out of
     bounds issue

  Previous releases - always broken:

   - wifi: mac80211: do not pass a stopped vif to the driver in
     .get_txpower

   - netfilter: sanitize offset and length before calling skb_checksum()

   - core:
      - fix crash when config small gso_max_size/gso_ipv4_max_size
      - skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension

   - mptcp: protect sched with rcu_read_lock

   - eth: ice: fix crash on probe for DPLL enabled E810 LOM

   - eth: macsec: fix use-after-free while sending the offloading packet

   - eth: stmmac: fix unbalanced DMA map/unmap for non-paged SKB data

   - eth: hns3: fix kernel crash when 1588 is sent on HIP08 devices

   - eth: mtk_wed: fix path of MT7988 WO firmware"

* tag 'net-6.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (70 commits)
  net: hns3: fix kernel crash when 1588 is sent on HIP08 devices
  net: hns3: fixed hclge_fetch_pf_reg accesses bar space out of bounds issue
  net: hns3: initialize reset_timer before hclgevf_misc_irq_init()
  net: hns3: don't auto enable misc vector
  net: hns3: Resolved the issue that the debugfs query result is inconsistent.
  net: hns3: fix missing features due to dev->features configuration too early
  net: hns3: fixed reset failure issues caused by the incorrect reset type
  net: hns3: add sync command to sync io-pgtable
  net: hns3: default enable tx bounce buffer when smmu enabled
  netfilter: nft_payload: sanitize offset and length before calling skb_checksum()
  net: ethernet: mtk_wed: fix path of MT7988 WO firmware
  selftests: forwarding: Add IPv6 GRE remote change tests
  mlxsw: spectrum_ipip: Fix memory leak when changing remote IPv6 address
  mlxsw: pci: Sync Rx buffers for device
  mlxsw: pci: Sync Rx buffers for CPU
  mlxsw: spectrum_ptp: Add missing verification before pushing Tx header
  net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension
  Bluetooth: hci: fix null-ptr-deref in hci_read_supported_codecs
  netfilter: nf_reject_ipv6: fix potential crash in nf_send_reset6()
  netfilter: Fix use-after-free in get_info()
  ...
parents 15cb732c 50ae879d
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ ii) transmit network traffic, or any other that needs raw

Howto can be found at:

    https://sites.google.com/site/packetmmap/
    https://web.archive.org/web/20220404160947/https://sites.google.com/site/packetmmap/

Please send your comments to
    - Ulisses Alonso Camaró <uaca@i.hate.spam.alumni.uv.es>
@@ -166,7 +166,8 @@ As capture, each frame contains two parts::
    /* bind socket to eth0 */
    bind(this->socket, (struct sockaddr *)&my_addr, sizeof(struct sockaddr_ll));

 A complete tutorial is available at: https://sites.google.com/site/packetmmap/
 A complete tutorial is available at:
 https://web.archive.org/web/20220404160947/https://sites.google.com/site/packetmmap/

By default, the user should put data at::

+3 −1
Original line number Diff line number Diff line
@@ -1293,8 +1293,10 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,

		/* save the buffer addr until the last read operation */
		*save_buf = read_buf;
	}

	/* get data ready for the first time to read */
	if (!*ppos) {
		ret = hns3_dbg_read_cmd(dbg_data, hns3_dbg_cmd[index].cmd,
					read_buf, hns3_dbg_cmd[index].buf_len);
		if (ret)
+58 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/irq.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/skbuff.h>
@@ -380,6 +381,24 @@ static const struct hns3_rx_ptype hns3_rx_ptype_tbl[] = {
#define HNS3_INVALID_PTYPE \
		ARRAY_SIZE(hns3_rx_ptype_tbl)

static void hns3_dma_map_sync(struct device *dev, unsigned long iova)
{
	struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
	struct iommu_iotlb_gather iotlb_gather;
	size_t granule;

	if (!domain || !iommu_is_dma_domain(domain))
		return;

	granule = 1 << __ffs(domain->pgsize_bitmap);
	iova = ALIGN_DOWN(iova, granule);
	iotlb_gather.start = iova;
	iotlb_gather.end = iova + granule - 1;
	iotlb_gather.pgsize = granule;

	iommu_iotlb_sync(domain, &iotlb_gather);
}

static irqreturn_t hns3_irq_handle(int irq, void *vector)
{
	struct hns3_enet_tqp_vector *tqp_vector = vector;
@@ -1032,6 +1051,8 @@ static bool hns3_can_use_tx_sgl(struct hns3_enet_ring *ring,
static void hns3_init_tx_spare_buffer(struct hns3_enet_ring *ring)
{
	u32 alloc_size = ring->tqp->handle->kinfo.tx_spare_buf_size;
	struct net_device *netdev = ring_to_netdev(ring);
	struct hns3_nic_priv *priv = netdev_priv(netdev);
	struct hns3_tx_spare *tx_spare;
	struct page *page;
	dma_addr_t dma;
@@ -1073,6 +1094,7 @@ static void hns3_init_tx_spare_buffer(struct hns3_enet_ring *ring)
	tx_spare->buf = page_address(page);
	tx_spare->len = PAGE_SIZE << order;
	ring->tx_spare = tx_spare;
	ring->tx_copybreak = priv->tx_copybreak;
	return;

dma_mapping_error:
@@ -1724,7 +1746,9 @@ static int hns3_map_and_fill_desc(struct hns3_enet_ring *ring, void *priv,
				  unsigned int type)
{
	struct hns3_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use];
	struct hnae3_handle *handle = ring->tqp->handle;
	struct device *dev = ring_to_dev(ring);
	struct hnae3_ae_dev *ae_dev;
	unsigned int size;
	dma_addr_t dma;

@@ -1756,6 +1780,13 @@ static int hns3_map_and_fill_desc(struct hns3_enet_ring *ring, void *priv,
		return -ENOMEM;
	}

	/* Add a SYNC command to sync io-pgtale to avoid errors in pgtable
	 * prefetch
	 */
	ae_dev = hns3_get_ae_dev(handle);
	if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3)
		hns3_dma_map_sync(dev, dma);

	desc_cb->priv = priv;
	desc_cb->length = size;
	desc_cb->dma = dma;
@@ -2452,7 +2483,6 @@ static int hns3_nic_set_features(struct net_device *netdev,
			return ret;
	}

	netdev->features = features;
	return 0;
}

@@ -4868,6 +4898,30 @@ static void hns3_nic_dealloc_vector_data(struct hns3_nic_priv *priv)
	devm_kfree(&pdev->dev, priv->tqp_vector);
}

static void hns3_update_tx_spare_buf_config(struct hns3_nic_priv *priv)
{
#define HNS3_MIN_SPARE_BUF_SIZE (2 * 1024 * 1024)
#define HNS3_MAX_PACKET_SIZE (64 * 1024)

	struct iommu_domain *domain = iommu_get_domain_for_dev(priv->dev);
	struct hnae3_ae_dev *ae_dev = hns3_get_ae_dev(priv->ae_handle);
	struct hnae3_handle *handle = priv->ae_handle;

	if (ae_dev->dev_version < HNAE3_DEVICE_VERSION_V3)
		return;

	if (!(domain && iommu_is_dma_domain(domain)))
		return;

	priv->min_tx_copybreak = HNS3_MAX_PACKET_SIZE;
	priv->min_tx_spare_buf_size = HNS3_MIN_SPARE_BUF_SIZE;

	if (priv->tx_copybreak < priv->min_tx_copybreak)
		priv->tx_copybreak = priv->min_tx_copybreak;
	if (handle->kinfo.tx_spare_buf_size < priv->min_tx_spare_buf_size)
		handle->kinfo.tx_spare_buf_size = priv->min_tx_spare_buf_size;
}

static void hns3_ring_get_cfg(struct hnae3_queue *q, struct hns3_nic_priv *priv,
			      unsigned int ring_type)
{
@@ -5101,6 +5155,7 @@ int hns3_init_all_ring(struct hns3_nic_priv *priv)
	int i, j;
	int ret;

	hns3_update_tx_spare_buf_config(priv);
	for (i = 0; i < ring_num; i++) {
		ret = hns3_alloc_ring_memory(&priv->ring[i]);
		if (ret) {
@@ -5305,6 +5360,8 @@ static int hns3_client_init(struct hnae3_handle *handle)
	priv->ae_handle = handle;
	priv->tx_timeout_count = 0;
	priv->max_non_tso_bd_num = ae_dev->dev_specs.max_non_tso_bd_num;
	priv->min_tx_copybreak = 0;
	priv->min_tx_spare_buf_size = 0;
	set_bit(HNS3_NIC_STATE_DOWN, &priv->state);

	handle->msg_enable = netif_msg_init(debug, DEFAULT_MSG_LEVEL);
+2 −0
Original line number Diff line number Diff line
@@ -596,6 +596,8 @@ struct hns3_nic_priv {
	struct hns3_enet_coalesce rx_coal;
	u32 tx_copybreak;
	u32 rx_copybreak;
	u32 min_tx_copybreak;
	u32 min_tx_spare_buf_size;
};

union l3_hdr_info {
+33 −0
Original line number Diff line number Diff line
@@ -1933,6 +1933,31 @@ static int hns3_set_tx_spare_buf_size(struct net_device *netdev,
	return ret;
}

static int hns3_check_tx_copybreak(struct net_device *netdev, u32 copybreak)
{
	struct hns3_nic_priv *priv = netdev_priv(netdev);

	if (copybreak < priv->min_tx_copybreak) {
		netdev_err(netdev, "tx copybreak %u should be no less than %u!\n",
			   copybreak, priv->min_tx_copybreak);
		return -EINVAL;
	}
	return 0;
}

static int hns3_check_tx_spare_buf_size(struct net_device *netdev, u32 buf_size)
{
	struct hns3_nic_priv *priv = netdev_priv(netdev);

	if (buf_size < priv->min_tx_spare_buf_size) {
		netdev_err(netdev,
			   "tx spare buf size %u should be no less than %u!\n",
			   buf_size, priv->min_tx_spare_buf_size);
		return -EINVAL;
	}
	return 0;
}

static int hns3_set_tunable(struct net_device *netdev,
			    const struct ethtool_tunable *tuna,
			    const void *data)
@@ -1949,6 +1974,10 @@ static int hns3_set_tunable(struct net_device *netdev,

	switch (tuna->id) {
	case ETHTOOL_TX_COPYBREAK:
		ret = hns3_check_tx_copybreak(netdev, *(u32 *)data);
		if (ret)
			return ret;

		priv->tx_copybreak = *(u32 *)data;

		for (i = 0; i < h->kinfo.num_tqps; i++)
@@ -1963,6 +1992,10 @@ static int hns3_set_tunable(struct net_device *netdev,

		break;
	case ETHTOOL_TX_COPYBREAK_BUF_SIZE:
		ret = hns3_check_tx_spare_buf_size(netdev, *(u32 *)data);
		if (ret)
			return ret;

		old_tx_spare_buf_size = h->kinfo.tx_spare_buf_size;
		new_tx_spare_buf_size = *(u32 *)data;
		netdev_info(netdev, "request to set tx spare buf size from %u to %u\n",
Loading