Commit 562cf773 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: support configurable RX copybreak

Implement the ethtool hooks for the ETHTOOL_RX_COPYBREAK tunable.

The copybreak is stored into netdev_priv, so that we automatically go
back to the default value if the netdev is re-allocated.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d35dbe6
...@@ -189,6 +189,8 @@ struct qeth_vnicc_info { ...@@ -189,6 +189,8 @@ struct qeth_vnicc_info {
#define QETH_IQD_MIN_TXQ 2 /* One for ucast, one for mcast. */ #define QETH_IQD_MIN_TXQ 2 /* One for ucast, one for mcast. */
#define QETH_IQD_MCAST_TXQ 0 #define QETH_IQD_MCAST_TXQ 0
#define QETH_IQD_MIN_UCAST_TXQ 1 #define QETH_IQD_MIN_UCAST_TXQ 1
#define QETH_RX_COPYBREAK (PAGE_SIZE >> 1)
#define QETH_IN_BUF_SIZE_DEFAULT 65536 #define QETH_IN_BUF_SIZE_DEFAULT 65536
#define QETH_IN_BUF_COUNT_DEFAULT 64 #define QETH_IN_BUF_COUNT_DEFAULT 64
#define QETH_IN_BUF_COUNT_HSDEFAULT 128 #define QETH_IN_BUF_COUNT_HSDEFAULT 128
...@@ -219,9 +221,6 @@ struct qeth_vnicc_info { ...@@ -219,9 +221,6 @@ struct qeth_vnicc_info {
#define QETH_HIGH_WATERMARK_PACK 5 #define QETH_HIGH_WATERMARK_PACK 5
#define QETH_WATERMARK_PACK_FUZZ 1 #define QETH_WATERMARK_PACK_FUZZ 1
/* large receive scatter gather copy break */
#define QETH_RX_SG_CB (PAGE_SIZE >> 1)
struct qeth_hdr_layer3 { struct qeth_hdr_layer3 {
__u8 id; __u8 id;
__u8 flags; __u8 flags;
...@@ -711,7 +710,6 @@ struct qeth_card_options { ...@@ -711,7 +710,6 @@ struct qeth_card_options {
struct qeth_vnicc_info vnicc; /* VNICC options */ struct qeth_vnicc_info vnicc; /* VNICC options */
int fake_broadcast; int fake_broadcast;
enum qeth_discipline_id layer; enum qeth_discipline_id layer;
int rx_sg_cb;
enum qeth_ipa_isolation_modes isolation; enum qeth_ipa_isolation_modes isolation;
enum qeth_ipa_isolation_modes prev_isolation; enum qeth_ipa_isolation_modes prev_isolation;
int sniffer; int sniffer;
...@@ -770,6 +768,10 @@ struct qeth_switch_info { ...@@ -770,6 +768,10 @@ struct qeth_switch_info {
__u32 settings; __u32 settings;
}; };
struct qeth_priv {
unsigned int rx_copybreak;
};
#define QETH_NAPI_WEIGHT NAPI_POLL_WEIGHT #define QETH_NAPI_WEIGHT NAPI_POLL_WEIGHT
struct qeth_card { struct qeth_card {
......
...@@ -1257,7 +1257,6 @@ static void qeth_set_initial_options(struct qeth_card *card) ...@@ -1257,7 +1257,6 @@ static void qeth_set_initial_options(struct qeth_card *card)
{ {
card->options.route4.type = NO_ROUTER; card->options.route4.type = NO_ROUTER;
card->options.route6.type = NO_ROUTER; card->options.route6.type = NO_ROUTER;
card->options.rx_sg_cb = QETH_RX_SG_CB;
card->options.isolation = ISOLATION_MODE_NONE; card->options.isolation = ISOLATION_MODE_NONE;
card->options.cq = QETH_CQ_DISABLED; card->options.cq = QETH_CQ_DISABLED;
card->options.layer = QETH_DISCIPLINE_UNDETERMINED; card->options.layer = QETH_DISCIPLINE_UNDETERMINED;
...@@ -5268,6 +5267,7 @@ static int qeth_extract_skb(struct qeth_card *card, ...@@ -5268,6 +5267,7 @@ static int qeth_extract_skb(struct qeth_card *card,
int *__offset) int *__offset)
{ {
struct qdio_buffer_element *element = *__element; struct qdio_buffer_element *element = *__element;
struct qeth_priv *priv = netdev_priv(card->dev);
struct qdio_buffer *buffer = qethbuffer->buffer; struct qdio_buffer *buffer = qethbuffer->buffer;
struct napi_struct *napi = &card->napi; struct napi_struct *napi = &card->napi;
unsigned int linear_len = 0; unsigned int linear_len = 0;
...@@ -5343,7 +5343,7 @@ static int qeth_extract_skb(struct qeth_card *card, ...@@ -5343,7 +5343,7 @@ static int qeth_extract_skb(struct qeth_card *card,
} }
use_rx_sg = (card->options.cq == QETH_CQ_ENABLED) || use_rx_sg = (card->options.cq == QETH_CQ_ENABLED) ||
(skb_len > card->options.rx_sg_cb && (skb_len > READ_ONCE(priv->rx_copybreak) &&
!atomic_read(&card->force_alloc_skb) && !atomic_read(&card->force_alloc_skb) &&
!IS_OSN(card)); !IS_OSN(card));
...@@ -5892,25 +5892,30 @@ static void qeth_clear_dbf_list(void) ...@@ -5892,25 +5892,30 @@ static void qeth_clear_dbf_list(void)
static struct net_device *qeth_alloc_netdev(struct qeth_card *card) static struct net_device *qeth_alloc_netdev(struct qeth_card *card)
{ {
struct net_device *dev; struct net_device *dev;
struct qeth_priv *priv;
switch (card->info.type) { switch (card->info.type) {
case QETH_CARD_TYPE_IQD: case QETH_CARD_TYPE_IQD:
dev = alloc_netdev_mqs(0, "hsi%d", NET_NAME_UNKNOWN, dev = alloc_netdev_mqs(sizeof(*priv), "hsi%d", NET_NAME_UNKNOWN,
ether_setup, QETH_MAX_QUEUES, 1); ether_setup, QETH_MAX_QUEUES, 1);
break; break;
case QETH_CARD_TYPE_OSM: case QETH_CARD_TYPE_OSM:
dev = alloc_etherdev(0); dev = alloc_etherdev(sizeof(*priv));
break; break;
case QETH_CARD_TYPE_OSN: case QETH_CARD_TYPE_OSN:
dev = alloc_netdev(0, "osn%d", NET_NAME_UNKNOWN, ether_setup); dev = alloc_netdev(sizeof(*priv), "osn%d", NET_NAME_UNKNOWN,
ether_setup);
break; break;
default: default:
dev = alloc_etherdev_mqs(0, QETH_MAX_QUEUES, 1); dev = alloc_etherdev_mqs(sizeof(*priv), QETH_MAX_QUEUES, 1);
} }
if (!dev) if (!dev)
return NULL; return NULL;
priv = netdev_priv(dev);
priv->rx_copybreak = QETH_RX_COPYBREAK;
dev->ml_priv = card; dev->ml_priv = card;
dev->watchdog_timeo = QETH_TX_TIMEOUT; dev->watchdog_timeo = QETH_TX_TIMEOUT;
dev->min_mtu = IS_OSN(card) ? 64 : 576; dev->min_mtu = IS_OSN(card) ? 64 : 576;
......
...@@ -175,6 +175,35 @@ static void qeth_get_channels(struct net_device *dev, ...@@ -175,6 +175,35 @@ static void qeth_get_channels(struct net_device *dev,
channels->combined_count = 0; channels->combined_count = 0;
} }
static int qeth_get_tunable(struct net_device *dev,
const struct ethtool_tunable *tuna, void *data)
{
struct qeth_priv *priv = netdev_priv(dev);
switch (tuna->id) {
case ETHTOOL_RX_COPYBREAK:
*(u32 *)data = priv->rx_copybreak;
return 0;
default:
return -EOPNOTSUPP;
}
}
static int qeth_set_tunable(struct net_device *dev,
const struct ethtool_tunable *tuna,
const void *data)
{
struct qeth_priv *priv = netdev_priv(dev);
switch (tuna->id) {
case ETHTOOL_RX_COPYBREAK:
WRITE_ONCE(priv->rx_copybreak, *(u32 *)data);
return 0;
default:
return -EOPNOTSUPP;
}
}
/* Helper function to fill 'advertising' and 'supported' which are the same. */ /* Helper function to fill 'advertising' and 'supported' which are the same. */
/* Autoneg and full-duplex are supported and advertised unconditionally. */ /* Autoneg and full-duplex are supported and advertised unconditionally. */
/* Always advertise and support all speeds up to specified, and only one */ /* Always advertise and support all speeds up to specified, and only one */
...@@ -381,6 +410,8 @@ const struct ethtool_ops qeth_ethtool_ops = { ...@@ -381,6 +410,8 @@ const struct ethtool_ops qeth_ethtool_ops = {
.get_sset_count = qeth_get_sset_count, .get_sset_count = qeth_get_sset_count,
.get_drvinfo = qeth_get_drvinfo, .get_drvinfo = qeth_get_drvinfo,
.get_channels = qeth_get_channels, .get_channels = qeth_get_channels,
.get_tunable = qeth_get_tunable,
.set_tunable = qeth_set_tunable,
.get_link_ksettings = qeth_get_link_ksettings, .get_link_ksettings = qeth_get_link_ksettings,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment