mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
netdevsim: add HDS feature
HDS options(tcp-data-split, hds-thresh) have dependencies between other features like XDP. Basic dependencies are checked in the core API. netdevsim is very useful to check basic dependencies. The default tcp-data-split mode is UNKNOWN but netdevsim driver returns ENABLED when ethtool dumps tcp-data-split mode. The default value of HDS threshold is 0 and the maximum value is 1024. ethtool shows like this. ethtool -g eni1np1 Ring parameters for eni1np1: Pre-set maximums: ... HDS thresh: 1024 Current hardware settings: ... TCP data split: on HDS thresh: 0 ethtool -G eni1np1 tcp-data-split on hds-thresh 1024 ethtool -g eni1np1 Ring parameters for eni1np1: Pre-set maximums: ... HDS thresh: 1024 Current hardware settings: ... TCP data split: on HDS thresh: 1024 Signed-off-by: Taehee Yoo <ap420073@gmail.com> Link: https://patch.msgid.link/20250114142852.3364986-10-ap420073@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
6b43673a25
commit
f394d07b19
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/ethtool_netlink.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
@@ -54,6 +55,7 @@ static int nsim_forward_skb(struct net_device *dev, struct sk_buff *skb,
|
||||
static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct netdevsim *ns = netdev_priv(dev);
|
||||
struct ethtool_netdev_state *ethtool;
|
||||
struct net_device *peer_dev;
|
||||
unsigned int len = skb->len;
|
||||
struct netdevsim *peer_ns;
|
||||
@@ -74,6 +76,13 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
rxq = rxq % peer_dev->num_rx_queues;
|
||||
rq = peer_ns->rq[rxq];
|
||||
|
||||
ethtool = peer_dev->ethtool;
|
||||
if (skb_is_nonlinear(skb) &&
|
||||
(ethtool->hds_config != ETHTOOL_TCP_DATA_SPLIT_ENABLED ||
|
||||
(ethtool->hds_config == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
|
||||
ethtool->hds_thresh > len)))
|
||||
skb_linearize(skb);
|
||||
|
||||
skb_tx_timestamp(skb);
|
||||
if (unlikely(nsim_forward_skb(peer_dev, skb, rq) == NET_RX_DROP))
|
||||
goto out_drop_cnt;
|
||||
|
||||
Reference in New Issue
Block a user