Re: [v1,net-next 4/5] net: enetc: add hw tc hw offload features for PSPF capability

From: Jiri Pirko
Date: Tue Mar 24 2020 - 08:14:35 EST


Tue, Mar 24, 2020 at 04:47:42AM CET, Po.Liu@xxxxxxx wrote:

[...]


>@@ -289,9 +300,53 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data);
> void enetc_sched_speed_set(struct net_device *ndev);
> int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data);
> int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data);
>+
>+static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv)
>+{
>+ u32 reg = 0;

Pointless init.


>+
>+ reg = enetc_port_rd(&priv->si->hw, ENETC_PSIDCAPR);
>+ priv->psfp_cap.max_streamid = reg & ENETC_PSIDCAPR_MSK;
>+ /* Port stream filter capability */
>+ reg = enetc_port_rd(&priv->si->hw, ENETC_PSFCAPR);
>+ priv->psfp_cap.max_psfp_filter = reg & ENETC_PSFCAPR_MSK;
>+ /* Port stream gate capability */
>+ reg = enetc_port_rd(&priv->si->hw, ENETC_PSGCAPR);
>+ priv->psfp_cap.max_psfp_gate = (reg & ENETC_PSGCAPR_SGIT_MSK);
>+ priv->psfp_cap.max_psfp_gatelist = (reg & ENETC_PSGCAPR_GCL_MSK) >> 16;
>+ /* Port flow meter capability */
>+ reg = enetc_port_rd(&priv->si->hw, ENETC_PFMCAPR);
>+ priv->psfp_cap.max_psfp_meter = reg & ENETC_PFMCAPR_MSK;
>+}
>+
>+static inline void enetc_psfp_enable(struct enetc_hw *hw)
>+{
>+ enetc_wr(hw, ENETC_PPSFPMR, enetc_rd(hw, ENETC_PPSFPMR)
>+ | ENETC_PPSFPMR_PSFPEN | ENETC_PPSFPMR_VS

Hmm, I think it is better to have "|" at the end of the line".


>+ | ENETC_PPSFPMR_PVC | ENETC_PPSFPMR_PVZC);
>+}
>+
>+static inline void enetc_psfp_disable(struct enetc_hw *hw)
>+{
>+ enetc_wr(hw, ENETC_PPSFPMR, enetc_rd(hw, ENETC_PPSFPMR)
>+ & ~ENETC_PPSFPMR_PSFPEN & ~ENETC_PPSFPMR_VS

Same here.


>+ & ~ENETC_PPSFPMR_PVC & ~ENETC_PPSFPMR_PVZC);
>+}
> #else
> #define enetc_setup_tc_taprio(ndev, type_data) -EOPNOTSUPP
> #define enetc_sched_speed_set(ndev) (void)0
> #define enetc_setup_tc_cbs(ndev, type_data) -EOPNOTSUPP
> #define enetc_setup_tc_txtime(ndev, type_data) -EOPNOTSUPP

[...]