342604a4bb
* [Mellanox] Don't populate arm64 Kconfig when integrating hw-mgmt
Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
* Intgerate HW-MGMT 7.0030.2008 Changes
## Patch List
* 0285-UBUNTU-SAUCE-mlxbf-gige-Fix-intermittent-no-ip-issue.patch :
* 0286-pinctrl-Introduce-struct-pinfunction-and-PINCTRL_PIN.patch :
* 0287-pinctrl-mlxbf3-Add-pinctrl-driver-support.patch :
* 0288-UBUNTU-SAUCE-gpio-mmio-handle-ngpios-properly-in-bgp.patch :
* 0289-UBUNTU-SAUCE-gpio-mlxbf3-Add-gpio-driver-support.patch :
* 0291-mlxsw-core_hwmon-Align-modules-label-name-assignment.patch :
* 0292-mlxsw-i2c-Limit-single-transaction-buffer-size.patch :
* 0293-mlxsw-reg-Limit-MTBR-register-records-buffer-by-one-.patch :
* 0296-UBUNTU-SAUCE-mmc-sdhci-of-dwcmshc-Add-runtime-PM-ope.patch :
* 0298-UBUNTU-SAUCE-mlxbf-ptm-use-0444-instead-of-S_IRUGO.patch :
* 0299-UBUNTU-SAUCE-mlxbf-ptm-add-atx-debugfs-nodes.patch :
* 0300-UBUNTU-SAUCE-mlxbf-ptm-update-module-version.patch :
* 0301-UBUNTU-SAUCE-mlxbf-gige-Fix-kernel-panic-at-shutdown.patch :
* 0302-UBUNTU-SAUCE-mlxbf-bootctl-support-SMC-call-for-sett.patch :
* 0303-UBUNTU-SAUCE-Add-BF3-related-ACPI-config-and-Ring-de.patch :
* 0306-dt-bindings-trivial-devices-Add-infineon-xdpe1a2g7.patch :
* 0307-leds-mlxreg-Add-support-for-new-flavour-of-capabilit.patch :
* 0308-leds-mlxreg-Remove-code-for-amber-LED-colour.patch :
* 0308-platform_data-mlxreg-Add-capability-bit-and-mask-fie.patch :
* 0309-hwmon-mlxreg-fan-Add-support-for-new-flavour-of-capa.patch :
* 0310-hwmon-mlxreg-fan-Extend-number-of-supporetd-fans.patch :
* 0317-platform-mellanox-Introduce-support-for-switches-equ.patch :
* 0318-mellanox-Relocate-mlx-platform-driver.patch :
* 0319-UBUNTU-SAUCE-mlxbf-tmfifo-fix-potential-race.patch :
* 0320-UBUNTU-SAUCE-mlxbf-tmfifo-Drop-the-Rx-packet-if-no-m.patch :
* 0321-UBUNTU-SAUCE-mlxbf-tmfifo-Drop-jumbo-frames.patch :
* 0322-UBUNTU-SAUCE-mlxbf-tmfifo.c-Amend-previous-tmfifo-pa.patch :
* 0323-mlxbf_gige-add-set_link_ksettings-ethtool-callback.patch :
* 0324-mlxbf_gige-fix-white-space-in-mlxbf_gige_eth_ioctl.patch :
* 0325-UBUNTU-SAUCE-mlxbf-bootctl-Fix-kernel-panic-due-to-b.patch :
* 0326-platform-mellanox-mlxreg-hotplug-Add-support-for-new.patch :
* 0327-platform-mellanox-mlx-platform-Change-register-name.patch :
* 0328-platform-mellanox-mlx-platform-Add-support-for-new-X.patch :
* [Mellanox] Remove thermal zone related code and replace with new one
* Revert "Revert "[Mellanox] Align PSU temperature sysfs node name with hw-management change (#16820)" (#16956)"
This reverts commit c2edc6f9d5
.
---------
Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
Co-authored-by: Junchao-Mellanox <junchao@nvidia.com>
Co-authored-by: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com>
178 lines
5.6 KiB
Diff
178 lines
5.6 KiB
Diff
From fda66dd5619067846d24d3b30398f7406b10af69 Mon Sep 17 00:00:00 2001
|
|
From: Liming Sun <limings@nvidia.com>
|
|
Date: Sun, 4 Jun 2023 10:28:14 -0400
|
|
Subject: [PATCH] UBUNTU: SAUCE: mlxbf-tmfifo: Drop the Rx packet if no more
|
|
descriptors
|
|
X-NVConfidentiality: public
|
|
|
|
BugLink: https://bugs.launchpad.net/bugs/2021749
|
|
|
|
This commit fixes tmfifo console stuck issue when the virtual
|
|
networking interface is in down state. In such case, the network
|
|
Rx descriptors runs out which causes the network packet stays
|
|
in the tmfifo and couldn't be popped out thus blocking the console
|
|
packets. The fix is to drop the receiving packet when no more Rx
|
|
descriptors.
|
|
|
|
Signed-off-by: Liming Sun <limings@nvidia.com>
|
|
Acked-by: Tim Gardner <tim.gardner@canonical.com>
|
|
Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>
|
|
Signed-off-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>
|
|
---
|
|
drivers/platform/mellanox/mlxbf-tmfifo.c | 65 ++++++++++++++++++++++----------
|
|
1 file changed, 46 insertions(+), 19 deletions(-)
|
|
|
|
diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c
|
|
index 19d539fc99ae..88610f45456b 100644
|
|
--- a/drivers/platform/mellanox/mlxbf-tmfifo.c
|
|
+++ b/drivers/platform/mellanox/mlxbf-tmfifo.c
|
|
@@ -59,6 +59,7 @@ struct mlxbf_tmfifo;
|
|
* @vq: pointer to the virtio virtqueue
|
|
* @desc: current descriptor of the pending packet
|
|
* @desc_head: head descriptor of the pending packet
|
|
+ * @drop_desc: dummy desc for packet dropping
|
|
* @cur_len: processed length of the current descriptor
|
|
* @rem_len: remaining length of the pending packet
|
|
* @pkt_len: total length of the pending packet
|
|
@@ -75,6 +76,7 @@ struct mlxbf_tmfifo_vring {
|
|
struct virtqueue *vq;
|
|
struct vring_desc *desc;
|
|
struct vring_desc *desc_head;
|
|
+ struct vring_desc drop_desc;
|
|
int cur_len;
|
|
int rem_len;
|
|
u32 pkt_len;
|
|
@@ -86,6 +88,11 @@ struct mlxbf_tmfifo_vring {
|
|
struct mlxbf_tmfifo *fifo;
|
|
};
|
|
|
|
+/* Check whether vring is in drop mode. */
|
|
+#define IS_VRING_DROP(_r) ({ \
|
|
+ typeof(_r) (r) = (_r); \
|
|
+ (r->desc_head == &r->drop_desc ? true : false); })
|
|
+
|
|
/* Interrupt types. */
|
|
enum {
|
|
MLXBF_TM_RX_LWM_IRQ,
|
|
@@ -275,6 +282,7 @@ static int mlxbf_tmfifo_alloc_vrings(struct mlxbf_tmfifo *fifo,
|
|
vring->align = SMP_CACHE_BYTES;
|
|
vring->index = i;
|
|
vring->vdev_id = tm_vdev->vdev.id.device;
|
|
+ vring->drop_desc.len = 0xffff;
|
|
dev = &tm_vdev->vdev.dev;
|
|
|
|
size = vring_size(vring->num, vring->align);
|
|
@@ -380,7 +388,7 @@ static u32 mlxbf_tmfifo_get_pkt_len(struct mlxbf_tmfifo_vring *vring,
|
|
return len;
|
|
}
|
|
|
|
-static void mlxbf_tmfifo_release_pending_pkt(struct mlxbf_tmfifo_vring *vring)
|
|
+static void mlxbf_tmfifo_release_pkt(struct mlxbf_tmfifo_vring *vring)
|
|
{
|
|
struct vring_desc *desc_head;
|
|
u32 len = 0;
|
|
@@ -508,8 +516,6 @@ static int mlxbf_tmfifo_get_rx_avail(struct mlxbf_tmfifo *fifo)
|
|
return FIELD_GET(MLXBF_TMFIFO_RX_STS__COUNT_MASK, sts);
|
|
}
|
|
|
|
-
|
|
-
|
|
/* Get the number of available words in the TmFifo for sending. */
|
|
static int mlxbf_tmfifo_get_tx_avail(struct mlxbf_tmfifo *fifo, int vdev_id)
|
|
{
|
|
@@ -732,19 +738,25 @@ static void mlxbf_tmfifo_rxtx_word(struct mlxbf_tmfifo_vring *vring,
|
|
|
|
if (vring->cur_len + sizeof(u64) <= len) {
|
|
/* The whole word. */
|
|
- if (is_rx)
|
|
- memcpy(addr + vring->cur_len, &data, sizeof(u64));
|
|
- else
|
|
- memcpy(&data, addr + vring->cur_len, sizeof(u64));
|
|
+ if (!IS_VRING_DROP(vring)) {
|
|
+ if (is_rx)
|
|
+ memcpy(addr + vring->cur_len, &data,
|
|
+ sizeof(u64));
|
|
+ else
|
|
+ memcpy(&data, addr + vring->cur_len,
|
|
+ sizeof(u64));
|
|
+ }
|
|
vring->cur_len += sizeof(u64);
|
|
} else {
|
|
/* Leftover bytes. */
|
|
- if (is_rx)
|
|
- memcpy(addr + vring->cur_len, &data,
|
|
- len - vring->cur_len);
|
|
- else
|
|
- memcpy(&data, addr + vring->cur_len,
|
|
- len - vring->cur_len);
|
|
+ if (!IS_VRING_DROP(vring)) {
|
|
+ if (is_rx)
|
|
+ memcpy(addr + vring->cur_len, &data,
|
|
+ len - vring->cur_len);
|
|
+ else
|
|
+ memcpy(&data, addr + vring->cur_len,
|
|
+ len - vring->cur_len);
|
|
+ }
|
|
vring->cur_len = len;
|
|
}
|
|
|
|
@@ -847,8 +859,16 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring,
|
|
/* Get the descriptor of the next packet. */
|
|
if (!vring->desc) {
|
|
desc = mlxbf_tmfifo_get_next_pkt(vring, is_rx);
|
|
- if (!desc)
|
|
- return false;
|
|
+ if (!desc) {
|
|
+ /* Drop next Rx packet to avoid stuck. */
|
|
+ if (is_rx) {
|
|
+ desc = &vring->drop_desc;
|
|
+ vring->desc_head = desc;
|
|
+ vring->desc = desc;
|
|
+ } else {
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
} else {
|
|
desc = vring->desc;
|
|
}
|
|
@@ -881,17 +901,24 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring,
|
|
vring->rem_len -= len;
|
|
|
|
/* Get the next desc on the chain. */
|
|
- if (vring->rem_len > 0 &&
|
|
+ if (!IS_VRING_DROP(vring) && vring->rem_len > 0 &&
|
|
(virtio16_to_cpu(vdev, desc->flags) & VRING_DESC_F_NEXT)) {
|
|
idx = virtio16_to_cpu(vdev, desc->next);
|
|
desc = &vr->desc[idx];
|
|
goto mlxbf_tmfifo_desc_done;
|
|
}
|
|
|
|
- /* Done and release the pending packet. */
|
|
- mlxbf_tmfifo_release_pending_pkt(vring);
|
|
+ /* Done and release the packet. */
|
|
desc = NULL;
|
|
fifo->vring[is_rx] = NULL;
|
|
+ if (!IS_VRING_DROP(vring)) {
|
|
+ mlxbf_tmfifo_release_pkt(vring);
|
|
+ } else {
|
|
+ vring->pkt_len = 0;
|
|
+ vring->desc_head = NULL;
|
|
+ vring->desc = NULL;
|
|
+ return false;
|
|
+ }
|
|
|
|
/*
|
|
* Make sure the load/store are in order before
|
|
@@ -1073,7 +1100,7 @@ static void mlxbf_tmfifo_virtio_del_vqs(struct virtio_device *vdev)
|
|
|
|
/* Release the pending packet. */
|
|
if (vring->desc)
|
|
- mlxbf_tmfifo_release_pending_pkt(vring);
|
|
+ mlxbf_tmfifo_release_pkt(vring);
|
|
vq = vring->vq;
|
|
if (vq) {
|
|
vring->vq = NULL;
|
|
--
|
|
2.14.1
|
|
|