From patchwork Wed Nov 7 18:22:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Heimes X-Patchwork-Id: 994417 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42qvsf1qgsz9sDJ; Thu, 8 Nov 2018 05:22:46 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gKSTR-0004fg-5n; Wed, 07 Nov 2018 18:22:41 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gKSTQ-0004fN-Km for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:22:40 +0000 Received: from mail-lj1-f197.google.com ([209.85.208.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gKSTQ-00027j-Ab for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:22:40 +0000 Received: by mail-lj1-f197.google.com with SMTP id t7-v6so3648615ljg.9 for ; Wed, 07 Nov 2018 10:22:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=vDSKbeq7QPTsBT11Jzo9D6v0bgN1ANl7NhAiHFFq4p8=; b=EmcbFhaoMMpQvKXrFBuWOaQY763/RYYgJ7JIIUUt0OOJtgVm/o43DhB6DOQSIb8izn n5foeFea2hYiaJuzuApbsnEF/SQAyA0VqmLYNpuDh83CAt5TBKvN/twR+L1tXDSzA7Sd N6DjEX9QmeYD6mqukyT0usB+j7jgw1E6iNqNnVU9EtoeZAf2iZU3g2/cTXY2NoTWcMMw M7KBCCde4IdQ2Z6+SxS3DZ8S0sZca52KAJzjPTJm/CLU6acYezVZ5kZTgGVZv8tQgXtH FSXYtiGJVejINqRyMjgdAVDkaJpvCyPefACruI0RLcczMXMRD1Bs/v+awpYzczKgMDE0 2i+g== X-Gm-Message-State: AGRZ1gIrVV+PwxItue1j1U9GX1/fGMCQ8vd8FtCeKagYEZf4BZadz5v4 E5Oeu1m5SPrKvVUutlVqdKXvnsb6K9+rmywsOB9Whf1blAVipunZ8wLakz+pmhUo7y/6wN/GmLN Nwho5q960TeV7sb9f021KD4VOaW0VC89c3JSz3rVjqhqB54KrrcBNBicjeA== X-Received: by 2002:a2e:92ca:: with SMTP id k10-v6mr805263ljh.103.1541614959285; Wed, 07 Nov 2018 10:22:39 -0800 (PST) X-Google-Smtp-Source: AJdET5c7rTwQUQhJxL819f0/sstY+PAffE7QlMHvNhUP5kbuXlaBhnOsLpfwvUcwVXgwciLw7798cwkMZTIsq6W6UPc= X-Received: by 2002:a2e:92ca:: with SMTP id k10-v6mr805238ljh.103.1541614958401; Wed, 07 Nov 2018 10:22:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Frank Heimes Date: Wed, 7 Nov 2018 19:22:27 +0100 Message-ID: Subject: [SRU][Cosmic][Bionic][PATCH 1/6] s390/qeth: sanitize strings in debug messages To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Julian Wiedmann BugLink: http://bugs.launchpad.net/bugs/1797367 s390/qeth: sanitize strings in debug messages As Documentation/s390/s390dbf.txt states quite clearly, using any pointer in sprinf-formatted s390dbf debug entries is dangerous. The pointers are dereferenced whenever the trace file is read from. So if the referenced data has a shorter life-time than the trace file, any read operation can result in a use-after-free. So rip out all hazardous use of indirect data, and replace any usage of dev_name() and such by the Bus ID number. Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller (cherry-picked from commit e19e5be8b4cafa8b3f8b0cd1b1dfe20fa0145b83) Signed-off-by: Frank Heimes --- } @@ -518,9 +517,8 @@ int qeth_l3_setrouting_v6(struct qeth_card *card) QETH_PROT_IPV6); if (rc) { card->options.route6.type = NO_ROUTER; - QETH_DBF_MESSAGE(2, "Error (0x%04x) while setting routing type" - " on %s. Type set to 'no router'.\n", rc, - QETH_CARD_IFNAME(card)); + QETH_DBF_MESSAGE(2, "Error (%#06x) while setting routing type on device %x. Type set to 'no router'.\n", + rc, CARD_DEVID(card)); } return rc; } @@ -1070,8 +1068,8 @@ qeth_diags_trace_cb(struct qeth_card *card, struct qeth_reply *reply, } break; default: - QETH_DBF_MESSAGE(2, "Unknown sniffer action (0x%04x) on %s\n", - cmd->data.diagass.action, QETH_CARD_IFNAME(card)); + QETH_DBF_MESSAGE(2, "Unknown sniffer action (%#06x) on device %x\n", + cmd->data.diagass.action, CARD_DEVID(card)); } return 0; @@ -1517,32 +1515,25 @@ static void qeth_l3_set_rx_mode(struct net_device *dev) qeth_l3_handle_promisc_mode(card); } -static const char *qeth_l3_arp_get_error_cause(int *rc) +static int qeth_l3_arp_makerc(int rc) { - switch (*rc) { - case QETH_IPA_ARP_RC_FAILED: - *rc = -EIO; - return "operation failed"; + switch (rc) { + case IPA_RC_SUCCESS: + return 0; case QETH_IPA_ARP_RC_NOTSUPP: - *rc = -EOPNOTSUPP; - return "operation not supported"; - case QETH_IPA_ARP_RC_OUT_OF_RANGE: - *rc = -EINVAL; - return "argument out of range"; case QETH_IPA_ARP_RC_Q_NOTSUPP: - *rc = -EOPNOTSUPP; - return "query operation not supported"; + return -EOPNOTSUPP; + case QETH_IPA_ARP_RC_OUT_OF_RANGE: + return -EINVAL; case QETH_IPA_ARP_RC_Q_NO_DATA: - *rc = -ENOENT; - return "no query data available"; + return -ENOENT; default: - return "unknown error"; + return -EIO; } } static int qeth_l3_arp_set_no_entries(struct qeth_card *card, int no_entries) { - int tmp; int rc; QETH_CARD_TEXT(card, 3, "arpstnoe"); @@ -1560,13 +1551,10 @@ static int qeth_l3_arp_set_no_entries(struct qeth_card *card, int no_entries) rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING, IPA_CMD_ASS_ARP_SET_NO_ENTRIES, no_entries); - if (rc) { - tmp = rc; - QETH_DBF_MESSAGE(2, "Could not set number of ARP entries on " - "%s: %s (0x%x/%d)\n", QETH_CARD_IFNAME(card), - qeth_l3_arp_get_error_cause(&rc), tmp, tmp); - } - return rc; + if (rc) + QETH_DBF_MESSAGE(2, "Could not set number of ARP entries on device %x: %#x\n", + CARD_DEVID(card), rc); + return qeth_l3_arp_makerc(rc); } static __u32 get_arp_entry_size(struct qeth_card *card, @@ -1716,7 +1704,6 @@ static int qeth_l3_query_arp_cache_info(struct qeth_card *card, { struct qeth_cmd_buffer *iob; struct qeth_ipa_cmd *cmd; - int tmp; int rc; QETH_CARD_TEXT_(card, 3, "qarpipv%i", prot); @@ -1735,15 +1722,10 @@ static int qeth_l3_query_arp_cache_info(struct qeth_card *card, rc = qeth_l3_send_ipa_arp_cmd(card, iob, QETH_SETASS_BASE_LEN+QETH_ARP_CMD_LEN, qeth_l3_arp_query_cb, (void *)qinfo); - if (rc) { - tmp = rc; - QETH_DBF_MESSAGE(2, - "Error while querying ARP cache on %s: %s " - "(0x%x/%d)\n", QETH_CARD_IFNAME(card), - qeth_l3_arp_get_error_cause(&rc), tmp, tmp); - } - - return rc; + if (rc) + QETH_DBF_MESSAGE(2, "Error while querying ARP cache on device %x: %#x\n", + CARD_DEVID(card), rc); + return qeth_l3_arp_makerc(rc); } static int qeth_l3_arp_query(struct qeth_card *card, char __user *udata) @@ -1797,8 +1779,6 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card, struct qeth_arp_cache_entry *entry) { struct qeth_cmd_buffer *iob; - char buf[16]; - int tmp; int rc; QETH_CARD_TEXT(card, 3, "arpadent"); @@ -1824,14 +1804,10 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card, sizeof(struct qeth_arp_cache_entry), (unsigned long) entry, qeth_setassparms_cb, NULL); - if (rc) { - tmp = rc; - qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf); - QETH_DBF_MESSAGE(2, "Could not add ARP entry for address %s " - "on %s: %s (0x%x/%d)\n", buf, QETH_CARD_IFNAME(card), - qeth_l3_arp_get_error_cause(&rc), tmp, tmp); - } - return rc; + if (rc) + QETH_DBF_MESSAGE(2, "Could not add ARP entry on device %x: %#x\n", + CARD_DEVID(card), rc); + return qeth_l3_arp_makerc(rc); } static int qeth_l3_arp_remove_entry(struct qeth_card *card, @@ -1839,7 +1815,6 @@ static int qeth_l3_arp_remove_entry(struct qeth_card *card, { struct qeth_cmd_buffer *iob; char buf[16] = {0, }; - int tmp; int rc; QETH_CARD_TEXT(card, 3, "arprment"); @@ -1864,21 +1839,15 @@ static int qeth_l3_arp_remove_entry(struct qeth_card *card, rc = qeth_send_setassparms(card, iob, 12, (unsigned long)buf, qeth_setassparms_cb, NULL); - if (rc) { - tmp = rc; - memset(buf, 0, 16); - qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf); - QETH_DBF_MESSAGE(2, "Could not delete ARP entry for address %s" - " on %s: %s (0x%x/%d)\n", buf, QETH_CARD_IFNAME(card), - qeth_l3_arp_get_error_cause(&rc), tmp, tmp); - } - return rc; + if (rc) + QETH_DBF_MESSAGE(2, "Could not delete ARP entry on device %x: %#x\n", + CARD_DEVID(card), rc); + return qeth_l3_arp_makerc(rc); } static int qeth_l3_arp_flush_cache(struct qeth_card *card) { int rc; - int tmp; QETH_CARD_TEXT(card, 3, "arpflush"); @@ -1894,13 +1863,10 @@ static int qeth_l3_arp_flush_cache(struct qeth_card *card) } rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING, IPA_CMD_ASS_ARP_FLUSH_CACHE, 0); - if (rc) { - tmp = rc; - QETH_DBF_MESSAGE(2, "Could not flush ARP cache on %s: %s " - "(0x%x/%d)\n", QETH_CARD_IFNAME(card), - qeth_l3_arp_get_error_cause(&rc), tmp, tmp); - } - return rc; + if (rc) + QETH_DBF_MESSAGE(2, "Could not flush ARP cache on device %x: %#x\n", + CARD_DEVID(card), rc); + return qeth_l3_arp_makerc(rc); } static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 6843bc7..884ba9d 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h @@ -87,6 +87,18 @@ struct qeth_dbf_info { #define SENSE_RESETTING_EVENT_BYTE 1 #define SENSE_RESETTING_EVENT_FLAG 0x80 +static inline u32 qeth_get_device_id(struct ccw_device *cdev) +{ + struct ccw_dev_id dev_id; + u32 id; + + ccw_device_get_id(cdev, &dev_id); + id = dev_id.devno; + id |= (u32) (dev_id.ssid << 16); + + return id; +} + /* * Common IO related definitions */ @@ -97,7 +109,8 @@ struct qeth_dbf_info { #define CARD_RDEV_ID(card) dev_name(&card->read.ccwdev->dev) #define CARD_WDEV_ID(card) dev_name(&card->write.ccwdev->dev) #define CARD_DDEV_ID(card) dev_name(&card->data.ccwdev->dev) -#define CHANNEL_ID(channel) dev_name(&channel->ccwdev->dev) +#define CCW_DEVID(cdev) (qeth_get_device_id(cdev)) +#define CARD_DEVID(card) (CCW_DEVID(CARD_RDEV(card))) /** * card stuff diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 3274f13..639ac0a 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -554,8 +554,8 @@ static int __qeth_issue_next_read(struct qeth_card *card) if (!iob) { dev_warn(&card->gdev->dev, "The qeth device driver " "failed to recover an error on the device\n"); - QETH_DBF_MESSAGE(2, "%s issue_next_read failed: no iob " - "available\n", dev_name(&card->gdev->dev)); + QETH_DBF_MESSAGE(2, "issue_next_read on device %x failed: no iob available\n", + CARD_DEVID(card)); return -ENOMEM; } qeth_setup_ccw(channel->ccw, CCW_CMD_READ, QETH_BUFSIZE, iob->data); @@ -563,8 +563,8 @@ static int __qeth_issue_next_read(struct qeth_card *card) rc = ccw_device_start(channel->ccwdev, channel->ccw, (addr_t) iob, 0, 0); if (rc) { - QETH_DBF_MESSAGE(2, "%s error in starting next read ccw! " - "rc=%i\n", dev_name(&card->gdev->dev), rc); + QETH_DBF_MESSAGE(2, "error %i on device %x when starting next read ccw!\n", + rc, CARD_DEVID(card)); atomic_set(&channel->irq_pending, 0); card->read_or_write_problem = 1; qeth_schedule_recovery(card); @@ -613,16 +613,14 @@ static void qeth_issue_ipa_msg(struct qeth_ipa_cmd *cmd, int rc, const char *ipa_name; int com = cmd->hdr.command; ipa_name = qeth_get_ipa_cmd_name(com); + if (rc) - QETH_DBF_MESSAGE(2, "IPA: %s(x%X) for %s/%s returned " - "x%X \"%s\"\n", - ipa_name, com, dev_name(&card->gdev->dev), - QETH_CARD_IFNAME(card), rc, - qeth_get_ipa_msg(rc)); + QETH_DBF_MESSAGE(2, "IPA: %s(%#x) for device %x returned %#x \"%s\"\n", + ipa_name, com, CARD_DEVID(card), rc, + qeth_get_ipa_msg(rc)); else - QETH_DBF_MESSAGE(5, "IPA: %s(x%X) for %s/%s succeeded\n", - ipa_name, com, dev_name(&card->gdev->dev), - QETH_CARD_IFNAME(card)); + QETH_DBF_MESSAGE(5, "IPA: %s(%#x) for device %x succeeded\n", + ipa_name, com, CARD_DEVID(card)); } static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card, @@ -711,7 +709,7 @@ static int qeth_check_idx_response(struct qeth_card *card, QETH_DBF_HEX(CTRL, 2, buffer, QETH_DBF_CTRL_LEN); if ((buffer[2] & 0xc0) == 0xc0) { - QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with cause code %#02x\n", + QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with cause code %#04x\n", buffer[4]); QETH_CARD_TEXT(card, 2, "ckidxres"); QETH_CARD_TEXT(card, 2, " idxterm"); @@ -972,8 +970,8 @@ static int qeth_get_problem(struct qeth_card *card, struct ccw_device *cdev, QETH_CARD_TEXT(card, 2, "CGENCHK"); dev_warn(&cdev->dev, "The qeth device driver " "failed to recover an error on the device\n"); - QETH_DBF_MESSAGE(2, "%s check on device dstat=x%x, cstat=x%x\n", - dev_name(&cdev->dev), dstat, cstat); + QETH_DBF_MESSAGE(2, "check on channel %x with dstat=%#x, cstat=%#x\n", + CCW_DEVID(cdev), dstat, cstat); print_hex_dump(KERN_WARNING, "qeth: irb ", DUMP_PREFIX_OFFSET, 16, 1, irb, 64, 1); return 1; @@ -1013,8 +1011,8 @@ static long qeth_check_irb_error(struct qeth_card *card, switch (PTR_ERR(irb)) { case -EIO: - QETH_DBF_MESSAGE(2, "%s i/o-error on device\n", - dev_name(&cdev->dev)); + QETH_DBF_MESSAGE(2, "i/o-error on channel %x\n", + CCW_DEVID(cdev)); QETH_CARD_TEXT(card, 2, "ckirberr"); QETH_CARD_TEXT_(card, 2, " rc%d", -EIO); break; @@ -1031,8 +1029,8 @@ static long qeth_check_irb_error(struct qeth_card *card, } break; default: - QETH_DBF_MESSAGE(2, "%s unknown error %ld on device\n", - dev_name(&cdev->dev), PTR_ERR(irb)); + QETH_DBF_MESSAGE(2, "unknown error %ld on channel %x\n", + PTR_ERR(irb), CCW_DEVID(cdev)); QETH_CARD_TEXT(card, 2, "ckirberr"); QETH_CARD_TEXT(card, 2, " rc???"); } @@ -1114,9 +1112,9 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, dev_warn(&channel->ccwdev->dev, "The qeth device driver failed to recover " "an error on the device\n"); - QETH_DBF_MESSAGE(2, "%s sense data available. cstat " - "0x%X dstat 0x%X\n", - dev_name(&channel->ccwdev->dev), cstat, dstat); + QETH_DBF_MESSAGE(2, "sense data available on channel %x: cstat %#X dstat %#X\n", + CCW_DEVID(channel->ccwdev), cstat, + dstat); print_hex_dump(KERN_WARNING, "qeth: irb ", DUMP_PREFIX_OFFSET, 16, 1, irb, 32, 1); print_hex_dump(KERN_WARNING, "qeth: sense data ", @@ -1890,8 +1888,8 @@ static int qeth_idx_activate_channel(struct qeth_card *card, if (channel->state != CH_STATE_ACTIVATING) { dev_warn(&channel->ccwdev->dev, "The qeth device driver" " failed to recover an error on the device\n"); - QETH_DBF_MESSAGE(2, "%s IDX activate timed out\n", - dev_name(&channel->ccwdev->dev)); + QETH_DBF_MESSAGE(2, "IDX activate timed out on channel %x\n", + CCW_DEVID(channel->ccwdev)); QETH_DBF_TEXT_(SETUP, 2, "2err%d", -ETIME); return -ETIME; } @@ -1926,17 +1924,15 @@ static void qeth_idx_write_cb(struct qeth_card *card, "The adapter is used exclusively by another " "host\n"); else - QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel:" - " negative reply\n", - dev_name(&channel->ccwdev->dev)); + QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel %x: negative reply\n", + CCW_DEVID(channel->ccwdev)); goto out; } memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2); if ((temp & ~0x0100) != qeth_peer_func_level(card->info.func_level)) { - QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel: " - "function level mismatch (sent: 0x%x, received: " - "0x%x)\n", dev_name(&channel->ccwdev->dev), - card->info.func_level, temp); + QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel %x: function level mismatch (sent: %#x, received: %#x)\n", + CCW_DEVID(channel->ccwdev), + card->info.func_level, temp); goto out; } channel->state = CH_STATE_UP; @@ -1973,9 +1969,8 @@ static void qeth_idx_read_cb(struct qeth_card *card, "insufficient authorization\n"); break; default: - QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel:" - " negative reply\n", - dev_name(&channel->ccwdev->dev)); + QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel %x: negative reply\n", + CCW_DEVID(channel->ccwdev)); } QETH_CARD_TEXT_(card, 2, "idxread%c", QETH_IDX_ACT_CAUSE_CODE(iob->data)); @@ -1984,10 +1979,9 @@ static void qeth_idx_read_cb(struct qeth_card *card, memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2); if (temp != qeth_peer_func_level(card->info.func_level)) { - QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel: function " - "level mismatch (sent: 0x%x, received: 0x%x)\n", - dev_name(&channel->ccwdev->dev), - card->info.func_level, temp); + QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel %x: function level mismatch (sent: %#x, received: %#x)\n", + CCW_DEVID(channel->ccwdev), + card->info.func_level, temp); goto out; } memcpy(&card->token.issuer_rm_r, @@ -2096,9 +2090,8 @@ int qeth_send_control_data(struct qeth_card *card, int len, (addr_t) iob, 0, 0, event_timeout); spin_unlock_irq(get_ccwdev_lock(channel->ccwdev)); if (rc) { - QETH_DBF_MESSAGE(2, "%s qeth_send_control_data: " - "ccw_device_start rc = %i\n", - dev_name(&channel->ccwdev->dev), rc); + QETH_DBF_MESSAGE(2, "qeth_send_control_data on device %x: ccw_device_start rc = %i\n", + CARD_DEVID(card), rc); QETH_CARD_TEXT_(card, 2, " err%d", rc); spin_lock_irq(&card->lock); list_del_init(&reply->list); @@ -2853,8 +2846,8 @@ struct qeth_cmd_buffer *qeth_get_ipacmd_buffer(struct qeth_card *card, } else { dev_warn(&card->gdev->dev, "The qeth driver ran out of channel command buffers\n"); - QETH_DBF_MESSAGE(1, "%s The qeth driver ran out of channel command buffers", - dev_name(&card->gdev->dev)); + QETH_DBF_MESSAGE(1, "device %x ran out of channel command buffers", + CARD_DEVID(card)); } return iob; @@ -2989,10 +2982,9 @@ static int qeth_query_ipassists_cb(struct qeth_card *card, return 0; default: if (cmd->hdr.return_code) { - QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Unhandled " - "rc=%d\n", - dev_name(&card->gdev->dev), - cmd->hdr.return_code); + QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on device %x: Unhandled rc=%#x\n", + CARD_DEVID(card), + cmd->hdr.return_code); return 0; } } @@ -3004,8 +2996,8 @@ static int qeth_query_ipassists_cb(struct qeth_card *card, card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported; card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled; } else - QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Flawed LIC detected" - "\n", dev_name(&card->gdev->dev)); + QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on device %x: Flawed LIC detected\n", + CARD_DEVID(card)); return 0; } @@ -4297,10 +4289,9 @@ static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card, cmd->data.setadapterparms.hdr.return_code); if (cmd->data.setadapterparms.hdr.return_code != SET_ACCESS_CTRL_RC_SUCCESS) - QETH_DBF_MESSAGE(3, "ERR:SET_ACCESS_CTRL(%s,%d)==%d\n", - card->gdev->dev.kobj.name, - access_ctrl_req->subcmd_code, - cmd->data.setadapterparms.hdr.return_code); + QETH_DBF_MESSAGE(3, "ERR:SET_ACCESS_CTRL(%#x) on device %x: %#x\n", + access_ctrl_req->subcmd_code, CARD_DEVID(card), + cmd->data.setadapterparms.hdr.return_code); switch (cmd->data.setadapterparms.hdr.return_code) { case SET_ACCESS_CTRL_RC_SUCCESS: if (card->options.isolation == ISOLATION_MODE_NONE) { @@ -4312,14 +4303,14 @@ static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card, } break; case SET_ACCESS_CTRL_RC_ALREADY_NOT_ISOLATED: - QETH_DBF_MESSAGE(2, "%s QDIO data connection isolation already " - "deactivated\n", dev_name(&card->gdev->dev)); + QETH_DBF_MESSAGE(2, "QDIO data connection isolation on device %x already deactivated\n", + CARD_DEVID(card)); if (fallback) card->options.isolation = card->options.prev_isolation; break; case SET_ACCESS_CTRL_RC_ALREADY_ISOLATED: - QETH_DBF_MESSAGE(2, "%s QDIO data connection isolation already" - " activated\n", dev_name(&card->gdev->dev)); + QETH_DBF_MESSAGE(2, "QDIO data connection isolation on device %x already activated\n", + CARD_DEVID(card)); if (fallback) card->options.isolation = card->options.prev_isolation; break; @@ -4405,10 +4396,8 @@ int qeth_set_access_ctrl_online(struct qeth_card *card, int fallback) rc = qeth_setadpparms_set_access_ctrl(card, card->options.isolation, fallback); if (rc) { - QETH_DBF_MESSAGE(3, - "IPA(SET_ACCESS_CTRL,%s,%d) sent failed\n", - card->gdev->dev.kobj.name, - rc); + QETH_DBF_MESSAGE(3, "IPA(SET_ACCESS_CTRL(%d) on device %x: sent failed\n", + rc, CARD_DEVID(card)); rc = -EOPNOTSUPP; } } else if (card->options.isolation != ISOLATION_MODE_NONE) { @@ -4634,8 +4623,8 @@ static int qeth_snmp_command(struct qeth_card *card, char __user *udata) rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len, qeth_snmp_command_cb, (void *)&qinfo); if (rc) - QETH_DBF_MESSAGE(2, "SNMP command failed on %s: (0x%x)\n", - QETH_CARD_IFNAME(card), rc); + QETH_DBF_MESSAGE(2, "SNMP command failed on device %x: (%#x)\n", + CARD_DEVID(card), rc); else { if (copy_to_user(udata, qinfo.udata, qinfo.udata_len)) rc = -EFAULT; @@ -4869,8 +4858,8 @@ static void qeth_determine_capabilities(struct qeth_card *card) rc = qeth_read_conf_data(card, (void **) &prcd, &length); if (rc) { - QETH_DBF_MESSAGE(2, "%s qeth_read_conf_data returned %i\n", - dev_name(&card->gdev->dev), rc); + QETH_DBF_MESSAGE(2, "qeth_read_conf_data on device %x returned %i\n", + CARD_DEVID(card), rc); QETH_DBF_TEXT_(SETUP, 2, "5err%d", rc); goto out_offline; } @@ -5096,8 +5085,8 @@ int qeth_core_hardsetup_card(struct qeth_card *card) qeth_update_from_chp_desc(card); retry: if (retries < 3) - QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", - dev_name(&card->gdev->dev)); + QETH_DBF_MESSAGE(2, "Retrying to do IDX activates on device %x.\n", + CARD_DEVID(card)); rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); ccw_device_set_offline(CARD_DDEV(card)); ccw_device_set_offline(CARD_WDEV(card)); @@ -5201,8 +5190,8 @@ int qeth_core_hardsetup_card(struct qeth_card *card) out: dev_warn(&card->gdev->dev, "The qeth device driver failed to recover " "an error on the device\n"); - QETH_DBF_MESSAGE(2, "%s Initialization in hardsetup failed! rc=%d\n", - dev_name(&card->gdev->dev), rc); + QETH_DBF_MESSAGE(2, "Initialization for device %x failed in hardsetup! rc=%d\n", + CARD_DEVID(card), rc); return rc; } EXPORT_SYMBOL_GPL(qeth_core_hardsetup_card); diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 23aaf37..5b67fd1 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -146,11 +146,11 @@ static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac) QETH_CARD_TEXT(card, 2, "L2Wmac"); rc = qeth_l2_send_setdelmac(card, mac, cmd); if (rc == -EEXIST) - QETH_DBF_MESSAGE(2, "MAC %pM already registered on %s\n", - mac, QETH_CARD_IFNAME(card)); + QETH_DBF_MESSAGE(2, "MAC already registered on device %x\n", + CARD_DEVID(card)); else if (rc) - QETH_DBF_MESSAGE(2, "Failed to register MAC %pM on %s: %d\n", - mac, QETH_CARD_IFNAME(card), rc); + QETH_DBF_MESSAGE(2, "Failed to register MAC on device %x: %d\n", + CARD_DEVID(card), rc); return rc; } @@ -163,8 +163,8 @@ static int qeth_l2_remove_mac(struct qeth_card *card, u8 *mac) QETH_CARD_TEXT(card, 2, "L2Rmac"); rc = qeth_l2_send_setdelmac(card, mac, cmd); if (rc) - QETH_DBF_MESSAGE(2, "Failed to delete MAC %pM on %s: %d\n", - mac, QETH_CARD_IFNAME(card), rc); + QETH_DBF_MESSAGE(2, "Failed to delete MAC on device %u: %d\n", + CARD_DEVID(card), rc); return rc; } @@ -260,9 +260,9 @@ static int qeth_l2_send_setdelvlan_cb(struct qeth_card *card, QETH_CARD_TEXT(card, 2, "L2sdvcb"); if (cmd->hdr.return_code) { - QETH_DBF_MESSAGE(2, "Error in processing VLAN %i on %s: 0x%x.\n", + QETH_DBF_MESSAGE(2, "Error in processing VLAN %u on device %x: %#x.\n", cmd->data.setdelvlan.vlan_id, - QETH_CARD_IFNAME(card), cmd->hdr.return_code); + CARD_DEVID(card), cmd->hdr.return_code); QETH_CARD_TEXT_(card, 2, "L2VL%4x", cmd->hdr.command); QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code); } @@ -455,8 +455,8 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) rc = qeth_vm_request_mac(card); if (!rc) goto out; - QETH_DBF_MESSAGE(2, "z/VM MAC Service failed on device %s: x%x\n", - CARD_BUS_ID(card), rc); + QETH_DBF_MESSAGE(2, "z/VM MAC Service failed on device %x: %#x\n", + CARD_DEVID(card), rc); QETH_DBF_TEXT_(SETUP, 2, "err%04x", rc); /* fall back to alternative mechanism: */ } @@ -468,8 +468,8 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) rc = qeth_setadpparms_change_macaddr(card); if (!rc) goto out; - QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device %s: x%x\n", - CARD_BUS_ID(card), rc); + QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device %x: %#x\n", + CARD_DEVID(card), rc); QETH_DBF_TEXT_(SETUP, 2, "1err%04x", rc); /* fall back once more: */ } diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 0b161cc..ffa2aa1 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -494,9 +494,8 @@ int qeth_l3_setrouting_v4(struct qeth_card *card) QETH_PROT_IPV4); if (rc) { card->options.route4.type = NO_ROUTER; - QETH_DBF_MESSAGE(2, "Error (0x%04x) while setting routing type" - " on %s. Type set to 'no router'.\n", rc, - QETH_CARD_IFNAME(card)); + QETH_DBF_MESSAGE(2, "Error (%#06x) while setting routing type on device %x. Type set to 'no router'.\n", + rc, CARD_DEVID(card)); } return rc; From patchwork Wed Nov 7 18:23:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Heimes X-Patchwork-Id: 994418 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42qvtb1LnGz9s7h; Thu, 8 Nov 2018 05:23:35 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gKSUE-0004mQ-Ll; Wed, 07 Nov 2018 18:23:30 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gKSUD-0004mK-R9 for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:23:29 +0000 Received: from mail-lj1-f198.google.com ([209.85.208.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gKSUD-00029E-HZ for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:23:29 +0000 Received: by mail-lj1-f198.google.com with SMTP id b25-v6so3076033ljj.8 for ; Wed, 07 Nov 2018 10:23:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=UDeyxh+76AP0FUogRCz5RaRHI3+BpKuY3ftLVbM2r2k=; b=gvy9EKO2uXAz6WdIYbtrfIytNJiMzHnKIqfDMmFyX25o7tygZScvHZAGUDWK3t5Eel Y/nMsls/Z6qugi51MWitEsHpxjof80pVK1W4UsLF9MpheLkmZMNbnlW25b0OqFiyDyvx xOgSBSgNN5A1169UCnuOPMXmFD0Jzq90s52WXRoBKObm5VHTvUFNTg+GD0XZ2agHnsre +XVoGw3hiseUr92Z2hDFRwH0cQLN/IcKrbnVE42noXNi3BlBIcZQTdsVocIooNbEAhwW zkOVU9rmgsPjpOn/RFtoOay3+Fju0Jz0nTglPVKFlk0opw/Je7oVelBQUGQvJ2auJx5b us8w== X-Gm-Message-State: AGRZ1gLfIRu92mwyR/ovinZzzVGrBZm1LCkWXFehk6i9bqdPgfhbJOC1 RQLGxXL84kg6HYLWIQ83FTztAZ4wr3/TDbWWVb8OmUgQGixDSr3qgTFX850OtwA+EReEMJ4GNLz xMo8zNkeCEurauEzyc3qahdeTvY8+63oZo1E26iCyU+OJ2qrIYNfpcNov0g== X-Received: by 2002:a2e:87da:: with SMTP id v26-v6mr906106ljj.13.1541615008235; Wed, 07 Nov 2018 10:23:28 -0800 (PST) X-Google-Smtp-Source: AJdET5dZa1kIBi702Z8N1SicLUmjGNU+T8USJiHX1JSE5MYLFS4j6wn5vfCp2R7tQ+OooW7119FQqblYX05YPzedl58= X-Received: by 2002:a2e:87da:: with SMTP id v26-v6mr906092ljj.13.1541615007872; Wed, 07 Nov 2018 10:23:27 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Frank Heimes Date: Wed, 7 Nov 2018 19:23:16 +0100 Message-ID: Subject: [SRU][Cosmic][Bionic][PATCH 2/6] s390/qeth: reduce hard-coded access to ccw channels To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Julian Wiedmann BugLink: http://bugs.launchpad.net/bugs/1797367 s390/qeth: reduce hard-coded access to ccw channels Where possible use accessor macros and local pointers to access the ccw channels. This makes it less likely to miss a spot. Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller (cherry-picked from commit 750b162598ec5b65cdb44d18f050b45cb7f8d31b) Signed-off-by: Frank Heimes diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index da9ac21..e459894 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -534,13 +534,14 @@ static inline int qeth_is_cq(struct qeth_card *card, unsigned int queue) static int __qeth_issue_next_read(struct qeth_card *card) { - int rc; + struct qeth_channel *channel = &card->read; struct qeth_cmd_buffer *iob; + int rc; QETH_CARD_TEXT(card, 5, "issnxrd"); - if (card->read.state != CH_STATE_UP) + if (channel->state != CH_STATE_UP) return -EIO; - iob = qeth_get_buffer(&card->read); + iob = qeth_get_buffer(channel); if (!iob) { dev_warn(&card->gdev->dev, "The qeth device driver " "failed to recover an error on the device\n"); @@ -548,14 +549,14 @@ static int __qeth_issue_next_read(struct qeth_card *card) "available\n", dev_name(&card->gdev->dev)); return -ENOMEM; } - qeth_setup_ccw(&card->read, iob->data, QETH_BUFSIZE); + qeth_setup_ccw(channel, iob->data, QETH_BUFSIZE); QETH_CARD_TEXT(card, 6, "noirqpnd"); - rc = ccw_device_start(card->read.ccwdev, &card->read.ccw, + rc = ccw_device_start(channel->ccwdev, &channel->ccw, (addr_t) iob, 0, 0); if (rc) { QETH_DBF_MESSAGE(2, "%s error in starting next read ccw! " "rc=%i\n", dev_name(&card->gdev->dev), rc); - atomic_set(&card->read.irq_pending, 0); + atomic_set(&channel->irq_pending, 0); card->read_or_write_problem = 1; qeth_schedule_recovery(card); wake_up(&card->wait_q); @@ -1987,20 +1988,20 @@ static void qeth_idx_write_cb(struct qeth_channel *channel, if (!(QETH_IS_IDX_ACT_POS_REPLY(iob->data))) { if (QETH_IDX_ACT_CAUSE_CODE(iob->data) == QETH_IDX_ACT_ERR_EXCL) - dev_err(&card->write.ccwdev->dev, + dev_err(&channel->ccwdev->dev, "The adapter is used exclusively by another " "host\n"); else QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel:" " negative reply\n", - dev_name(&card->write.ccwdev->dev)); + dev_name(&channel->ccwdev->dev)); goto out; } memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2); if ((temp & ~0x0100) != qeth_peer_func_level(card->info.func_level)) { QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel: " "function level mismatch (sent: 0x%x, received: " - "0x%x)\n", dev_name(&card->write.ccwdev->dev), + "0x%x)\n", dev_name(&channel->ccwdev->dev), card->info.func_level, temp); goto out; } @@ -2028,20 +2029,20 @@ static void qeth_idx_read_cb(struct qeth_channel *channel, if (!(QETH_IS_IDX_ACT_POS_REPLY(iob->data))) { switch (QETH_IDX_ACT_CAUSE_CODE(iob->data)) { case QETH_IDX_ACT_ERR_EXCL: - dev_err(&card->write.ccwdev->dev, + dev_err(&channel->ccwdev->dev, "The adapter is used exclusively by another " "host\n"); break; case QETH_IDX_ACT_ERR_AUTH: case QETH_IDX_ACT_ERR_AUTH_USER: - dev_err(&card->read.ccwdev->dev, + dev_err(&channel->ccwdev->dev, "Setting the device online failed because of " "insufficient authorization\n"); break; default: QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel:" " negative reply\n", - dev_name(&card->read.ccwdev->dev)); + dev_name(&channel->ccwdev->dev)); } QETH_CARD_TEXT_(card, 2, "idxread%c", QETH_IDX_ACT_CAUSE_CODE(iob->data)); @@ -2052,7 +2053,7 @@ static void qeth_idx_read_cb(struct qeth_channel *channel, if (temp != qeth_peer_func_level(card->info.func_level)) { QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel: function " "level mismatch (sent: 0x%x, received: 0x%x)\n", - dev_name(&card->read.ccwdev->dev), + dev_name(&channel->ccwdev->dev), card->info.func_level, temp); goto out; } @@ -2069,7 +2070,7 @@ static void qeth_idx_read_cb(struct qeth_channel *channel, void qeth_prepare_control_data(struct qeth_card *card, int len, struct qeth_cmd_buffer *iob) { - qeth_setup_ccw(&card->write, iob->data, len); + qeth_setup_ccw(iob->channel, iob->data, len); iob->callback = qeth_release_buffer; memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data), @@ -2116,6 +2117,7 @@ int qeth_send_control_data(struct qeth_card *card, int len, unsigned long cb_cmd), void *reply_param) { + struct qeth_channel *channel = iob->channel; int rc; unsigned long flags; struct qeth_reply *reply = NULL; @@ -2125,7 +2127,7 @@ int qeth_send_control_data(struct qeth_card *card, int len, QETH_CARD_TEXT(card, 2, "sendctl"); if (card->read_or_write_problem) { - qeth_release_buffer(iob->channel, iob); + qeth_release_buffer(channel, iob); return -EIO; } reply = qeth_alloc_reply(card); @@ -2137,7 +2139,7 @@ int qeth_send_control_data(struct qeth_card *card, int len, init_waitqueue_head(&reply->wait_q); - while (atomic_cmpxchg(&card->write.irq_pending, 0, 1)) ; + while (atomic_cmpxchg(&channel->irq_pending, 0, 1)) ; if (IS_IPA(iob->data)) { cmd = __ipa_cmd(iob); @@ -2157,21 +2159,21 @@ int qeth_send_control_data(struct qeth_card *card, int len, timeout = jiffies + event_timeout; QETH_CARD_TEXT(card, 6, "noirqpnd"); - spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); - rc = ccw_device_start_timeout(CARD_WDEV(card), &card->write.ccw, + spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); + rc = ccw_device_start_timeout(channel->ccwdev, &channel->ccw, (addr_t) iob, 0, 0, event_timeout); - spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags); + spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); if (rc) { QETH_DBF_MESSAGE(2, "%s qeth_send_control_data: " "ccw_device_start rc = %i\n", - dev_name(&card->write.ccwdev->dev), rc); + dev_name(&channel->ccwdev->dev), rc); QETH_CARD_TEXT_(card, 2, " err%d", rc); spin_lock_irqsave(&card->lock, flags); list_del_init(&reply->list); qeth_put_reply(reply); spin_unlock_irqrestore(&card->lock, flags); - qeth_release_buffer(iob->channel, iob); - atomic_set(&card->write.irq_pending, 0); + qeth_release_buffer(channel, iob); + atomic_set(&channel->irq_pending, 0); wake_up(&card->wait_q); return rc; } diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index efb84a7..a86ba45 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -1239,25 +1239,26 @@ EXPORT_SYMBOL_GPL(qeth_l2_discipline); static int qeth_osn_send_control_data(struct qeth_card *card, int len, struct qeth_cmd_buffer *iob) { + struct qeth_channel *channel = iob->channel; unsigned long flags; int rc = 0; QETH_CARD_TEXT(card, 5, "osndctrd"); wait_event(card->wait_q, - atomic_cmpxchg(&card->write.irq_pending, 0, 1) == 0); + atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0); qeth_prepare_control_data(card, len, iob); QETH_CARD_TEXT(card, 6, "osnoirqp"); - spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); - rc = ccw_device_start_timeout(CARD_WDEV(card), &card->write.ccw, + spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); + rc = ccw_device_start_timeout(channel->ccwdev, &channel->ccw, (addr_t) iob, 0, 0, QETH_IPA_TIMEOUT); - spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags); + spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); if (rc) { QETH_DBF_MESSAGE(2, "qeth_osn_send_control_data: " "ccw_device_start rc = %i\n", rc); QETH_CARD_TEXT_(card, 2, " err%d", rc); - qeth_release_buffer(iob->channel, iob); - atomic_set(&card->write.irq_pending, 0); + qeth_release_buffer(channel, iob); + atomic_set(&channel->irq_pending, 0); wake_up(&card->wait_q); } return rc; From patchwork Wed Nov 7 18:24:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Heimes X-Patchwork-Id: 994419 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42qvvl6lvNz9sDT; Thu, 8 Nov 2018 05:24:35 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gKSVE-0004s5-0l; Wed, 07 Nov 2018 18:24:32 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gKSVD-0004rt-7I for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:24:31 +0000 Received: from mail-lj1-f200.google.com ([209.85.208.200]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gKSVC-0002C9-V8 for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:24:31 +0000 Received: by mail-lj1-f200.google.com with SMTP id h12-v6so5164291ljb.12 for ; Wed, 07 Nov 2018 10:24:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=mQNiPJw7KANFhrszz1LcxBjePWzs9GSyKl+8NL8g0Y4=; b=OGvOLVDbfVJEnYpyo7NAIHh1DihZcoeHduSjuyDraW29rZ95ouzY23WjKubsyQsXni rxFkbYEf719mfza6+JLhzZ6/S2V70HVHjlK3R5EbBto1+bU8VvXw2rbWlTtoHI/CHE+z 2JuGrxp8rrB+RN31BEgoPl+bwqVAQ8064WLA1FXvFxHPBBQKlBaq/GKB1FbiJZnDkxHS 165Pik1l/xaPnJeHKYKyVkNur2X0f9DmzSmBS4OQpBX4cJB8PsU6+tSwavR7S+uozC9X +9/zvE5I+3MR0QgMq54y7eKZ8hWgDgu5IJ0fDj5V+AI9SFk+gRuOSrsfgTiQxsrzHoOx qlRQ== X-Gm-Message-State: AGRZ1gIV/CnexfwnbVgd3Hz3aIPjNwjUa83B7X8kL3X9TH68aH7aOJQB ye01hEOBLQ8WdMCihdjLqZFi3XHWnr+3h4detJNMEZ4nS517DvJ6lmRopib14k+tn8fuPud56XC M5rs/Fmb0VxuL16spFUz7blMKS1HqY9JT4SWp1QIdWuciyUU4vLzNK38hRQ== X-Received: by 2002:a19:be16:: with SMTP id o22mr788870lff.22.1541615069996; Wed, 07 Nov 2018 10:24:29 -0800 (PST) X-Google-Smtp-Source: AJdET5d0DXxlwbxX1qRqcGNS2tcdIG7N+mLvtfHahp5wISYUVxGFWFEd1n0S7Ss3Lqd9XC2z3tG8NgC92MmUCCxbhE4= X-Received: by 2002:a19:be16:: with SMTP id o22mr788859lff.22.1541615069692; Wed, 07 Nov 2018 10:24:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Frank Heimes Date: Wed, 7 Nov 2018 19:24:18 +0100 Message-ID: Subject: [SRU][Cosmic][Bionic][PATCH 3/6] s390/qeth: remove outdated portname debug msg To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Julian Wiedmann BugLink: http://bugs.launchpad.net/bugs/1797367 s390/qeth: remove outdated portname debug msg The 'portname' attribute is deprecated and setting it has no effect. Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller (cherry-picked from commit d857e11193a24d6623bb562e9b26cde582bd877f) Signed-off-by: Frank Heimes --- QETH_CARD_TEXT_(card, 2, " rc%d", -EIO); diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index d4cb0ee..d884b39 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -708,11 +708,8 @@ static int qeth_check_idx_response(struct qeth_card *card, QETH_DBF_HEX(CTRL, 2, buffer, QETH_DBF_CTRL_LEN); if ((buffer[2] & 0xc0) == 0xc0) { - QETH_DBF_MESSAGE(2, "received an IDX TERMINATE " - "with cause code 0x%02x%s\n", - buffer[4], - ((buffer[4] == 0x22) ? - " -- try another portname" : "")); + QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with cause code %#02x\n", + buffer[4]); QETH_CARD_TEXT(card, 2, "ckidxres"); QETH_CARD_TEXT(card, 2, " idxterm"); From patchwork Wed Nov 7 18:25:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Heimes X-Patchwork-Id: 994420 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42qvwd4PyQz9s7h; Thu, 8 Nov 2018 05:25:21 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gKSVx-0004yj-BG; Wed, 07 Nov 2018 18:25:17 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gKSVw-0004yP-LK for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:25:16 +0000 Received: from mail-lf1-f70.google.com ([209.85.167.70]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gKSVw-0002EW-D4 for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:25:16 +0000 Received: by mail-lf1-f70.google.com with SMTP id g1-v6so2149577lfl.23 for ; Wed, 07 Nov 2018 10:25:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=ibEyqwKysOAOgBcEFvotYcIk8DUOZDghrx2SjHkOJVc=; b=DDLNfH3QFebtfI9r+S0EWsWxuxuF3J5nKeGc6LlkCL/r2EKb4z3ESFaCzHbSaVTBki Esb5bjppFaLJVZewcK0fWGAtn8BfBuU/nrZGx8Q9lqz2mVZzHFc8gK3RmqOQ0bb0Itwq +EjRiyKeOwsySlCAyP40RDcIW7PeklowTe0fStIwaJhkbveM3V/DL8z8OQwqjKm3eOHA 3ATB7Y57NKbX+3PMUZvK7sUOB5Ue+iF0H1ZRLoWZuEePCe+Blz3gPO5MkZ29HkF8R8ea E1yzeOyq+HDwDIfCe1qry54qvVC2IgnSgBg45w/CJXODISfgky7ZtgHHw1dF5qKL+Rpd 11ng== X-Gm-Message-State: AGRZ1gJEeeEVjOmihvqqweFL+SXyzf8qgZwsmlbKIJSR9SCBicVBRIbZ GmbkAjlA0YmNhKREd/BeJZ6hjnP9TButTG6OyIeVznC+GdO5NQtnkIOhGz1CHax0q4VKZOnR8r2 khhF1tcViutHxaz9baeZ/kpvspUzzkYGx+f5lnm+/V1G+LL7V+Do2ZQ7n6w== X-Received: by 2002:a2e:4503:: with SMTP id s3-v6mr882380lja.44.1541615115445; Wed, 07 Nov 2018 10:25:15 -0800 (PST) X-Google-Smtp-Source: AJdET5diP1NGgy6zzWiEKNWG4f0hxX4yj8aEWDbG7uE8STjt3xD0fiFav6zLiH7cPmLplz7AwteE6ChWcNhXdNqP5TI= X-Received: by 2002:a2e:4503:: with SMTP id s3-v6mr882367lja.44.1541615115160; Wed, 07 Nov 2018 10:25:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Frank Heimes Date: Wed, 7 Nov 2018 19:25:04 +0100 Message-ID: Subject: [SRU][Cosmic][Bionic][PATCH 4/6] s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6] To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Vasily Gorbik BugLink: http://bugs.launchpad.net/bugs/1797367 s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6] *ether_addr*_64bits functions have been introduced to optimize performance critical paths, which access 6-byte ethernet address as u64 value to get "nice" assembly. A harmless hack works nicely on ethernet addresses shoved into a structure or a larger buffer, until busted by Kasan on smth like plain (u8 *)[6]. qeth_l2_set_mac_address calls qeth_l2_remove_mac passing u8 old_addr[ETH_ALEN] as an argument. Adding/removing macs for an ethernet adapter is not that performance critical. Moreover is_multicast_ether_addr_64bits itself on s390 is not faster than is_multicast_ether_addr: is_multicast_ether_addr(%r2) -> %r2 llc %r2,0(%r2) risbg %r2,%r2,63,191,0 is_multicast_ether_addr_64bits(%r2) -> %r2 llgc %r2,0(%r2) risbg %r2,%r2,63,191,0 So, let's just use is_multicast_ether_addr instead of is_multicast_ether_addr_64bits. Fixes: bcacfcbc82b4 ("s390/qeth: fix MAC address update sequence") Reviewed-by: Julian Wiedmann Signed-off-by: Vasily Gorbik Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller (cherry-picked from commit 9d0a58fb9747afd27d490c02a97889a1b59f6be4) Signed-off-by: Frank Heimes --- @@ -157,7 +157,7 @@ static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac) static int qeth_l2_remove_mac(struct qeth_card *card, u8 *mac) { - enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ? + enum qeth_ipa_cmds cmd = is_multicast_ether_addr(mac) ? IPA_CMD_DELGMAC : IPA_CMD_DELVMAC; int rc; diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 7daf125..5464515 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -140,7 +140,7 @@ static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac) static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac) { - enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ? + enum qeth_ipa_cmds cmd = is_multicast_ether_addr(mac) ? IPA_CMD_SETGMAC : IPA_CMD_SETVMAC; int rc; From patchwork Wed Nov 7 18:25:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Heimes X-Patchwork-Id: 994421 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42qvxS3hHGz9s7h; Thu, 8 Nov 2018 05:26:04 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gKSWd-0005Do-Py; Wed, 07 Nov 2018 18:25:59 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gKSWc-0005CX-2A for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:25:58 +0000 Received: from mail-lj1-f200.google.com ([209.85.208.200]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gKSWb-0002G9-Pv for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:25:57 +0000 Received: by mail-lj1-f200.google.com with SMTP id v74-v6so4195307lje.6 for ; Wed, 07 Nov 2018 10:25:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=0j/J3CjUcyik4TXSxULES1slOHKC21/PSqlx65QdZjQ=; b=BY8sPsw1hiSbSJd3QgEU7Mf6fIHpBtRFZ/ExHkUA45x1CkweN6C+xDCil+D2x22bqJ SiZ0we5crDfsX0cpZkLs+rMYiWOJjKTYYoDujNEcOwM2sksedH2NC8uMWcyuU0yZrEcL L7x6W9d2Agt0KNLLANSOOd2IhAYyVsaZkNmi+35xTG/7lw6aiuUrzt3KBh1NcvSL7//8 U+5rSph9EgUNYln66M5Vme22qJVt+sNQR9btZeXuomIINxjfrUA7AwlJFXdfyTG3PeoA +P8NhM8zubcXnHjVCKjVRdFoXrfHLygonTvFrYuAHtzf6x2QyHL/nS0zhfYeV7Ldq1Yr 1EbQ== X-Gm-Message-State: AGRZ1gJUU2JJDy4XqDEv3axZq0YQroyriMD2iw4+TXCAJO0hg3wdbWX5 VAN6+Wx/CddJONHD2410Uc68/vvmdWJMWcEgUgqlODHThM59AioJCkPSAx3YaWGsxRmsAr3n8Ar 886uunUC2i9WDzxorRefzTon3UdZRdwZClIWucvGH9fsME5P9DUNeepYQwA== X-Received: by 2002:a2e:1603:: with SMTP id w3-v6mr843936ljd.33.1541615156945; Wed, 07 Nov 2018 10:25:56 -0800 (PST) X-Google-Smtp-Source: AJdET5cSvdeABWJh7I00Q1Etw5OXQl0D25+MOC0cl3AX3QkzqhIXYswtHfLMlfHFiIrK1qX7Ll5Bm56iHRvuKDc6UJ8= X-Received: by 2002:a2e:1603:: with SMTP id w3-v6mr843927ljd.33.1541615156634; Wed, 07 Nov 2018 10:25:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Frank Heimes Date: Wed, 7 Nov 2018 19:25:45 +0100 Message-ID: Subject: [SRU][Cosmic][Bionic][PATCH 5/6] s390/qeth: consolidate qeth MAC address helpers To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Julian Wiedmann BugLink: http://bugs.launchpad.net/bugs/1797367 s390/qeth: consolidate qeth MAC address helpers For adding/removing a MAC address, use just one helper each that handles both unicast and multicast. Saves one level of indirection for multicast addresses, while improving the error reporting for unicast addresses. Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller (cherry-picked from commit 8174aa8aceefd3f97aebe6cc428cc3fd7b6ac2fa) Signed-off-by: Frank Heimes --- struct qeth_mac *mac; @@ -639,12 +628,12 @@ static void qeth_l2_set_rx_mode(struct net_device *dev) hash_for_each_safe(card->mac_htable, i, tmp, mac, hnode) { if (mac->disp_flag == QETH_DISP_ADDR_DELETE) { - qeth_l2_remove_mac(card, mac); + qeth_l2_remove_mac(card, mac->mac_addr); hash_del(&mac->hnode); kfree(mac); } else if (mac->disp_flag == QETH_DISP_ADDR_ADD) { - rc = qeth_l2_write_mac(card, mac); + rc = qeth_l2_write_mac(card, mac->mac_addr); if (rc) { hash_del(&mac->hnode); kfree(mac); diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 88dd929..94079e2 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -156,48 +156,37 @@ static int qeth_l2_send_delmac(struct qeth_card *card, __u8 *mac) return rc; } -static int qeth_l2_send_setgroupmac(struct qeth_card *card, __u8 *mac) +static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac) { + enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ? + IPA_CMD_SETGMAC : IPA_CMD_SETVMAC; int rc; - QETH_CARD_TEXT(card, 2, "L2Sgmac"); - rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETGMAC); + QETH_CARD_TEXT(card, 2, "L2Wmac"); + rc = qeth_l2_send_setdelmac(card, mac, cmd); if (rc == -EEXIST) - QETH_DBF_MESSAGE(2, "Group MAC %pM already existing on %s\n", - mac, QETH_CARD_IFNAME(card)); + QETH_DBF_MESSAGE(2, "MAC %pM already registered on %s\n", + mac, QETH_CARD_IFNAME(card)); else if (rc) - QETH_DBF_MESSAGE(2, "Could not set group MAC %pM on %s: %d\n", - mac, QETH_CARD_IFNAME(card), rc); + QETH_DBF_MESSAGE(2, "Failed to register MAC %pM on %s: %d\n", + mac, QETH_CARD_IFNAME(card), rc); return rc; } -static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac) +static int qeth_l2_remove_mac(struct qeth_card *card, u8 *mac) { + enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ? + IPA_CMD_DELGMAC : IPA_CMD_DELVMAC; int rc; - QETH_CARD_TEXT(card, 2, "L2Dgmac"); - rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELGMAC); + QETH_CARD_TEXT(card, 2, "L2Rmac"); + rc = qeth_l2_send_setdelmac(card, mac, cmd); if (rc) - QETH_DBF_MESSAGE(2, - "Could not delete group MAC %pM on %s: %d\n", - mac, QETH_CARD_IFNAME(card), rc); + QETH_DBF_MESSAGE(2, "Failed to delete MAC %pM on %s: %d\n", + mac, QETH_CARD_IFNAME(card), rc); return rc; } -static int qeth_l2_write_mac(struct qeth_card *card, struct qeth_mac *mac) -{ - if (is_multicast_ether_addr_64bits(mac->mac_addr)) - return qeth_l2_send_setgroupmac(card, mac->mac_addr); - return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_SETVMAC); -} - -static int qeth_l2_remove_mac(struct qeth_card *card, struct qeth_mac *mac) -{ - if (is_multicast_ether_addr_64bits(mac->mac_addr)) - return qeth_l2_send_delgroupmac(card, mac->mac_addr); - return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_DELVMAC); -} - static void qeth_l2_del_all_macs(struct qeth_card *card) { From patchwork Wed Nov 7 18:26:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Heimes X-Patchwork-Id: 994422 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42qvyK4Fj8z9s7h; Thu, 8 Nov 2018 05:26:49 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1gKSXN-0005Qx-Mr; Wed, 07 Nov 2018 18:26:45 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1gKSXL-0005Qp-LI for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:26:43 +0000 Received: from mail-lj1-f198.google.com ([209.85.208.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gKSXL-0002Hi-Cw for kernel-team@lists.ubuntu.com; Wed, 07 Nov 2018 18:26:43 +0000 Received: by mail-lj1-f198.google.com with SMTP id e11-v6so5164266lji.23 for ; Wed, 07 Nov 2018 10:26:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=UVObPlTN3L0pvmJKPNzUNYO932IxDQLllRrlJ5NRNh0=; b=Hl3tTaUDTjHzgoFzSR2Nyw4tUSfImoCYtaQ9z38spKctXGVNuDXMkZ8IRbRk/77Jsj 8Q0RkN15t/Xg2zoyF+qHn3w741hBGVJFLdkibzoyVFTRlcw7yEP/lbC9CY/PE+lIvhbm YsiCIwvsBjDGkREK5IK8I/BzeWfrvikTOkWZf3W+Wwk8CJ/2Pq5h+FMSEKkaPzwoCs4x ir8zFebuZM74cplFekTo82svEFqFKQlFW/Sto6K+DqnyX9kn7mDWWja0HTyiZw2yrfPv kDSl6cEpPBF1rQ0EU/2ROEEMGLhF8IEXIjoIehIqqdwxoBahQ2nbBYIA6IGWYCK3LDHx ZJ4A== X-Gm-Message-State: AGRZ1gK9naWzT3wlrFivF7s4K6UplUaKCEV423bigT1+CQpy8215SW4R 5whJ2+nccJr5bnOCtuCzHLa/0gm3pRX72wwqKSQ7m+Z+f7cZodwjWFH/97S0aUbGw/z+V4gwnm8 dZjB38BAU/fuBjlx5adTkjW8glP6kRWxHiF1fXAz2NfboA8yTBg7rI+ocfQ== X-Received: by 2002:a2e:4503:: with SMTP id s3-v6mr885456lja.44.1541615202552; Wed, 07 Nov 2018 10:26:42 -0800 (PST) X-Google-Smtp-Source: AJdET5dQFPjlFep7KZe/zIJ9owzgEqmyDLLgOvih7f/ariTkGn5nFic8ktkkGOl5HUBmkYEuOptTNltPd9fQ0FzpAe4= X-Received: by 2002:a2e:4503:: with SMTP id s3-v6mr885448lja.44.1541615202247; Wed, 07 Nov 2018 10:26:42 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Frank Heimes Date: Wed, 7 Nov 2018 19:26:31 +0100 Message-ID: Subject: [SRU][Cosmic][Bionic][PATCH 6/6] s390/qeth: don't keep track of MAC address's cast type To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Julian Wiedmann BugLink: http://bugs.launchpad.net/bugs/1797367 s390/qeth: don't keep track of MAC address's cast type Instead of tracking the uc/mc state in each MAC address object, just check the multicast bit in the address itself. Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller (cherry-picked from commit 4641b027f7c32ea51db3acd6dcf97435c2385970) Signed-off-by: Frank Heimes --- static void qeth_l2_del_all_macs(struct qeth_card *card) @@ -597,27 +591,23 @@ static void qeth_promisc_to_bridge(struct qeth_card *card) * only if there is not in the hash table storage already * */ -static void qeth_l2_add_mac(struct qeth_card *card, struct netdev_hw_addr *ha, - u8 is_uc) +static void qeth_l2_add_mac(struct qeth_card *card, struct netdev_hw_addr *ha) { u32 mac_hash = get_unaligned((u32 *)(&ha->addr[2])); struct qeth_mac *mac; hash_for_each_possible(card->mac_htable, mac, hnode, mac_hash) { - if (is_uc == mac->is_uc && - !memcmp(ha->addr, mac->mac_addr, OSA_ADDR_LEN)) { + if (!memcmp(ha->addr, mac->mac_addr, OSA_ADDR_LEN)) { mac->disp_flag = QETH_DISP_ADDR_DO_NOTHING; return; } } mac = kzalloc(sizeof(struct qeth_mac), GFP_ATOMIC); - if (!mac) return; memcpy(mac->mac_addr, ha->addr, OSA_ADDR_LEN); - mac->is_uc = is_uc; mac->disp_flag = QETH_DISP_ADDR_ADD; hash_add(card->mac_htable, &mac->hnode, mac_hash); @@ -643,10 +633,9 @@ static void qeth_l2_set_rx_mode(struct net_device *dev) spin_lock_bh(&card->mclock); netdev_for_each_mc_addr(ha, dev) - qeth_l2_add_mac(card, ha, 0); - + qeth_l2_add_mac(card, ha); netdev_for_each_uc_addr(ha, dev) - qeth_l2_add_mac(card, ha, 1); + qeth_l2_add_mac(card, ha); hash_for_each_safe(card->mac_htable, i, tmp, mac, hnode) { if (mac->disp_flag == QETH_DISP_ADDR_DELETE) { diff --git a/drivers/s390/net/qeth_l2.h b/drivers/s390/net/qeth_l2.h index 09b1c4e..3223601 100644 --- a/drivers/s390/net/qeth_l2.h +++ b/drivers/s390/net/qeth_l2.h @@ -23,7 +23,6 @@ bool qeth_l2_vnicc_is_in_use(struct qeth_card *card); struct qeth_mac { u8 mac_addr[OSA_ADDR_LEN]; - u8 is_uc:1; u8 disp_flag:2; struct hlist_node hnode; }; diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 5863ea1..88dd929 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -186,22 +186,16 @@ static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac) static int qeth_l2_write_mac(struct qeth_card *card, struct qeth_mac *mac) { - if (mac->is_uc) { - return qeth_l2_send_setdelmac(card, mac->mac_addr, - IPA_CMD_SETVMAC); - } else { + if (is_multicast_ether_addr_64bits(mac->mac_addr)) return qeth_l2_send_setgroupmac(card, mac->mac_addr); - } + return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_SETVMAC); } static int qeth_l2_remove_mac(struct qeth_card *card, struct qeth_mac *mac) { - if (mac->is_uc) { - return qeth_l2_send_setdelmac(card, mac->mac_addr, - IPA_CMD_DELVMAC); - } else { + if (is_multicast_ether_addr_64bits(mac->mac_addr)) return qeth_l2_send_delgroupmac(card, mac->mac_addr); - } + return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_DELVMAC); }