Skip to content

Commit be64e39

Browse files
committed
Merge branch 's390-qeth-next'
Julian Wiedmann says: ==================== s390/qeth: updates 2020-02-27 please apply the following patch series for qeth to netdev's net-next tree. This adds support for ETHTOOL_RX_COPYBREAK, along with small cleanups and fine-tuning. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 22339f2 + 562cf77 commit be64e39

File tree

5 files changed

+65
-38
lines changed

5 files changed

+65
-38
lines changed

drivers/s390/net/qeth_core.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ struct qeth_vnicc_info {
189189
#define QETH_IQD_MIN_TXQ 2 /* One for ucast, one for mcast. */
190190
#define QETH_IQD_MCAST_TXQ 0
191191
#define QETH_IQD_MIN_UCAST_TXQ 1
192+
193+
#define QETH_RX_COPYBREAK (PAGE_SIZE >> 1)
192194
#define QETH_IN_BUF_SIZE_DEFAULT 65536
193195
#define QETH_IN_BUF_COUNT_DEFAULT 64
194196
#define QETH_IN_BUF_COUNT_HSDEFAULT 128
@@ -219,9 +221,6 @@ struct qeth_vnicc_info {
219221
#define QETH_HIGH_WATERMARK_PACK 5
220222
#define QETH_WATERMARK_PACK_FUZZ 1
221223

222-
/* large receive scatter gather copy break */
223-
#define QETH_RX_SG_CB (PAGE_SIZE >> 1)
224-
225224
struct qeth_hdr_layer3 {
226225
__u8 id;
227226
__u8 flags;
@@ -711,7 +710,6 @@ struct qeth_card_options {
711710
struct qeth_vnicc_info vnicc; /* VNICC options */
712711
int fake_broadcast;
713712
enum qeth_discipline_id layer;
714-
int rx_sg_cb;
715713
enum qeth_ipa_isolation_modes isolation;
716714
enum qeth_ipa_isolation_modes prev_isolation;
717715
int sniffer;
@@ -770,6 +768,10 @@ struct qeth_switch_info {
770768
__u32 settings;
771769
};
772770

771+
struct qeth_priv {
772+
unsigned int rx_copybreak;
773+
};
774+
773775
#define QETH_NAPI_WEIGHT NAPI_POLL_WEIGHT
774776

775777
struct qeth_card {

drivers/s390/net/qeth_core_main.c

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,
742742
/* fall through */
743743
default:
744744
qeth_clear_ipacmd_list(card);
745-
goto out;
745+
goto err_idx;
746746
}
747747

748748
cmd = __ipa_reply(iob);
@@ -795,8 +795,9 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,
795795
memcpy(&card->seqno.pdu_hdr_ack,
796796
QETH_PDU_HEADER_SEQ_NO(iob->data),
797797
QETH_SEQ_NO_LENGTH);
798-
qeth_put_cmd(iob);
799798
__qeth_issue_next_read(card);
799+
err_idx:
800+
qeth_put_cmd(iob);
800801
}
801802

802803
static int qeth_set_thread_start_bit(struct qeth_card *card,
@@ -1256,7 +1257,6 @@ static void qeth_set_initial_options(struct qeth_card *card)
12561257
{
12571258
card->options.route4.type = NO_ROUTER;
12581259
card->options.route6.type = NO_ROUTER;
1259-
card->options.rx_sg_cb = QETH_RX_SG_CB;
12601260
card->options.isolation = ISOLATION_MODE_NONE;
12611261
card->options.cq = QETH_CQ_DISABLED;
12621262
card->options.layer = QETH_DISCIPLINE_UNDETERMINED;
@@ -1624,17 +1624,16 @@ static void qeth_set_blkt_defaults(struct qeth_card *card)
16241624
}
16251625
}
16261626

1627-
static void qeth_init_tokens(struct qeth_card *card)
1627+
static void qeth_idx_init(struct qeth_card *card)
16281628
{
1629+
memset(&card->seqno, 0, sizeof(card->seqno));
1630+
16291631
card->token.issuer_rm_w = 0x00010103UL;
16301632
card->token.cm_filter_w = 0x00010108UL;
16311633
card->token.cm_connection_w = 0x0001010aUL;
16321634
card->token.ulp_filter_w = 0x0001010bUL;
16331635
card->token.ulp_connection_w = 0x0001010dUL;
1634-
}
16351636

1636-
static void qeth_init_func_level(struct qeth_card *card)
1637-
{
16381637
switch (card->info.type) {
16391638
case QETH_CARD_TYPE_IQD:
16401639
card->info.func_level = QETH_IDX_FUNC_LEVEL_IQD;
@@ -3405,8 +3404,7 @@ static void qeth_qdio_start_poll(struct ccw_device *ccwdev, int queue,
34053404
{
34063405
struct qeth_card *card = (struct qeth_card *)card_ptr;
34073406

3408-
if (card->dev->flags & IFF_UP)
3409-
napi_schedule_irqoff(&card->napi);
3407+
napi_schedule_irqoff(&card->napi);
34103408
}
34113409

34123410
int qeth_configure_cq(struct qeth_card *card, enum qeth_cq cq)
@@ -4952,9 +4950,9 @@ int qeth_core_hardsetup_card(struct qeth_card *card, bool *carrier_ok)
49524950
else
49534951
goto retry;
49544952
}
4953+
49554954
qeth_determine_capabilities(card);
4956-
qeth_init_tokens(card);
4957-
qeth_init_func_level(card);
4955+
qeth_idx_init(card);
49584956

49594957
rc = qeth_idx_activate_read_channel(card);
49604958
if (rc == -EINTR) {
@@ -5269,6 +5267,7 @@ static int qeth_extract_skb(struct qeth_card *card,
52695267
int *__offset)
52705268
{
52715269
struct qdio_buffer_element *element = *__element;
5270+
struct qeth_priv *priv = netdev_priv(card->dev);
52725271
struct qdio_buffer *buffer = qethbuffer->buffer;
52735272
struct napi_struct *napi = &card->napi;
52745273
unsigned int linear_len = 0;
@@ -5344,7 +5343,7 @@ static int qeth_extract_skb(struct qeth_card *card,
53445343
}
53455344

53465345
use_rx_sg = (card->options.cq == QETH_CQ_ENABLED) ||
5347-
(skb_len > card->options.rx_sg_cb &&
5346+
(skb_len > READ_ONCE(priv->rx_copybreak) &&
53485347
!atomic_read(&card->force_alloc_skb) &&
53495348
!IS_OSN(card));
53505349

@@ -5893,25 +5892,30 @@ static void qeth_clear_dbf_list(void)
58935892
static struct net_device *qeth_alloc_netdev(struct qeth_card *card)
58945893
{
58955894
struct net_device *dev;
5895+
struct qeth_priv *priv;
58965896

58975897
switch (card->info.type) {
58985898
case QETH_CARD_TYPE_IQD:
5899-
dev = alloc_netdev_mqs(0, "hsi%d", NET_NAME_UNKNOWN,
5899+
dev = alloc_netdev_mqs(sizeof(*priv), "hsi%d", NET_NAME_UNKNOWN,
59005900
ether_setup, QETH_MAX_QUEUES, 1);
59015901
break;
59025902
case QETH_CARD_TYPE_OSM:
5903-
dev = alloc_etherdev(0);
5903+
dev = alloc_etherdev(sizeof(*priv));
59045904
break;
59055905
case QETH_CARD_TYPE_OSN:
5906-
dev = alloc_netdev(0, "osn%d", NET_NAME_UNKNOWN, ether_setup);
5906+
dev = alloc_netdev(sizeof(*priv), "osn%d", NET_NAME_UNKNOWN,
5907+
ether_setup);
59075908
break;
59085909
default:
5909-
dev = alloc_etherdev_mqs(0, QETH_MAX_QUEUES, 1);
5910+
dev = alloc_etherdev_mqs(sizeof(*priv), QETH_MAX_QUEUES, 1);
59105911
}
59115912

59125913
if (!dev)
59135914
return NULL;
59145915

5916+
priv = netdev_priv(dev);
5917+
priv->rx_copybreak = QETH_RX_COPYBREAK;
5918+
59155919
dev->ml_priv = card;
59165920
dev->watchdog_timeo = QETH_TX_TIMEOUT;
59175921
dev->min_mtu = IS_OSN(card) ? 64 : 576;

drivers/s390/net/qeth_core_mpc.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ enum qeth_link_types {
9393
QETH_LINK_TYPE_LANE = 0x88,
9494
};
9595

96-
/*
97-
* Routing stuff
98-
*/
99-
#define RESET_ROUTING_FLAG 0x10 /* indicate that routing type shall be set */
10096
enum qeth_routing_types {
10197
/* TODO: set to bit flag used in IPA Command */
10298
NO_ROUTER = 0,
@@ -427,7 +423,6 @@ struct qeth_ipacmd_setassparms {
427423
struct qeth_arp_cache_entry arp_entry;
428424
struct qeth_arp_query_data query_arp;
429425
struct qeth_tso_start_data tso;
430-
__u8 ip[16];
431426
} data;
432427
} __attribute__ ((packed));
433428

@@ -550,8 +545,9 @@ struct qeth_ipacmd_setadpparms {
550545

551546
/* CREATE_ADDR IPA Command: ***********************************************/
552547
struct qeth_create_destroy_address {
553-
__u8 unique_id[8];
554-
} __attribute__ ((packed));
548+
u8 mac_addr[ETH_ALEN];
549+
u16 uid;
550+
};
555551

556552
/* SET DIAGNOSTIC ASSIST IPA Command: *************************************/
557553

drivers/s390/net/qeth_ethtool.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,35 @@ static void qeth_get_channels(struct net_device *dev,
175175
channels->combined_count = 0;
176176
}
177177

178+
static int qeth_get_tunable(struct net_device *dev,
179+
const struct ethtool_tunable *tuna, void *data)
180+
{
181+
struct qeth_priv *priv = netdev_priv(dev);
182+
183+
switch (tuna->id) {
184+
case ETHTOOL_RX_COPYBREAK:
185+
*(u32 *)data = priv->rx_copybreak;
186+
return 0;
187+
default:
188+
return -EOPNOTSUPP;
189+
}
190+
}
191+
192+
static int qeth_set_tunable(struct net_device *dev,
193+
const struct ethtool_tunable *tuna,
194+
const void *data)
195+
{
196+
struct qeth_priv *priv = netdev_priv(dev);
197+
198+
switch (tuna->id) {
199+
case ETHTOOL_RX_COPYBREAK:
200+
WRITE_ONCE(priv->rx_copybreak, *(u32 *)data);
201+
return 0;
202+
default:
203+
return -EOPNOTSUPP;
204+
}
205+
}
206+
178207
/* Helper function to fill 'advertising' and 'supported' which are the same. */
179208
/* Autoneg and full-duplex are supported and advertised unconditionally. */
180209
/* Always advertise and support all speeds up to specified, and only one */
@@ -381,6 +410,8 @@ const struct ethtool_ops qeth_ethtool_ops = {
381410
.get_sset_count = qeth_get_sset_count,
382411
.get_drvinfo = qeth_get_drvinfo,
383412
.get_channels = qeth_get_channels,
413+
.get_tunable = qeth_get_tunable,
414+
.set_tunable = qeth_set_tunable,
384415
.get_link_ksettings = qeth_get_link_ksettings,
385416
};
386417

drivers/s390/net/qeth_l3_main.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -920,27 +920,25 @@ static int qeth_l3_iqd_read_initial_mac_cb(struct qeth_card *card,
920920

921921
if (cmd->hdr.return_code)
922922
return -EIO;
923+
if (!is_valid_ether_addr(cmd->data.create_destroy_addr.mac_addr))
924+
return -EADDRNOTAVAIL;
923925

924926
ether_addr_copy(card->dev->dev_addr,
925-
cmd->data.create_destroy_addr.unique_id);
927+
cmd->data.create_destroy_addr.mac_addr);
926928
return 0;
927929
}
928930

929931
static int qeth_l3_iqd_read_initial_mac(struct qeth_card *card)
930932
{
931933
int rc = 0;
932934
struct qeth_cmd_buffer *iob;
933-
struct qeth_ipa_cmd *cmd;
934935

935936
QETH_CARD_TEXT(card, 2, "hsrmac");
936937

937938
iob = qeth_ipa_alloc_cmd(card, IPA_CMD_CREATE_ADDR, QETH_PROT_IPV6,
938939
IPA_DATA_SIZEOF(create_destroy_addr));
939940
if (!iob)
940941
return -ENOMEM;
941-
cmd = __ipa_cmd(iob);
942-
*((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) =
943-
card->info.unique_id;
944942

945943
rc = qeth_send_ipa_cmd(card, iob, qeth_l3_iqd_read_initial_mac_cb,
946944
NULL);
@@ -953,8 +951,7 @@ static int qeth_l3_get_unique_id_cb(struct qeth_card *card,
953951
struct qeth_ipa_cmd *cmd = (struct qeth_ipa_cmd *) data;
954952

955953
if (cmd->hdr.return_code == 0) {
956-
card->info.unique_id = *((__u16 *)
957-
&cmd->data.create_destroy_addr.unique_id[6]);
954+
card->info.unique_id = cmd->data.create_destroy_addr.uid;
958955
return 0;
959956
}
960957

@@ -968,7 +965,6 @@ static int qeth_l3_get_unique_id(struct qeth_card *card)
968965
{
969966
int rc = 0;
970967
struct qeth_cmd_buffer *iob;
971-
struct qeth_ipa_cmd *cmd;
972968

973969
QETH_CARD_TEXT(card, 2, "guniqeid");
974970

@@ -982,10 +978,8 @@ static int qeth_l3_get_unique_id(struct qeth_card *card)
982978
IPA_DATA_SIZEOF(create_destroy_addr));
983979
if (!iob)
984980
return -ENOMEM;
985-
cmd = __ipa_cmd(iob);
986-
*((__u16 *) &cmd->data.create_destroy_addr.unique_id[6]) =
987-
card->info.unique_id;
988981

982+
__ipa_cmd(iob)->data.create_destroy_addr.uid = card->info.unique_id;
989983
rc = qeth_send_ipa_cmd(card, iob, qeth_l3_get_unique_id_cb, NULL);
990984
return rc;
991985
}

0 commit comments

Comments
 (0)