From: MD Danish Anwar <danishanwar@ti.com>
To: Vinicius Costa Gomes <vinicius.gomes@intel.com>,
Andrew Lunn <andrew@lunn.ch>, Roger Quadros <rogerq@kernel.org>,
Vignesh Raghavendra <vigneshr@ti.com>,
Richard Cochran <richardcochran@gmail.com>,
Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
<vladimir.oltean@nxp.com>, Simon Horman <horms@kernel.org>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<srk@ti.com>, <r-gunasekaran@ti.com>,
<linux-arm-kernel@lists.infradead.org>,
Roger Quadros <rogerq@ti.com>
Subject: Re: [PATCH net-next v4] net: ti: icssg_prueth: add TAPRIO offload support
Date: Wed, 11 Oct 2023 12:40:17 +0530 [thread overview]
Message-ID: <7456cbc2-7ea1-b68c-ce75-fa4b5392ec8c@ti.com> (raw)
In-Reply-To: <87cyxr8jtk.fsf@intel.com>
On 07/10/23 04:01, Vinicius Costa Gomes wrote:
> MD Danish Anwar <danishanwar@ti.com> writes:
>
>> From: Roger Quadros <rogerq@ti.com>
>>
>> ICSSG dual-emac f/w supports Enhanced Scheduled Traffic (EST – defined
>> in P802.1Qbv/D2.2 that later got included in IEEE 802.1Q-2018)
>> configuration. EST allows express queue traffic to be scheduled
>> (placed) on the wire at specific repeatable time intervals. In
>> Linux kernel, EST configuration is done through tc command and
>> the taprio scheduler in the net core implements a software only
>> scheduler (SCH_TAPRIO). If the NIC is capable of EST configuration,
>> user indicate "flag 2" in the command which is then parsed by
>> taprio scheduler in net core and indicate that the command is to
>> be offloaded to h/w. taprio then offloads the command to the
>> driver by calling ndo_setup_tc() ndo ops. This patch implements
>> ndo_setup_tc() to offload EST configuration to ICSSG.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
>> Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
>> ---
>> Cc: Roger Quadros <rogerq@ti.com>
>> Cc: Andrew Lunn <andrew@lunn.ch>
>> Cc: Vinicius Costa Gomes <vinicius.gomes@intel.com>
>> Cc: Jakub Kicinski <kuba@kernel.org>
>>
[ ... ]
>> +
>> +static int emac_taprio_replace(struct net_device *ndev,
>> + struct tc_taprio_qopt_offload *taprio)
>> +{
>> + struct prueth_emac *emac = netdev_priv(ndev);
>> + struct tc_taprio_qopt_offload *est_new;
>> + int ret, idx;
>> +
>> + if (taprio->cycle_time_extension) {
>> + netdev_err(ndev, "Failed to set cycle time extension");
>> + return -EOPNOTSUPP;
>> + }
>> +
>> + if (taprio->num_entries == 0 ||
>> + taprio->num_entries > TAS_MAX_CMD_LISTS) {
>> + NL_SET_ERR_MSG_FMT_MOD(taprio->extack, "unsupported num_entries %ld in taprio config\n",
>> + taprio->num_entries);
>> + return -EINVAL;
>> + }
>> +
>> + /* If any time_interval is 0 in between the list, then exit */
>> + for (idx = 0; idx < taprio->num_entries; idx++) {
>> + if (taprio->entries[idx].interval == 0) {
>> + NL_SET_ERR_MSG_MOD(taprio->extack, "0 interval in taprio config not supported\n");
>> + return -EINVAL;
>> + }
>> + }
>> +
>> + if (emac->qos.tas.taprio_admin)
>> + devm_kfree(&ndev->dev, emac->qos.tas.taprio_admin);
>> +
>> + est_new = devm_kzalloc(&ndev->dev,
>> + struct_size(est_new, entries, taprio->num_entries),
>> + GFP_KERNEL);
>> + if (!est_new)
>> + return -ENOMEM;
>> +
>> + emac_cp_taprio(taprio, est_new);
>> + emac->qos.tas.taprio_admin = est_new;
>> + ret = tas_update_oper_list(emac);
>> + if (ret)
>> + return ret;
>> +
>> + ret = tas_set_state(emac, TAS_STATE_ENABLE);
>
> The double space is still here...
>
Sorry my bad. I'll fix this in next revision.
>> + if (ret)
>> + devm_kfree(&ndev->dev, est_new);
>
> ... as is the free'ing of 'est_new' while 'taprio_admin' still points to it.
>
I will add below line here to assign 'taprio_admin' to NULL once
'est_new' is freed.
emac->qos.tas.taprio_admin = NULL;
I will send the next revision with these two fixes. Please let me know
if this is OK or if something else is also needed.
>> +
>> + return ret;
>> +}
>> +
[ ... ]
>> +
>> +void icssg_qos_tas_init(struct net_device *ndev);
>> +int icssg_qos_ndo_setup_tc(struct net_device *ndev, enum tc_setup_type type,
>> + void *type_data);
>> +#endif /* __NET_TI_ICSSG_QOS_H */
>> --
>> 2.34.1
>>
>
--
Thanks and Regards,
Danish
next prev parent reply other threads:[~2023-10-11 7:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 10:20 [PATCH net-next v4] net: ti: icssg_prueth: add TAPRIO offload support MD Danish Anwar
2023-10-06 22:31 ` Vinicius Costa Gomes
2023-10-11 7:10 ` MD Danish Anwar [this message]
2023-10-11 10:25 ` Vladimir Oltean
2023-10-16 9:13 ` Roger Quadros
2024-01-15 6:54 ` MD Danish Anwar
2024-01-18 1:27 ` Vladimir Oltean
2024-04-25 11:57 ` MD Danish Anwar
2024-04-25 12:18 ` Vladimir Oltean
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=7456cbc2-7ea1-b68c-ce75-fa4b5392ec8c@ti.com \
--to=danishanwar@ti.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=r-gunasekaran@ti.com \
--cc=richardcochran@gmail.com \
--cc=rogerq@kernel.org \
--cc=rogerq@ti.com \
--cc=srk@ti.com \
--cc=vigneshr@ti.com \
--cc=vinicius.gomes@intel.com \
--cc=vladimir.oltean@nxp.com \
/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