Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-29 Thread Kurt Kanzenbach
On Wed Jul 29 2020, Richard Cochran wrote: > On Wed, Jul 29, 2020 at 12:29:08PM +0200, Kurt Kanzenbach wrote: >> I'll test it and send v3. But before, I've got another question that >> somebody might have an answer to: >> >> The ptp v1 code always does locate the message type at >> >> msgtype =

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-29 Thread Petr Machata
Kurt Kanzenbach writes: > On Wed Jul 29 2020, Russell King - ARM Linux admin wrote: >> Would it make more sense to do: >> >> u8 *data = skb_mac_header(skb); >> u8 *ptr = data; >> >> if (type & PTP_CLASS_VLAN) >> ptr += VLAN_HLEN; >> >> switch (type & PTP_CLASS_P

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-29 Thread Richard Cochran
On Wed, Jul 29, 2020 at 12:29:08PM +0200, Kurt Kanzenbach wrote: > I'll test it and send v3. But before, I've got another question that > somebody might have an answer to: > > The ptp v1 code always does locate the message type at > > msgtype = data + offset + OFF_PTP_CONTROL > > OFF_PTP_CONTR

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-29 Thread Richard Cochran
On Wed, Jul 29, 2020 at 11:02:57AM +0100, Russell King - ARM Linux admin wrote: > in other words, compare pointers, so that whether skb_push() etc has > been used on the skb is irrelevant? +1

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-29 Thread Grygorii Strashko
On 29/07/2020 00:06, Petr Machata wrote: Kurt Kanzenbach writes: On Mon Jul 27 2020, Petr Machata wrote: So this looks good, and works, but I'm wondering about one thing. Thanks for testing. Your code (and evidently most drivers as well) use a different check than mlxsw, namely skb->

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-29 Thread Kurt Kanzenbach
On Wed Jul 29 2020, Russell King - ARM Linux admin wrote: > On Tue, Jul 28, 2020 at 11:06:08PM +0200, Petr Machata wrote: >> >> Kurt Kanzenbach writes: >> >> > On Mon Jul 27 2020, Petr Machata wrote: >> >> So this looks good, and works, but I'm wondering about one thing. >> > >> > Thanks for tes

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-29 Thread Russell King - ARM Linux admin
On Tue, Jul 28, 2020 at 11:06:08PM +0200, Petr Machata wrote: > > Kurt Kanzenbach writes: > > > On Mon Jul 27 2020, Petr Machata wrote: > >> So this looks good, and works, but I'm wondering about one thing. > > > > Thanks for testing. > > > >> > >> Your code (and evidently most drivers as well)

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-28 Thread Petr Machata
Kurt Kanzenbach writes: > On Mon Jul 27 2020, Petr Machata wrote: >> So this looks good, and works, but I'm wondering about one thing. > > Thanks for testing. > >> >> Your code (and evidently most drivers as well) use a different check >> than mlxsw, namely skb->len + ETH_HLEN < X. When I print

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-28 Thread Kurt Kanzenbach
On Tue Jul 28 2020, Kurt Kanzenbach wrote: > On Mon Jul 27 2020, Petr Machata wrote: >> So this looks good, and works, but I'm wondering about one thing. > > Thanks for testing. > >> >> Your code (and evidently most drivers as well) use a different check >> than mlxsw, namely skb->len + ETH_HLEN <

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-28 Thread Kurt Kanzenbach
On Mon Jul 27 2020, Petr Machata wrote: > So this looks good, and works, but I'm wondering about one thing. Thanks for testing. > > Your code (and evidently most drivers as well) use a different check > than mlxsw, namely skb->len + ETH_HLEN < X. When I print_hex_dump() > skb_mac_header(skb), skb

Re: [PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-27 Thread Petr Machata
Kurt Kanzenbach writes: > @@ -329,30 +327,14 @@ static int mlxsw_sp_ptp_parse(struct sk_buff *skb, > return -ERANGE; > } > > - if (ptp_class & PTP_CLASS_VLAN) > - offset += VLAN_HLEN; > - > - switch (ptp_class & PTP_CLASS_PMASK) { > - case PTP_CLASS_I

[PATCH v2 4/9] mlxsw: spectrum_ptp: Use generic helper function

2020-07-27 Thread Kurt Kanzenbach
In order to reduce code duplication between ptp drivers, generic helper functions were introduced. Use them. Signed-off-by: Kurt Kanzenbach --- .../ethernet/mellanox/mlxsw/spectrum_ptp.c| 32 --- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/drivers/net/ether