Skip to content

Commit

Permalink
Merge branch 's390-qeth-next'
Browse files Browse the repository at this point in the history
Julian Wiedmann says:

====================
s390/qeth: updates 2021-10-25

please apply the following patch series for qeth to netdev's net-next tree.

This brings some minor maintenance improvements, and a bunch of cleanups
so that the W=1 build passes without warning.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 25, 2021
2 parents 57bb113 + 56c5af2 commit 6047862
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 81 deletions.
2 changes: 0 additions & 2 deletions arch/s390/include/asm/qdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ extern int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
extern int qdio_establish(struct ccw_device *cdev,
struct qdio_initialize *init_data);
extern int qdio_activate(struct ccw_device *);
extern struct qaob *qdio_allocate_aob(void);
extern void qdio_release_aob(struct qaob *);
extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags, int q_nr,
unsigned int bufnr, unsigned int count, struct qaob *aob);
extern int qdio_start_irq(struct ccw_device *cdev);
Expand Down
34 changes: 2 additions & 32 deletions drivers/s390/cio/qdio_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,6 @@
#define QBUFF_PER_PAGE (PAGE_SIZE / sizeof(struct qdio_buffer))

static struct kmem_cache *qdio_q_cache;
static struct kmem_cache *qdio_aob_cache;

struct qaob *qdio_allocate_aob(void)
{
return kmem_cache_zalloc(qdio_aob_cache, GFP_ATOMIC);
}
EXPORT_SYMBOL_GPL(qdio_allocate_aob);

void qdio_release_aob(struct qaob *aob)
{
kmem_cache_free(qdio_aob_cache, aob);
}
EXPORT_SYMBOL_GPL(qdio_release_aob);

/**
* qdio_free_buffers() - free qdio buffers
Expand Down Expand Up @@ -447,39 +434,22 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr)

int __init qdio_setup_init(void)
{
int rc;

qdio_q_cache = kmem_cache_create("qdio_q", sizeof(struct qdio_q),
256, 0, NULL);
if (!qdio_q_cache)
return -ENOMEM;

qdio_aob_cache = kmem_cache_create("qdio_aob",
sizeof(struct qaob),
sizeof(struct qaob),
0,
NULL);
if (!qdio_aob_cache) {
rc = -ENOMEM;
goto free_qdio_q_cache;
}

/* Check for OSA/FCP thin interrupts (bit 67). */
DBF_EVENT("thinint:%1d",
(css_general_characteristics.aif_osa) ? 1 : 0);

/* Check for QEBSM support in general (bit 58). */
DBF_EVENT("cssQEBSM:%1d", css_general_characteristics.qebsm);
rc = 0;
out:
return rc;
free_qdio_q_cache:
kmem_cache_destroy(qdio_q_cache);
goto out;

return 0;
}

void qdio_setup_exit(void)
{
kmem_cache_destroy(qdio_aob_cache);
kmem_cache_destroy(qdio_q_cache);
}
4 changes: 1 addition & 3 deletions drivers/s390/net/qeth_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ static inline bool qeth_out_queue_is_empty(struct qeth_qdio_out_q *queue)
struct qeth_qdio_info {
atomic_t state;
/* input */
int no_in_queues;
struct qeth_qdio_q *in_q;
struct qeth_qdio_q *c_q;
struct qeth_qdio_buffer_pool in_buf_pool;
Expand Down Expand Up @@ -771,8 +770,6 @@ struct qeth_discipline {
void (*remove) (struct ccwgroup_device *);
int (*set_online)(struct qeth_card *card, bool carrier_ok);
void (*set_offline)(struct qeth_card *card);
int (*do_ioctl)(struct net_device *dev, struct ifreq *rq,
void __user *data, int cmd);
int (*control_event_handler)(struct qeth_card *card,
struct qeth_ipa_cmd *cmd);
};
Expand Down Expand Up @@ -1087,6 +1084,7 @@ int qeth_setadpparms_set_access_ctrl(struct qeth_card *card,
int qeth_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
int qeth_siocdevprivate(struct net_device *dev, struct ifreq *rq,
void __user *data, int cmd);
__printf(3, 4)
void qeth_dbf_longtext(debug_info_t *id, int level, char *text, ...);
int qeth_configure_cq(struct qeth_card *, enum qeth_cq);
int qeth_hw_trap(struct qeth_card *, enum qeth_diags_trap_action);
Expand Down
59 changes: 35 additions & 24 deletions drivers/s390/net/qeth_core_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ EXPORT_SYMBOL_GPL(qeth_dbf);

static struct kmem_cache *qeth_core_header_cache;
static struct kmem_cache *qeth_qdio_outbuf_cache;
static struct kmem_cache *qeth_qaob_cache;

static struct device *qeth_core_root_dev;
static struct dentry *qeth_debugfs_root;
Expand Down Expand Up @@ -354,8 +355,8 @@ static int qeth_cq_init(struct qeth_card *card)
qdio_reset_buffers(card->qdio.c_q->qdio_bufs,
QDIO_MAX_BUFFERS_PER_Q);
card->qdio.c_q->next_buf_to_init = 127;
rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT,
card->qdio.no_in_queues - 1, 0, 127, NULL);
rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 1, 0, 127,
NULL);
if (rc) {
QETH_CARD_TEXT_(card, 2, "1err%d", rc);
goto out;
Expand All @@ -375,21 +376,16 @@ static int qeth_alloc_cq(struct qeth_card *card)
dev_err(&card->gdev->dev, "Failed to create completion queue\n");
return -ENOMEM;
}

