lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 9 Jan 2015 01:00:57 +0100
From:	Francois Romieu <romieu@...zoreil.com>
To:	Stephen Wang <wstephen@...eaurora.org>
Cc:	jcliburn@...il.com, grant.likely@...aro.org, robh+dt@...nel.org,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	devicetree@...r.kernel.org
Subject: Re: [PATCH] ethernet: atheros: Add nss-gmac driver

Stephen Wang <wstephen@...eaurora.org> :
> This driver adds support for the internal GMACs on IPQ806x SoCs.
> It supports the device-tree and will register up to 4 ethernet
> interfaces.
> 
> Signed-off-by: Stephen Wang <wstephen@...eaurora.org>
> ---
[...]
> +/*
> + * NSS GMAC data plane ops, default would be slowpath and can be override by
> + * nss-drv
> + */
> +struct nss_gmac_data_plane_ops {
> +	int (*open)(void *ctx, uint32_t tx_desc_ring, uint32_t rx_desc_ring,
> +							uint32_t mode);
> +	int (*close)(void *ctx);
> +	int (*link_state)(void *ctx, uint32_t link_state);
> +	int (*mac_addr)(void *ctx, uint8_t *addr);
> +	int (*change_mtu)(void *ctx, uint32_t mtu);
> +	int (*xmit)(void *ctx, struct sk_buff *os_buf);
> +};

Weak types.

[...]
> +/*
> + * nss_gmac_register_offload()
> + *
> + * @param[netdev] netdev instance that is going to register
> + * @param[dp_ops] dataplan ops for chaning mac addr/mtu/link status
> + * @param[ctx] passing the ctx of this nss_phy_if to gmac
> + *
> + * @return Return SUCCESS or FAILURE
> + */
> +int nss_gmac_override_data_plane(struct net_device *netdev,
> +				struct nss_gmac_data_plane_ops *dp_ops,
> +				void *ctx)
> +{
> +	struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev);
> +
> +	BUG_ON(!gmacdev);
> +
> +	if (!dp_ops->open || !dp_ops->close || !dp_ops->link_state
> +		|| !dp_ops->mac_addr || !dp_ops->change_mtu || !dp_ops->xmit) {
> +		netdev_dbg(netdev, "%s: All the op functions must be present, reject this registeration",
> +								__func__);
> +		return NSS_GMAC_FAILURE;
> +	}
> +
> +	/*
> +	 * If this gmac is up, close the netdev to force TX/RX stop
> +	 */
> +	if (test_bit(__NSS_GMAC_UP, &gmacdev->flags))
> +		nss_gmac_linux_close(netdev);
> +
> +	/* Recored the data_plane_ctx, data_plane_ops */
> +	gmacdev->data_plane_ctx = ctx;
> +	gmacdev->data_plane_ops = dp_ops;
> +	gmacdev->first_linkup_done = 0;
> +
> +	return NSS_GMAC_SUCCESS;
> +}
> +EXPORT_SYMBOL(nss_gmac_override_data_plane);

Why is this hook needed ?

-- 
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists