Re: [PATCH net-next] net: mvpp2: Add hardware offloading for VLAN filtering
From: David Miller
Date: Tue Feb 27 2018 - 14:34:53 EST
From: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
Date: Tue, 27 Feb 2018 10:11:43 +0100
> +/* Find tcam entry with matched pair <vid,port> */
> +static int mvpp2_prs_vid_range_find(struct mvpp2 *priv, int pmap, u16 vid,
> + u16 mask)
> +{
> + struct mvpp2_prs_entry pe;
> + unsigned char byte[2], enable[2];
> + u16 rvid, rmask;
> + int tid;
Please use reverse christmas tree ordering for local variables
(longest to shortest line).
> +/* Write parser entry for VID filtering */
> +static int mvpp2_prs_vid_entry_add(struct mvpp2_port *port, u16 vid)
> +{
> + struct mvpp2 *priv = port->priv;
> + struct mvpp2_prs_entry pe;
> + int tid;
> + unsigned int mask = 0xfff, reg_val, shift;
> + unsigned int vid_start = MVPP2_PE_VID_FILT_RANGE_START +
> + port->id * MVPP2_PRS_VLAN_FILT_MAX;
Likewise.
> +/* Remove VID filering entry for this port */
> +static void mvpp2_prs_vid_disable_filtering(struct mvpp2_port *port)
> +{
> + struct mvpp2 *priv = port->priv;
> + unsigned int tid = MVPP2_PRS_VID_PORT_DFLT(port->id);
Likewise.
> +/* Add guard entry that drops packets when no VID is matched on this port */
> +static void mvpp2_prs_vid_enable_filtering(struct mvpp2_port *port)
> +{
> + struct mvpp2_prs_entry pe;
> + struct mvpp2 *priv = port->priv;
> + unsigned int tid = MVPP2_PRS_VID_PORT_DFLT(port->id);
> + unsigned int reg_val, shift;
Likewise.
> +static int mvpp2_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
> +{
> + int ret;
> + struct mvpp2_port *port = netdev_priv(dev);
Likewise.
> +static int mvpp2_set_features(struct net_device *dev,
> + netdev_features_t features)
> +{
> + struct mvpp2_port *port = netdev_priv(dev);
> + netdev_features_t changed = dev->features ^ features;
Likewise.