card->qdio.no_in_queues = 2;
} else {
QETH_CARD_TEXT(card, 2, "nocq");
card->qdio.c_q = NULL;
card->qdio.no_in_queues = 1;
}
QETH_CARD_TEXT_(card, 2, "iqc%d", card->qdio.no_in_queues);
return 0;
}

static void qeth_free_cq(struct qeth_card *card)
{
if (card->qdio.c_q) {
--card->qdio.no_in_queues;
qeth_free_qdio_queue(card->qdio.c_q);
card->qdio.c_q = NULL;
}
Expand Down Expand Up @@ -1338,7 +1334,7 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
static void qeth_free_out_buf(struct qeth_qdio_out_buffer *buf)
{
if (buf->aob)
qdio_release_aob(buf->aob);
kmem_cache_free(qeth_qaob_cache, buf->aob);
kmem_cache_free(qeth_qdio_outbuf_cache, buf);
}

Expand Down Expand Up @@ -1458,7 +1454,6 @@ static void qeth_init_qdio_info(struct qeth_card *card)
card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;

/* inbound */
card->qdio.no_in_queues = 1;
card->qdio.in_buf_size = QETH_IN_BUF_SIZE_DEFAULT;
if (IS_IQD(card))
card->qdio.init_pool.buf_count = QETH_IN_BUF_COUNT_HSDEFAULT;
Expand Down Expand Up @@ -1930,9 +1925,9 @@ static struct qeth_cmd_buffer *qeth_mpc_alloc_cmd(struct qeth_card *card,
* @card: qeth_card structure pointer
* @iob: qeth_cmd_buffer pointer
* @reply_cb: callback function pointer
* @cb_card: pointer to the qeth_card structure
* @cb_reply: pointer to the qeth_reply structure
* @cb_cmd: pointer to the original iob for non-IPA
* cb_card: pointer to the qeth_card structure
* cb_reply: pointer to the qeth_reply structure
* cb_cmd: pointer to the original iob for non-IPA
* commands, or to the qeth_ipa_cmd structure
* for the IPA commands.
* @reply_param: private pointer passed to the callback
Expand Down Expand Up @@ -2629,7 +2624,7 @@ static void qeth_free_qdio_queues(struct qeth_card *card)
qeth_free_cq(card);
for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) {
if (card->qdio.in_q->bufs[j].rx_skb)
dev_kfree_skb_any(card->qdio.in_q->bufs[j].rx_skb);
consume_skb(card->qdio.in_q->bufs[j].rx_skb);
}
qeth_free_qdio_queue(card->qdio.in_q);
card->qdio.in_q = NULL;
Expand Down Expand Up @@ -3039,7 +3034,7 @@ static int qeth_send_ipa_cmd_cb(struct qeth_card *card,
return (cmd->hdr.return_code) ? -EIO : 0;
}

/**
/*
* qeth_send_ipa_cmd() - send an IPA command
*
* See qeth_send_control_data() for explanation of the arguments.
Expand Down Expand Up @@ -3554,7 +3549,8 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index,
!qeth_iqd_is_mcast_queue(card, queue) &&
count == 1) {
if (!buf->aob)
buf->aob = qdio_allocate_aob();
buf->aob = kmem_cache_zalloc(qeth_qaob_cache,
GFP_ATOMIC);
if (buf->aob) {
struct qeth_qaob_priv1 *priv;

Expand Down Expand Up @@ -3780,7 +3776,7 @@ static void qeth_qdio_output_handler(struct ccw_device *ccwdev,
qeth_schedule_recovery(card);
}

/**
/*
* Note: Function assumes that we have 4 outbound queues.
*/
int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb)
Expand Down Expand Up @@ -3877,12 +3873,14 @@ static unsigned int qeth_count_elements(struct sk_buff *skb,

/**
* qeth_add_hw_header() - add a HW header to an skb.
* @queue: TX queue that the skb will be placed on.
* @skb: skb that the HW header should be added to.
* @hdr: double pointer to a qeth_hdr. When returning with >= 0,
* it contains a valid pointer to a qeth_hdr.
* @hdr_len: length of the HW header.
* @proto_len: length of protocol headers that need to be in same page as the
* HW header.
* @elements: returns the required number of buffer elements for this skb.
*
* Returns the pushed length. If the header can't be pushed on
* (eg. because it would cross a page boundary), it is allocated from
Expand Down Expand Up @@ -5139,6 +5137,7 @@ static int qeth_qdio_establish(struct qeth_card *card)
struct qdio_buffer **in_sbal_ptrs[QETH_MAX_IN_QUEUES];
struct qeth_qib_parms *qib_parms = NULL;
struct qdio_initialize init_data;
unsigned int no_input_qs = 1;
unsigned int i;
int rc = 0;

Expand All @@ -5153,8 +5152,10 @@ static int qeth_qdio_establish(struct qeth_card *card)
}

in_sbal_ptrs[0] = card->qdio.in_q->qdio_bufs;
if (card->options.cq == QETH_CQ_ENABLED)
if (card->options.cq == QETH_CQ_ENABLED) {
in_sbal_ptrs[1] = card->qdio.c_q->qdio_bufs;
no_input_qs++;
}

for (i = 0; i < card->qdio.no_out_queues; i++)
out_sbal_ptrs[i] = card->qdio.out_qs[i]->qdio_bufs;
Expand All @@ -5164,7 +5165,7 @@ static int qeth_qdio_establish(struct qeth_card *card)
QDIO_QETH_QFMT;
init_data.qib_param_field_format = 0;
init_data.qib_param_field = (void *)qib_parms;
init_data.no_input_qs = card->qdio.no_in_queues;
init_data.no_input_qs = no_input_qs;
init_data.no_output_qs = card->qdio.no_out_queues;
init_data.input_handler = qeth_qdio_input_handler;
init_data.output_handler = qeth_qdio_output_handler;
Expand Down Expand Up @@ -5604,7 +5605,7 @@ static void qeth_receive_skb(struct qeth_card *card, struct sk_buff *skb,
if (uses_frags)
napi_free_frags(napi);
else
dev_kfree_skb_any(skb);
kfree_skb(skb);
return;
}

Expand Down Expand Up @@ -5795,7 +5796,7 @@ static int qeth_extract_skb(struct qeth_card *card,
if (uses_frags)
napi_free_frags(napi);
else
dev_kfree_skb_any(skb);
kfree_skb(skb);
QETH_CARD_STAT_INC(card,
rx_length_errors);
}
Expand Down Expand Up @@ -6600,10 +6601,7 @@ int qeth_siocdevprivate(struct net_device *dev, struct ifreq *rq, void __user *d
rc = qeth_query_oat_command(card, data);
break;
default:
if (card->discipline->do_ioctl)
rc = card->discipline->do_ioctl(dev, rq, data, cmd);
else
rc = -EOPNOTSUPP;
rc = -EOPNOTSUPP;
}
if (rc)
QETH_CARD_TEXT_(card, 2, "ioce%x", rc);
Expand Down Expand Up @@ -7177,6 +7175,16 @@ static int __init qeth_core_init(void)
rc = -ENOMEM;
goto cqslab_err;
}

qeth_qaob_cache = kmem_cache_create("qeth_qaob",
sizeof(struct qaob),
sizeof(struct qaob),
0, NULL);
if (!qeth_qaob_cache) {
rc = -ENOMEM;
goto qaob_err;
}

rc = ccw_driver_register(&qeth_ccw_driver);
if (rc)
goto ccw_err;
Expand All @@ -7189,6 +7197,8 @@ static int __init qeth_core_init(void)
ccwgroup_err:
ccw_driver_unregister(&qeth_ccw_driver);
ccw_err:
kmem_cache_destroy(qeth_qaob_cache);
qaob_err:
kmem_cache_destroy(qeth_qdio_outbuf_cache);
cqslab_err:
kmem_cache_destroy(qeth_core_header_cache);
Expand All @@ -7207,6 +7217,7 @@ static void __exit qeth_core_exit(void)
qeth_clear_dbf_list();
ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver);
ccw_driver_unregister(&qeth_ccw_driver);
kmem_cache_destroy(qeth_qaob_cache);
kmem_cache_destroy(qeth_qdio_outbuf_cache);
kmem_cache_destroy(qeth_core_header_cache);
root_device_unregister(qeth_core_root_dev);
Expand Down
Loading

0 comments on commit 6047862

Please sign in to comment.