struct hbg_push_stats_info { /* id is used to match the name of the current stats item. * and is used for pretty print on BMC
*/
u32 id;
u64 offset;
};
struct hbg_push_irq_info { /* id is used to match the name of the current irq. * and is used for pretty print on BMC
*/
u32 id;
u32 mask;
};
msg.data_num = j;
ret = hbg_push_msg_send(priv, &msg); if (ret) return ret;
}
return 0;
}
staticint hbg_push_data_u64(struct hbg_priv *priv, u32 opcode,
u64 *data, u32 data_num)
{ /* The length of u64 is twice that of u32, * the data_num must be multiplied by 2.
*/ return hbg_push_data(priv, opcode, (u32 *)data, data_num * 2);
}
for (i = 0; i < vectors->info_array_len; i++) if (vectors->info_array[i].mask == mask) return vectors->stats_array[i];
return 0;
}
staticint hbg_push_irq_cnt(struct hbg_priv *priv)
{ /* An id needs to be added for each data. * Therefore, the data_num must be multiplied by 2.
*/
u32 data_num = ARRAY_SIZE(hbg_push_irq_list) * 2; struct hbg_vector *vectors = &priv->vectors; conststruct hbg_push_irq_info *info;
u32 i, j = 0;
u64 *data; int ret;
data = kcalloc(data_num, sizeof(u64), GFP_KERNEL); if (!data) return -ENOMEM;
/* An id needs to be added for each data. * So i + 2 for each loop.
*/ for (i = 0; i < data_num; i += 2) {
info = &hbg_push_irq_list[j++];
data[i] = info->id;
data[i + 1] = hbg_get_irq_stats(vectors, info->mask);
}
ret = hbg_push_data_u64(priv, HBG_PUSH_CMD_IRQ, data, data_num);
kfree(data); return ret;
}
/* phy link status */
link_status[0] = priv->mac.phydev->link; /* mac link status */
link_status[1] = hbg_reg_read_field(priv, HBG_REG_AN_NEG_STATE_ADDR,
HBG_REG_AN_NEG_STATE_NP_LINK_OK_B);
staticint hbg_push_stats(struct hbg_priv *priv)
{ /* An id needs to be added for each data. * Therefore, the data_num must be multiplied by 2.
*/
u64 data_num = ARRAY_SIZE(hbg_push_stats_list) * 2; struct hbg_stats *stats = &priv->stats; conststruct hbg_push_stats_info *info;
u32 i, j = 0;
u64 *data; int ret;
data = kcalloc(data_num, sizeof(u64), GFP_KERNEL); if (!data) return -ENOMEM;
/* An id needs to be added for each data. * So i + 2 for each loop.
*/ for (i = 0; i < data_num; i += 2) {
info = &hbg_push_stats_list[j++];
data[i] = info->id;
data[i + 1] = HBG_STATS_R(stats, info->offset);
}
ret = hbg_push_data_u64(priv, HBG_PUSH_CMD_STATS, data, data_num);
kfree(data); return ret;
}
void hbg_diagnose_message_push(struct hbg_priv *priv)
{ int ret;
if (test_bit(HBG_NIC_STATE_RESETTING, &priv->state)) return;
/* only 1 is the right value */ if (hbg_reg_read(priv, HBG_REG_PUSH_REQ_ADDR) != 1) return;
ret = hbg_push_irq_cnt(priv); if (ret) {
dev_err(&priv->pdev->dev, "failed to push irq cnt, ret = %d\n", ret); goto push_done;
}
ret = hbg_push_link_status(priv); if (ret) {
dev_err(&priv->pdev->dev, "failed to push link status, ret = %d\n", ret); goto push_done;
}
ret = hbg_push_stats(priv); if (ret)
dev_err(&priv->pdev->dev, "failed to push stats, ret = %d\n", ret);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.