[PATCH v9 1/3] net/macb: add new poll mode driver
Stephen Hemminger
stephen at networkplumber.org
Fri Jun 6 17:38:05 CEST 2025
On Fri, 6 Jun 2025 09:06:10 +0000
Wencheng Li <liwencheng at phytium.com.cn> wrote:
> +static int macb_get_speed_info(struct rte_eth_dev *dev, char *speed_info)
> +{
> + char filename[PATH_MAX];
> + char *s;
> + struct macb_priv *priv = dev->data->dev_private;
> +
> + if (!speed_info) {
> + MACB_LOG(ERR, "speed info is NULL.");
> + return -ENOMEM;
> + }
> +
> + snprintf(filename, PATH_MAX, "%s/%s/speed_info", MACB_PDEV_PATH, priv->name);
> + FILE *file = fopen(filename, "r");
> + if (!file) {
> + MACB_LOG(ERR, "There is no speed_info file!");
> + return -ENFILE;
> + }
> +
> + s = fgets(speed_info, SPEED_INFO_LEN, file);
> + if (!s) {
> + fclose(file);
> + MACB_LOG(ERR, "get speed info error!");
> + return -EINVAL;
> + }
> +
> + fclose(file);
> + return 0;
> +}
Looking at this API I see a potential review conflict.
Although sysfs is a text based API, and any string can be returned;
the convention used is one value per file.
Writing UIO drivers is hard, and getting it upstream you will find lots of issues;
ask Long about hyper-v uio. I wonder if there is a better way to do this.
More information about the dev
mailing list