target-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Bogdanov <d.bogdanov@yadro.com>
To: Mike Christie <michael.christie@oracle.com>
Cc: Martin Petersen <martin.petersen@oracle.com>,
	<target-devel@vger.kernel.org>, <linux-scsi@vger.kernel.org>,
	<linux@yadro.com>, Roman Bolshakov <r.bolshakov@yadro.com>
Subject: Re: [PATCH 6/7] scsi: target: core: Add RTPI attribute for target port
Date: Tue, 4 Oct 2022 19:12:47 +0300	[thread overview]
Message-ID: <20221004161247.GC10901@yadro.com> (raw)
In-Reply-To: <85c21e59-fda3-8b94-95c0-2483b4c5a05c@oracle.com>

On Thu, Sep 29, 2022 at 07:03:52PM -0500, Mike Christie wrote:
> 
> On 9/6/22 10:45 AM, Dmitry Bogdanov wrote:
> > +
> > +static ssize_t core_tpg_rtpi_store(struct config_item *item,
> > +                                const char *page, size_t count)
> > +{
> > +     struct se_portal_group *se_tpg = attrib_to_tpg(item);
> > +     struct se_portal_group *tpg;
> > +     bool rtpi_changed = false;
> > +     u16 val;
> > +     int ret;
> > +
> > +     ret = kstrtou16(page, 0, &val);
> > +     if (ret < 0)
> > +             return ret;
> > +     if (val == 0)
> > +             return -EINVAL;
> > +
> > +     /* RTPI shouldn't conflict with values of existing ports */
> > +     spin_lock(&g_tpg_lock);
> > +
> > +     list_for_each_entry(tpg, &g_tpg_list, tpg_list) {
> > +             if (se_tpg != tpg && val == tpg->tpg_rtpi) {
> > +                     spin_unlock(&g_tpg_lock);
> > +                     pr_err("TARGET_CORE[%s]->TPG[%u] - RTPI %#x conflicts with TARGET_CORE[%s]->TPG[%u]\n",
> > +                            se_tpg->se_tpg_tfo->fabric_name,
> > +                            se_tpg->se_tpg_tfo->tpg_get_tag(tpg),
> > +                            val,
> > +                            tpg->se_tpg_tfo->fabric_name,
> > +                            tpg->se_tpg_tfo->tpg_get_tag(tpg));
> > +                     return -EINVAL;
> > +             }
> > +     }
> > +
> > +     if (se_tpg->tpg_rtpi != val) {
> > +             se_tpg->tpg_rtpi = val;
> > +             rtpi_changed = true;
> > +     }
> > +     spin_unlock(&g_tpg_lock);
> > +
> > +     if (rtpi_changed)
> > +             core_tpg_ua(se_tpg, 0x3f, ASCQ_3FH_INQUIRY_DATA_HAS_CHANGED);
> > +     ret = count;
> > +
> > +     return ret;
> 
> Just return count.

Yes, will do.



  reply	other threads:[~2022-10-04 16:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 15:45 [PATCH 0/7] scsi: target: make RTPI an TPG identifier Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 1/7] scsi: target: core: Add cleanup sequence in core_tpg_register() Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 2/7] scsi: target: core: Add RTPI field to target port Dmitry Bogdanov
2022-09-29 22:26   ` Mike Christie
2022-09-29 23:57     ` Mike Christie
2022-10-04 16:11       ` Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 3/7] scsi: target: core: Use RTPI from " Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 4/7] scsi: target: core: Drop device-based RTPI Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 5/7] scsi: target: core: Add common port attributes Dmitry Bogdanov
2022-09-06 15:45 ` [PATCH 6/7] scsi: target: core: Add RTPI attribute for target port Dmitry Bogdanov
2022-09-30  0:03   ` Mike Christie
2022-10-04 16:12     ` Dmitry Bogdanov [this message]
2022-09-06 15:45 ` [PATCH 7/7] target: core: check RTPI uniquity for enabled TPG Dmitry Bogdanov
2022-09-30  0:02   ` Mike Christie
2022-10-01 16:19     ` michael.christie
2022-10-04 16:41       ` Dmitry Bogdanov
2022-10-04 16:37     ` Dmitry Bogdanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221004161247.GC10901@yadro.com \
    --to=d.bogdanov@yadro.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux@yadro.com \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.com \
    --cc=r.bolshakov@yadro.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).