diff mbox

[RFC,2/2] net-next: mt7530: add nh and proto offsets to the ops struct

Message ID 20170620080655.7251-2-john@phrozen.org
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

John Crispin June 20, 2017, 8:06 a.m. UTC
The MT7530 inserts the 4 magic header in between the 802.3 address and
protocol field. The patch defines these header such that the flow_disector
can properly parse the packet and thus allows hashing to function properly.

Signed-off-by: John Crispin <john@phrozen.org>
---
 drivers/net/dsa/mt7530.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andrew Lunn June 20, 2017, 1:54 p.m. UTC | #1
On Tue, Jun 20, 2017 at 10:06:55AM +0200, John Crispin wrote:
> The MT7530 inserts the 4 magic header in between the 802.3 address and
> protocol field. The patch defines these header such that the flow_disector
> can properly parse the packet and thus allows hashing to function properly.

This is to do with tagging, not the switch driver. The Marvell switch
driver can be used with two different tagging protocols.

So i would put these fields in the dsa_device_ops.

   Andrew
John Crispin June 20, 2017, 5:27 p.m. UTC | #2
On 20/06/17 15:54, Andrew Lunn wrote:
> On Tue, Jun 20, 2017 at 10:06:55AM +0200, John Crispin wrote:
>> The MT7530 inserts the 4 magic header in between the 802.3 address and
>> protocol field. The patch defines these header such that the flow_disector
>> can properly parse the packet and thus allows hashing to function properly.
> This is to do with tagging, not the switch driver. The Marvell switch
> driver can be used with two different tagging protocols.
>
> So i would put these fields in the dsa_device_ops.
>
>     Andrew
Hi Andrew,

i originally did so but struct dsa_device_ops is defined inside 
net/dsa/dsa_priv.h so flow_dissector.c would need a

#include "../dsa/dsa_priv.h"

I was not sure if this is ok or if we would need to move the struct 
definition to include/net/dsa.h in that case

     John
Andrew Lunn June 20, 2017, 6:02 p.m. UTC | #3
> #include "../dsa/dsa_priv.h"
> 
> I was not sure if this is ok or if we would need to move the struct
> definition to include/net/dsa.h in that case

Hi John

Please move the structure.

       Andrew
diff mbox

Patch

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 1e46418a3b74..b5385e554601 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1019,6 +1019,8 @@  static struct dsa_switch_ops mt7530_switch_ops = {
 	.port_fdb_add		= mt7530_port_fdb_add,
 	.port_fdb_del		= mt7530_port_fdb_del,
 	.port_fdb_dump		= mt7530_port_fdb_dump,
+	.hash_nh_off		= 4,
+	.hash_nh_proto		= 2,
 };
 
 static int