summaryrefslogtreecommitdiff
path: root/drivers/net/sfc/sfc_rx.c
diff options
context:
space:
mode:
authorIgor Romanov <igor.romanov@oktetlabs.ru>2019-04-23 09:14:30 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2019-05-03 18:45:22 +0200
commit6c0cc77a2dd3806c5366586d818b1796a610e260 (patch)
tree9c2d214b7f2ec9acfb9164eb703ba37adb82d596 /drivers/net/sfc/sfc_rx.c
parentf4a9349da80f8076d060498c3a9f673032e8662c (diff)
downloaddpdk-6c0cc77a2dd3806c5366586d818b1796a610e260.zip
dpdk-6c0cc77a2dd3806c5366586d818b1796a610e260.tar.gz
dpdk-6c0cc77a2dd3806c5366586d818b1796a610e260.tar.xz
net/sfc: fix MTU change to check Rx scatter consistency
Rx queue setup function checks configured MTU to make sure that no oversized packets can be received. But a following call to set MTU function might make this check irrelevant. Add a function to check MTU size against Rx buffer size and additional Rx queue info, including Rx scatter offload. Fixes: e961cf425e02 ("net/sfc: support MTU change") Cc: stable@dpdk.org Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Diffstat (limited to 'drivers/net/sfc/sfc_rx.c')
-rw-r--r--drivers/net/sfc/sfc_rx.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 5d8c276..f222111 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -360,6 +360,18 @@ sfc_efx_rx_qdesc_status(struct sfc_dp_rxq *dp_rxq, uint16_t offset)
return RTE_ETH_RX_DESC_UNAVAIL;
}
+boolean_t
+sfc_rx_check_scatter(size_t pdu, size_t rx_buf_size, uint32_t rx_prefix_size,
+ boolean_t rx_scatter_enabled, const char **error)
+{
+ if ((rx_buf_size < pdu + rx_prefix_size) && !rx_scatter_enabled) {
+ *error = "Rx scatter is disabled and RxQ mbuf pool object size is too small";
+ return B_FALSE;
+ }
+
+ return B_TRUE;
+}
+
/** Get Rx datapath ops by the datapath RxQ handle */
const struct sfc_dp_rx *
sfc_dp_rx_by_dp_rxq(const struct sfc_dp_rxq *dp_rxq)
@@ -975,6 +987,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
struct sfc_dp_rx_qcreate_info info;
struct sfc_dp_rx_hw_limits hw_limits;
uint16_t rx_free_thresh;
+ const char *error;
memset(&hw_limits, 0, sizeof(hw_limits));
hw_limits.rxq_max_entries = sa->rxq_max_entries;
@@ -1005,10 +1018,11 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
goto fail_bad_conf;
}
- if ((buf_size < sa->port.pdu + encp->enc_rx_prefix_size) &&
- (~offloads & DEV_RX_OFFLOAD_SCATTER)) {
- sfc_err(sa, "Rx scatter is disabled and RxQ %u mbuf pool "
- "object size is too small", sw_index);
+ if (!sfc_rx_check_scatter(sa->port.pdu, buf_size,
+ encp->enc_rx_prefix_size,
+ (offloads & DEV_RX_OFFLOAD_SCATTER),
+ &error)) {
+ sfc_err(sa, "RxQ %u MTU check failed: %s", sw_index, error);
sfc_err(sa, "RxQ %u calculated Rx buffer size is %u vs "
"PDU size %u plus Rx prefix %u bytes",
sw_index, buf_size, (unsigned int)sa->port.pdu,