mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
sfc: make function tables const
The phy, mac, and board information structures should be const. Since tables contain function pointer this improves security (at least theoretically). Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
44f4d5a27e
commit
6c8c2513c8
@ -2245,7 +2245,7 @@ static bool efx_port_dummy_op_poll(struct efx_nic *efx)
|
||||
return false;
|
||||
}
|
||||
|
||||
static struct efx_phy_operations efx_dummy_phy_operations = {
|
||||
static const struct efx_phy_operations efx_dummy_phy_operations = {
|
||||
.init = efx_port_dummy_op_int,
|
||||
.reconfigure = efx_port_dummy_op_int,
|
||||
.poll = efx_port_dummy_op_poll,
|
||||
@ -2261,7 +2261,7 @@ static struct efx_phy_operations efx_dummy_phy_operations = {
|
||||
/* This zeroes out and then fills in the invariants in a struct
|
||||
* efx_nic (including all sub-structures).
|
||||
*/
|
||||
static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
|
||||
static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type,
|
||||
struct pci_dev *pci_dev, struct net_device *net_dev)
|
||||
{
|
||||
int i;
|
||||
@ -2451,7 +2451,7 @@ static int efx_pci_probe_main(struct efx_nic *efx)
|
||||
static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
|
||||
const struct pci_device_id *entry)
|
||||
{
|
||||
struct efx_nic_type *type = (struct efx_nic_type *) entry->driver_data;
|
||||
const struct efx_nic_type *type = (const struct efx_nic_type *) entry->driver_data;
|
||||
struct net_device *net_dev;
|
||||
struct efx_nic *efx;
|
||||
int i, rc;
|
||||
|
@ -1703,7 +1703,7 @@ static int falcon_set_wol(struct efx_nic *efx, u32 type)
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
struct efx_nic_type falcon_a1_nic_type = {
|
||||
const struct efx_nic_type falcon_a1_nic_type = {
|
||||
.probe = falcon_probe_nic,
|
||||
.remove = falcon_remove_nic,
|
||||
.init = falcon_init_nic,
|
||||
@ -1744,7 +1744,7 @@ struct efx_nic_type falcon_a1_nic_type = {
|
||||
.reset_world_flags = ETH_RESET_IRQ,
|
||||
};
|
||||
|
||||
struct efx_nic_type falcon_b0_nic_type = {
|
||||
const struct efx_nic_type falcon_b0_nic_type = {
|
||||
.probe = falcon_probe_nic,
|
||||
.remove = falcon_remove_nic,
|
||||
.init = falcon_init_nic,
|
||||
|
@ -362,7 +362,7 @@ void falcon_poll_xmac(struct efx_nic *efx)
|
||||
falcon_ack_status_intr(efx);
|
||||
}
|
||||
|
||||
struct efx_mac_operations falcon_xmac_operations = {
|
||||
const struct efx_mac_operations falcon_xmac_operations = {
|
||||
.reconfigure = falcon_reconfigure_xmac,
|
||||
.update_stats = falcon_update_stats_xmac,
|
||||
.check_fault = falcon_xmac_check_fault,
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#include "net_driver.h"
|
||||
|
||||
extern struct efx_mac_operations falcon_xmac_operations;
|
||||
extern struct efx_mac_operations efx_mcdi_mac_operations;
|
||||
extern const struct efx_mac_operations falcon_xmac_operations;
|
||||
extern const struct efx_mac_operations efx_mcdi_mac_operations;
|
||||
extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
|
||||
u32 dma_len, int enable, int clear);
|
||||
|
||||
|
@ -138,7 +138,7 @@ static bool efx_mcdi_mac_check_fault(struct efx_nic *efx)
|
||||
}
|
||||
|
||||
|
||||
struct efx_mac_operations efx_mcdi_mac_operations = {
|
||||
const struct efx_mac_operations efx_mcdi_mac_operations = {
|
||||
.reconfigure = efx_mcdi_mac_reconfigure,
|
||||
.update_stats = efx_port_dummy_op_void,
|
||||
.check_fault = efx_mcdi_mac_check_fault,
|
||||
|
@ -739,7 +739,7 @@ static const char *efx_mcdi_phy_test_name(struct efx_nic *efx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct efx_phy_operations efx_mcdi_phy_ops = {
|
||||
const struct efx_phy_operations efx_mcdi_phy_ops = {
|
||||
.probe = efx_mcdi_phy_probe,
|
||||
.init = efx_port_dummy_op_int,
|
||||
.reconfigure = efx_mcdi_phy_reconfigure,
|
||||
|
@ -773,10 +773,10 @@ struct efx_nic {
|
||||
|
||||
struct efx_buffer stats_buffer;
|
||||
|
||||
struct efx_mac_operations *mac_op;
|
||||
const struct efx_mac_operations *mac_op;
|
||||
|
||||
unsigned int phy_type;
|
||||
struct efx_phy_operations *phy_op;
|
||||
const struct efx_phy_operations *phy_op;
|
||||
void *phy_data;
|
||||
struct mdio_if_info mdio;
|
||||
unsigned int mdio_bus;
|
||||
@ -897,7 +897,7 @@ struct efx_nic_type {
|
||||
void (*resume_wol)(struct efx_nic *efx);
|
||||
int (*test_registers)(struct efx_nic *efx);
|
||||
int (*test_nvram)(struct efx_nic *efx);
|
||||
struct efx_mac_operations *default_mac_ops;
|
||||
const struct efx_mac_operations *default_mac_ops;
|
||||
|
||||
int revision;
|
||||
unsigned int mem_map_size;
|
||||
|
@ -150,9 +150,9 @@ struct siena_nic_data {
|
||||
int wol_filter_id;
|
||||
};
|
||||
|
||||
extern struct efx_nic_type falcon_a1_nic_type;
|
||||
extern struct efx_nic_type falcon_b0_nic_type;
|
||||
extern struct efx_nic_type siena_a0_nic_type;
|
||||
extern const struct efx_nic_type falcon_a1_nic_type;
|
||||
extern const struct efx_nic_type falcon_b0_nic_type;
|
||||
extern const struct efx_nic_type siena_a0_nic_type;
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
|
@ -13,14 +13,14 @@
|
||||
/****************************************************************************
|
||||
* 10Xpress (SFX7101) PHY
|
||||
*/
|
||||
extern struct efx_phy_operations falcon_sfx7101_phy_ops;
|
||||
extern const struct efx_phy_operations falcon_sfx7101_phy_ops;
|
||||
|
||||
extern void tenxpress_set_id_led(struct efx_nic *efx, enum efx_led_mode mode);
|
||||
|
||||
/****************************************************************************
|
||||
* AMCC/Quake QT202x PHYs
|
||||
*/
|
||||
extern struct efx_phy_operations falcon_qt202x_phy_ops;
|
||||
extern const struct efx_phy_operations falcon_qt202x_phy_ops;
|
||||
|
||||
/* These PHYs provide various H/W control states for LEDs */
|
||||
#define QUAKE_LED_LINK_INVAL (0)
|
||||
@ -39,7 +39,7 @@ extern void falcon_qt202x_set_led(struct efx_nic *p, int led, int state);
|
||||
/****************************************************************************
|
||||
* Transwitch CX4 retimer
|
||||
*/
|
||||
extern struct efx_phy_operations falcon_txc_phy_ops;
|
||||
extern const struct efx_phy_operations falcon_txc_phy_ops;
|
||||
|
||||
#define TXC_GPIO_DIR_INPUT 0
|
||||
#define TXC_GPIO_DIR_OUTPUT 1
|
||||
@ -50,7 +50,7 @@ extern void falcon_txc_set_gpio_val(struct efx_nic *efx, int pin, int val);
|
||||
/****************************************************************************
|
||||
* Siena managed PHYs
|
||||
*/
|
||||
extern struct efx_phy_operations efx_mcdi_phy_ops;
|
||||
extern const struct efx_phy_operations efx_mcdi_phy_ops;
|
||||
|
||||
extern int efx_mcdi_mdio_read(struct efx_nic *efx, unsigned int bus,
|
||||
unsigned int prtad, unsigned int devad,
|
||||
|
@ -449,7 +449,7 @@ static void qt202x_phy_remove(struct efx_nic *efx)
|
||||
efx->phy_data = NULL;
|
||||
}
|
||||
|
||||
struct efx_phy_operations falcon_qt202x_phy_ops = {
|
||||
const struct efx_phy_operations falcon_qt202x_phy_ops = {
|
||||
.probe = qt202x_phy_probe,
|
||||
.init = qt202x_phy_init,
|
||||
.reconfigure = qt202x_phy_reconfigure,
|
||||
|
@ -581,7 +581,7 @@ static void siena_init_wol(struct efx_nic *efx)
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
struct efx_nic_type siena_a0_nic_type = {
|
||||
const struct efx_nic_type siena_a0_nic_type = {
|
||||
.probe = siena_probe_nic,
|
||||
.remove = siena_remove_nic,
|
||||
.init = siena_init_nic,
|
||||
|
@ -478,7 +478,7 @@ static void sfx7101_set_npage_adv(struct efx_nic *efx, u32 advertising)
|
||||
advertising & ADVERTISED_10000baseT_Full);
|
||||
}
|
||||
|
||||
struct efx_phy_operations falcon_sfx7101_phy_ops = {
|
||||
const struct efx_phy_operations falcon_sfx7101_phy_ops = {
|
||||
.probe = tenxpress_phy_probe,
|
||||
.init = tenxpress_phy_init,
|
||||
.reconfigure = tenxpress_phy_reconfigure,
|
||||
|
@ -545,7 +545,7 @@ static void txc43128_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
|
||||
mdio45_ethtool_gset(&efx->mdio, ecmd);
|
||||
}
|
||||
|
||||
struct efx_phy_operations falcon_txc_phy_ops = {
|
||||
const struct efx_phy_operations falcon_txc_phy_ops = {
|
||||
.probe = txc43128_phy_probe,
|
||||
.init = txc43128_phy_init,
|
||||
.reconfigure = txc43128_phy_reconfigure,
|
||||
|
Loading…
Reference in New Issue
Block a user