RE: [PATCH net-next v3 11/12] microchip: lan865x: add driver support for Microchip's LAN865X MAC-PHY

Woojung.Huh
2024-03-06T23:45:32Z

Hi Parthiban,

> diff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c
> b/drivers/net/ethernet/microchip/lan865x/lan865x.c
...
> +static void lan865x_multicast_work_handler(struct work_struct *work)
> +{
> + struct lan865x_priv *priv = container_of(work, struct lan865x_priv,
> + multicast_work);
> + u32 regval = 0;
> +
> + if (priv->netdev->flags & IFF_PROMISC) {
> + /* Enabling promiscuous mode */
> + regval |= MAC_NET_CFG_PROMISCUOUS_MODE;
> + regval &= (~MAC_NET_CFG_MULTICAST_MODE);
> + regval &= (~MAC_NET_CFG_UNICAST_MODE);
> + } else if (priv->netdev->flags & IFF_ALLMULTI) {
> + /* Enabling all multicast mode */
> + regval &= (~MAC_NET_CFG_PROMISCUOUS_MODE);
> + regval |= MAC_NET_CFG_MULTICAST_MODE;
> + regval &= (~MAC_NET_CFG_UNICAST_MODE);
> + } else if (!netdev_mc_empty(priv->netdev)) {
> + lan865x_set_specific_multicast_addr(priv->netdev);
> + regval &= (~MAC_NET_CFG_PROMISCUOUS_MODE);
> + regval &= (~MAC_NET_CFG_MULTICAST_MODE);
> + regval |= MAC_NET_CFG_UNICAST_MODE;
> + } else {
> + /* enabling local mac address only */
> + if (oa_tc6_write_register(priv->tc6, LAN865X_REG_MAC_H_HASH,
> + regval)) {

Your intention to write 0 into LAN865X_REG_MAC_H_HASH?
If then, using 0 than regval makes more clear.

> + netdev_err(priv->netdev, "Failed to write reg_hashh");
> + return;
> + }
> + if (oa_tc6_write_register(priv->tc6, LAN865X_REG_MAC_L_HASH,
> + regval)) {

Same here.

> + netdev_err(priv->netdev, "Failed to write reg_hashl");
> + return;
> + }
> + }
> + if (oa_tc6_write_register(priv->tc6, LAN865X_REG_MAC_NET_CFG,
> regval))
> + netdev_err(priv->netdev,
> + "Failed to enable promiscuous/multicast/normal mode");
> +}
> +