From: Dmitry Fleytman <dmitry@daynix.com>
To: Cao jin <caoj.fnst@cn.fujitsu.com>
Cc: Qemu Developers <qemu-devel@nongnu.org>,
Jason Wang <jasowang@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 09/10] vmxnet3: remove unnecessary internal msix flag
Date: Wed, 19 Oct 2016 09:50:23 +0300 [thread overview]
Message-ID: <CC34F253-49F5-461C-AF52-DBD63D0B0E5C@daynix.com> (raw)
In-Reply-To: <1476859665-30133-10-git-send-email-caoj.fnst@cn.fujitsu.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
> On 19 Oct 2016, at 09:47 AM, Cao jin <caoj.fnst@cn.fujitsu.com> wrote:
>
> Internal flag msix_used is unnecessary, it has the same effect as
> msix_enabled().
>
> The corresponding msi flag is already dropped in commit 1070048e.
>
> CC: Dmitry Fleytman <dmitry@daynix.com>
> CC: Jason Wang <jasowang@redhat.com>
> CC: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
> hw/net/vmxnet3.c | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
> index a9854e4..1decb53 100644
> --- a/hw/net/vmxnet3.c
> +++ b/hw/net/vmxnet3.c
> @@ -281,8 +281,6 @@ typedef struct {
> Vmxnet3RxqDescr rxq_descr[VMXNET3_DEVICE_MAX_RX_QUEUES];
> Vmxnet3TxqDescr txq_descr[VMXNET3_DEVICE_MAX_TX_QUEUES];
>
> - /* Whether MSI-X support was installed successfully */
> - bool msix_used;
> hwaddr drv_shmem;
> hwaddr temp_shared_guest_driver_memory;
>
> @@ -359,7 +357,7 @@ static bool _vmxnet3_assert_interrupt_line(VMXNET3State *s, uint32_t int_idx)
> {
> PCIDevice *d = PCI_DEVICE(s);
>
> - if (s->msix_used && msix_enabled(d)) {
> + if (msix_enabled(d)) {
> VMW_IRPRN("Sending MSI-X notification for vector %u", int_idx);
> msix_notify(d, int_idx);
> return false;
> @@ -383,7 +381,7 @@ static void _vmxnet3_deassert_interrupt_line(VMXNET3State *s, int lidx)
> * This function should never be called for MSI(X) interrupts
> * because deassertion never required for message interrupts
> */
> - assert(!s->msix_used || !msix_enabled(d));
> + assert(!msix_enabled(d));
> /*
> * This function should never be called for MSI(X) interrupts
> * because deassertion never required for message interrupts
> @@ -421,7 +419,7 @@ static void vmxnet3_trigger_interrupt(VMXNET3State *s, int lidx)
> s->interrupt_states[lidx].is_pending = true;
> vmxnet3_update_interrupt_line_state(s, lidx);
>
> - if (s->msix_used && msix_enabled(d) && s->auto_int_masking) {
> + if (msix_enabled(d) && s->auto_int_masking) {
> goto do_automask;
> }
>
> @@ -1427,7 +1425,7 @@ static void vmxnet3_update_features(VMXNET3State *s)
>
> static bool vmxnet3_verify_intx(VMXNET3State *s, int intx)
> {
> - return s->msix_used || msi_enabled(PCI_DEVICE(s))
> + return msix_enabled(PCI_DEVICE(s)) || msi_enabled(PCI_DEVICE(s))
> || intx == pci_get_byte(s->parent_obj.config + PCI_INTERRUPT_PIN) - 1;
> }
>
> @@ -1444,18 +1442,18 @@ static void vmxnet3_validate_interrupts(VMXNET3State *s)
> int i;
>
> VMW_CFPRN("Verifying event interrupt index (%d)", s->event_int_idx);
> - vmxnet3_validate_interrupt_idx(s->msix_used, s->event_int_idx);
> + vmxnet3_validate_interrupt_idx(msix_enabled(PCI_DEVICE(s)), s->event_int_idx);
>
> for (i = 0; i < s->txq_num; i++) {
> int idx = s->txq_descr[i].intr_idx;
> VMW_CFPRN("Verifying TX queue %d interrupt index (%d)", i, idx);
> - vmxnet3_validate_interrupt_idx(s->msix_used, idx);
> + vmxnet3_validate_interrupt_idx(msix_enabled(PCI_DEVICE(s)), idx);
> }
>
> for (i = 0; i < s->rxq_num; i++) {
> int idx = s->rxq_descr[i].intr_idx;
> VMW_CFPRN("Verifying RX queue %d interrupt index (%d)", i, idx);
> - vmxnet3_validate_interrupt_idx(s->msix_used, idx);
> + vmxnet3_validate_interrupt_idx(msix_enabled(PCI_DEVICE(s)), idx);
> }
> }
>
> @@ -2184,6 +2182,7 @@ vmxnet3_use_msix_vectors(VMXNET3State *s, int num_vectors)
> static bool
> vmxnet3_init_msix(VMXNET3State *s)
> {
> + bool msix;
> PCIDevice *d = PCI_DEVICE(s);
> int res = msix_init(d, VMXNET3_MAX_INTRS,
> &s->msix_bar,
> @@ -2198,17 +2197,18 @@ vmxnet3_init_msix(VMXNET3State *s)
>
> if (0 > res) {
> VMW_WRPRN("Failed to initialize MSI-X, board's MSI support is broken");
> - s->msix_used = false;
> + msix = false;
> } else {
> if (!vmxnet3_use_msix_vectors(s, VMXNET3_MAX_INTRS)) {
> VMW_WRPRN("Failed to use MSI-X vectors, error %d", res);
> msix_uninit(d, &s->msix_bar, &s->msix_bar);
> - s->msix_used = false;
> + msix = false;
> } else {
> - s->msix_used = true;
> + msix = true;
> }
> }
> - return s->msix_used;
> +
> + return msix;
> }
>
> static void
> @@ -2216,7 +2216,7 @@ vmxnet3_cleanup_msix(VMXNET3State *s)
> {
> PCIDevice *d = PCI_DEVICE(s);
>
> - if (s->msix_used) {
> + if (msix_enabled(d)) {
> vmxnet3_unuse_msix_vectors(s, VMXNET3_MAX_INTRS);
> msix_uninit(d, &s->msix_bar, &s->msix_bar);
> }
> --
> 2.1.0
>
>
>
next prev parent reply other threads:[~2016-10-19 6:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-19 6:47 [Qemu-devel] [PATCH v4 00/10] Convert msix_init() to error Cao jin
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 01/10] msix: Follow CODING_STYLE Cao jin
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 02/10] hcd-xhci: check & correct param before using it Cao jin
2016-11-02 12:21 ` Markus Armbruster
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 03/10] pci: Convert msix_init() to Error and fix callers to check it Cao jin
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 04/10] megasas: change behaviour of msix switch Cao jin
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 05/10] hcd-xhci: " Cao jin
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 06/10] megasas: remove unnecessary megasas_use_msix() Cao jin
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 07/10] megasas: undo the overwrites of msi user configuration Cao jin
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 08/10] vmxnet3: fix reference leak issue Cao jin
2016-10-19 6:51 ` Dmitry Fleytman
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 09/10] vmxnet3: remove unnecessary internal msix flag Cao jin
2016-10-19 6:50 ` Dmitry Fleytman [this message]
2016-10-19 6:47 ` [Qemu-devel] [PATCH v4 10/10] msi_init: convert assert to return -errno Cao jin
2016-11-02 12:37 ` Markus Armbruster
2016-10-30 19:29 ` [Qemu-devel] [PATCH v4 00/10] Convert msix_init() to error Michael S. Tsirkin
2016-10-30 22:45 ` Michael S. Tsirkin
2016-11-02 12:44 ` Markus Armbruster
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=CC34F253-49F5-461C-AF52-DBD63D0B0E5C@daynix.com \
--to=dmitry@daynix.com \
--cc=armbru@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.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).