From: Jiri Pirko <jiri@mellanox.com>
To: Scott Feldman <sfeldma@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>, Netdev <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>, <idosch@mellanox.com>,
<eladr@mellanox.com>,
"ogerlitz@mellanox.com" <ogerlitz@mellanox.com>,
Roopa Prabhu <roopa@cumulusnetworks.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"Thomas Graf" <tgraf@suug.ch>,
Alexei Starovoitov <ast@plumgrid.com>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Daniel Borkmann <daniel@iogearbox.net>,
john fastabend <john.fastabend@gmail.com>,
"simon.horman@netronome.com" <simon.horman@netronome.com>,
John Linville <linville@tuxdriver.com>,
"Andy Gospodarek" <andy@greyhouse.net>,
Shrijeet Mukherjee <shm@cumulusnetworks.com>,
"nhorman@tuxdriver.com" <nhorman@tuxdriver.com>
Subject: Re: [patch net-next 2/4] mlxsw: Add PCI bus implementation
Date: Sun, 26 Jul 2015 08:49:08 +0200 [thread overview]
Message-ID: <20150726064908.GA2153@nanopsycho.fritz.box> (raw)
In-Reply-To: <CAE4R7bBGgXvYbaXFrQHnA=YX3KZHXi5T4aH=-UH81RUqUm4+vQ@mail.gmail.com>
Sun, Jul 26, 2015 at 07:15:04AM CEST, sfeldma@gmail.com wrote:
>On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko <jiri@resnulli.us> wrote:
>> From: Jiri Pirko <jiri@mellanox.com>
>>
>> Add PCI bus implementation for Mellanox Technologies Switch ASICs. This
>> includes firmware initialization, async queues manipulation and command
>> interface implementation.
>>
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
>> Signed-off-by: Elad Raz <eladr@mellanox.com>
>> ---
>
>[cut]
>
>> +static int mlxsw_pci_fw_area_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
>> + u16 num_pages)
>> +{
>> + struct mlxsw_pci_mem_item *mem_item;
>> + int i;
>> + int err;
>
>Need to init err to zero here
You are right. We need to set err before "goto err_alloc". Thanks.
>
>> +
>> + mlxsw_pci->fw_area.items = kcalloc(num_pages, sizeof(*mem_item),
>> + GFP_KERNEL);
>> + if (!mlxsw_pci->fw_area.items)
>> + return -ENOMEM;
>> + mlxsw_pci->fw_area.num_pages = num_pages;
>> +
>> + mlxsw_cmd_mbox_zero(mbox);
>> + for (i = 0; i < num_pages; i++) {
>> + mem_item = &mlxsw_pci->fw_area.items[i];
>> +
>> + mem_item->size = MLXSW_PCI_PAGE_SIZE;
>> + mem_item->buf = pci_alloc_consistent(mlxsw_pci->pdev,
>> + mem_item->size,
>> + &mem_item->mapaddr);
>> + if (!mem_item->buf)
>> + goto err_alloc;
>> + mlxsw_cmd_mbox_map_fa_pa_set(mbox, i, mem_item->mapaddr);
>> + mlxsw_cmd_mbox_map_fa_log2size_set(mbox, i, 0); /* 1 page */
>> + }
>> +
>> + err = mlxsw_cmd_map_fa(mlxsw_pci->core, mbox, num_pages);
>> + if (err)
>> + goto err_cmd_map_fa;
>> +
>> + return 0;
>> +
>> +err_cmd_map_fa:
>> +err_alloc:
>> + for (i--; i >= 0; i--) {
>> + mem_item = &mlxsw_pci->fw_area.items[i];
>> +
>> + pci_free_consistent(mlxsw_pci->pdev, mem_item->size,
>> + mem_item->buf, mem_item->mapaddr);
>> + }
>> + kfree(mlxsw_pci->fw_area.items);
>> + return err;
>> +}
next prev parent reply other threads:[~2015-07-26 7:03 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-23 15:43 [patch net-next 0/4] Introduce Mellanox Technologies Switch ASICs switchdev drivers Jiri Pirko
2015-07-23 15:43 ` [patch net-next 1/4] mlxsw: Introduce Mellanox switch driver core Jiri Pirko
2015-07-23 15:43 ` [patch net-next 2/4] mlxsw: Add PCI bus implementation Jiri Pirko
2015-07-24 4:52 ` Scott Feldman
2015-07-24 5:30 ` Jiri Pirko
2015-07-26 5:15 ` Scott Feldman
2015-07-26 6:49 ` Jiri Pirko [this message]
2015-07-23 15:43 ` [patch net-next 3/4] mlxsw: Add interface to access registers and process events Jiri Pirko
2015-07-23 21:12 ` Andy Gospodarek
2015-07-24 5:24 ` Jiri Pirko
2015-07-24 12:09 ` Andy Gospodarek
2015-07-24 5:13 ` Scott Feldman
2015-07-24 5:18 ` Jiri Pirko
2015-07-24 6:48 ` Elad Raz
2015-07-23 15:43 ` [patch net-next 4/4] mlxsw: Introduce Mellanox SwitchX-2 ASIC support Jiri Pirko
2015-07-23 17:19 ` Alexander Duyck
2015-07-23 19:42 ` Jiri Pirko
2015-07-26 2:45 ` Scott Feldman
2015-07-26 7:10 ` Jiri Pirko
2015-07-26 17:14 ` Jiri Pirko
2015-07-27 6:17 ` Rosen, Rami
2015-07-28 18:06 ` Jiri Pirko
2015-07-24 0:03 ` [patch net-next 0/4] Introduce Mellanox Technologies Switch ASICs switchdev drivers Scott Feldman
2015-07-24 0:38 ` Rustad, Mark D
2015-07-24 5:38 ` Jiri Pirko
2015-07-27 6:51 ` David Miller
2015-07-27 20:21 ` Scott Feldman
2015-07-27 20:27 ` Jiri Pirko
2015-07-27 21:21 ` Florian Fainelli
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=20150726064908.GA2153@nanopsycho.fritz.box \
--to=jiri@mellanox.com \
--cc=andy@greyhouse.net \
--cc=ast@plumgrid.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=f.fainelli@gmail.com \
--cc=idosch@mellanox.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=john.fastabend@gmail.com \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=ogerlitz@mellanox.com \
--cc=roopa@cumulusnetworks.com \
--cc=sfeldma@gmail.com \
--cc=shm@cumulusnetworks.com \
--cc=simon.horman@netronome.com \
--cc=tgraf@suug.ch \
/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).