> +     ether_addr_copy(eth_dest_addr, dest_addr); /* Marvell broadcast or 
> switch MAC */
> +     ether_addr_copy(eth_src_addr, dev->dev_addr);
> +     dsa_tag[0] = 0x40 | (chip->ds->index & 0x1f); /* From_CPU */
> +     dsa_tag[1] = 0xfa;
> +     dsa_tag[2] = 0xf;
> +     dsa_tag[3] = ++chip->rmu_sequence_num;
> +     *eth_ethertype = htons(ETH_P_EDSA); /* User defined, useless really */
> +
> +     req = skb_put(skb, sizeof(*req));
> +     req->format = htons(MV88E6XXX_RMU_REQUEST_FORMAT_SOHO);
> +     req->pad = 0x0000;
> +     req->code = htons(code);

Hi Vivien

When i looked at this before, i had a different idea how to do this.

The EthType you put into this header is also used in the reply. So we
could define an ETH_P_RMU. It is then possible to get the stack to
pass all frames for an ether type to a handler. e.g the batman code:

int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
                                   struct net *net, const char *iface_name)
{
        struct batadv_priv *bat_priv;
        struct net_device *soft_iface, *master;
        __be16 ethertype = htons(ETH_P_BATMAN);

        hard_iface->batman_adv_ptype.type = ethertype;
        hard_iface->batman_adv_ptype.func = batadv_batman_skb_recv;
        hard_iface->batman_adv_ptype.dev = hard_iface->net_dev;
        dev_add_pack(&hard_iface->batman_adv_ptype);

So i would let the tag driver take off the {E}DSA header and pass the
frame to the stack, and the stack can then identify the frame and pass
it to the switch driver. I think it makes the split between tag code
and switch code cleaner.

       Andrew

Reply via email to