Skip to content

Commit

Permalink
net: liquidio: fix mixed module-builtin object
Browse files Browse the repository at this point in the history
With CONFIG_LIQUIDIO=m and CONFIG_LIQUIDIO_VF=y (or vice versa),
$(common-objs) are linked to a module and also to vmlinux even though
the expected CFLAGS are different between builtins and modules.

This is the same situation as fixed by commit 637a642 ("zstd:
Fixing mixed module-builtin objects").

Introduce the new module, liquidio-core, to provide the common functions
to liquidio and liquidio-vf.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Masahiro Yamada authored and David S. Miller committed Jun 7, 2023
1 parent 0824a98 commit f71be9d
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 3 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/cavium/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,17 @@ config CAVIUM_PTP
Precision Time Protocol or other purposes. Timestamps can be used in
BGX, TNS, GTI, and NIC blocks.

config LIQUIDIO_CORE
tristate

config LIQUIDIO
tristate "Cavium LiquidIO support"
depends on 64BIT && PCI
depends on PCI
depends on PTP_1588_CLOCK_OPTIONAL
select FW_LOADER
select LIBCRC32C
select LIQUIDIO_CORE
select NET_DEVLINK
help
This driver supports Cavium LiquidIO Intelligent Server Adapters
Expand All @@ -92,6 +96,7 @@ config LIQUIDIO_VF
tristate "Cavium LiquidIO VF support"
depends on 64BIT && PCI_MSI
depends on PTP_1588_CLOCK_OPTIONAL
select LIQUIDIO_CORE
help
This driver supports Cavium LiquidIO Intelligent Server Adapter
based on CN23XX chips.
Expand Down
8 changes: 5 additions & 3 deletions drivers/net/ethernet/cavium/liquidio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# Cavium Liquidio ethernet device driver
#

common-objs := lio_ethtool.o \
obj-$(CONFIG_LIQUIDIO_CORE) += liquidio-core.o
liquidio-core-y := \
lio_ethtool.o \
lio_core.o \
request_manager.o \
response_manager.o \
Expand All @@ -18,7 +20,7 @@ common-objs := lio_ethtool.o \
octeon_nic.o

obj-$(CONFIG_LIQUIDIO) += liquidio.o
liquidio-y := lio_main.o octeon_console.o lio_vf_rep.o $(common-objs)
liquidio-y := lio_main.o octeon_console.o lio_vf_rep.o

obj-$(CONFIG_LIQUIDIO_VF) += liquidio_vf.o
liquidio_vf-y := lio_vf_main.o $(common-objs)
liquidio_vf-y := lio_vf_main.o
4 changes: 4 additions & 0 deletions drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,7 @@ int setup_cn23xx_octeon_pf_device(struct octeon_device *oct)

return 0;
}
EXPORT_SYMBOL_GPL(setup_cn23xx_octeon_pf_device);

int validate_cn23xx_pf_config_info(struct octeon_device *oct,
struct octeon_config *conf23xx)
Expand Down Expand Up @@ -1433,6 +1434,7 @@ int cn23xx_fw_loaded(struct octeon_device *oct)
val = octeon_read_csr64(oct, CN23XX_SLI_SCRATCH2);
return (val >> SCR2_BIT_FW_LOADED) & 1ULL;
}
EXPORT_SYMBOL_GPL(cn23xx_fw_loaded);

void cn23xx_tell_vf_its_macaddr_changed(struct octeon_device *oct, int vfidx,
u8 *mac)
Expand All @@ -1454,6 +1456,7 @@ void cn23xx_tell_vf_its_macaddr_changed(struct octeon_device *oct, int vfidx,
octeon_mbox_write(oct, &mbox_cmd);
}
}
EXPORT_SYMBOL_GPL(cn23xx_tell_vf_its_macaddr_changed);

static void
cn23xx_get_vf_stats_callback(struct octeon_device *oct,
Expand Down Expand Up @@ -1508,3 +1511,4 @@ int cn23xx_get_vf_stats(struct octeon_device *oct, int vfidx,

return 0;
}
EXPORT_SYMBOL_GPL(cn23xx_get_vf_stats);
3 changes: 3 additions & 0 deletions drivers/net/ethernet/cavium/liquidio/cn23xx_vf_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ void cn23xx_vf_ask_pf_to_do_flr(struct octeon_device *oct)

octeon_mbox_write(oct, &mbox_cmd);
}
EXPORT_SYMBOL_GPL(cn23xx_vf_ask_pf_to_do_flr);

static void octeon_pfvf_hs_callback(struct octeon_device *oct,
struct octeon_mbox_cmd *cmd,
Expand Down Expand Up @@ -466,6 +467,7 @@ int cn23xx_octeon_pfvf_handshake(struct octeon_device *oct)

return 0;
}
EXPORT_SYMBOL_GPL(cn23xx_octeon_pfvf_handshake);

static void cn23xx_handle_vf_mbox_intr(struct octeon_ioq_vector *ioq_vector)
{
Expand Down Expand Up @@ -678,3 +680,4 @@ int cn23xx_setup_octeon_vf_device(struct octeon_device *oct)

return 0;
}
EXPORT_SYMBOL_GPL(cn23xx_setup_octeon_vf_device);
1 change: 1 addition & 0 deletions drivers/net/ethernet/cavium/liquidio/cn66xx_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ int lio_setup_cn66xx_octeon_device(struct octeon_device *oct)

return 0;
}
EXPORT_SYMBOL_GPL(lio_setup_cn66xx_octeon_device);

int lio_validate_cn6xxx_config_info(struct octeon_device *oct,
struct octeon_config *conf6xxx)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/cavium/liquidio/cn68xx_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,4 @@ int lio_setup_cn68xx_octeon_device(struct octeon_device *oct)

return 0;
}
EXPORT_SYMBOL_GPL(lio_setup_cn68xx_octeon_device);
16 changes: 16 additions & 0 deletions drivers/net/ethernet/cavium/liquidio/lio_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#include "octeon_main.h"
#include "octeon_network.h"

MODULE_AUTHOR("Cavium Networks, <support@cavium.com>");
MODULE_LICENSE("GPL");

/* OOM task polling interval */
#define LIO_OOM_POLL_INTERVAL_MS 250

Expand Down Expand Up @@ -71,6 +74,7 @@ void lio_delete_glists(struct lio *lio)
kfree(lio->glist);
lio->glist = NULL;
}
EXPORT_SYMBOL_GPL(lio_delete_glists);

/**
* lio_setup_glists - Setup gather lists
Expand Down Expand Up @@ -154,6 +158,7 @@ int lio_setup_glists(struct octeon_device *oct, struct lio *lio, int num_iqs)

return 0;
}
EXPORT_SYMBOL_GPL(lio_setup_glists);

int liquidio_set_feature(struct net_device *netdev, int cmd, u16 param1)
{
Expand All @@ -180,6 +185,7 @@ int liquidio_set_feature(struct net_device *netdev, int cmd, u16 param1)
}
return ret;
}
EXPORT_SYMBOL_GPL(liquidio_set_feature);

void octeon_report_tx_completion_to_bql(void *txq, unsigned int pkts_compl,
unsigned int bytes_compl)
Expand Down Expand Up @@ -395,6 +401,7 @@ void liquidio_link_ctrl_cmd_completion(void *nctrl_ptr)
nctrl->ncmd.s.cmd);
}
}
EXPORT_SYMBOL_GPL(liquidio_link_ctrl_cmd_completion);

void octeon_pf_changed_vf_macaddr(struct octeon_device *oct, u8 *mac)
{
Expand Down Expand Up @@ -478,6 +485,7 @@ int setup_rx_oom_poll_fn(struct net_device *netdev)

return 0;
}
EXPORT_SYMBOL_GPL(setup_rx_oom_poll_fn);

void cleanup_rx_oom_poll_fn(struct net_device *netdev)
{
Expand All @@ -495,6 +503,7 @@ void cleanup_rx_oom_poll_fn(struct net_device *netdev)
}
}
}
EXPORT_SYMBOL_GPL(cleanup_rx_oom_poll_fn);

/* Runs in interrupt context. */
static void lio_update_txq_status(struct octeon_device *oct, int iq_num)
Expand Down Expand Up @@ -899,6 +908,7 @@ int liquidio_setup_io_queues(struct octeon_device *octeon_dev, int ifidx,

return 0;
}
EXPORT_SYMBOL_GPL(liquidio_setup_io_queues);

static
int liquidio_schedule_msix_droq_pkt_handler(struct octeon_droq *droq, u64 ret)
Expand Down Expand Up @@ -1194,6 +1204,7 @@ int octeon_setup_interrupt(struct octeon_device *oct, u32 num_ioqs)
}
return 0;
}
EXPORT_SYMBOL_GPL(octeon_setup_interrupt);

/**
* liquidio_change_mtu - Net device change_mtu
Expand Down Expand Up @@ -1256,6 +1267,7 @@ int liquidio_change_mtu(struct net_device *netdev, int new_mtu)
WRITE_ONCE(sc->caller_is_done, true);
return 0;
}
EXPORT_SYMBOL_GPL(liquidio_change_mtu);

int lio_wait_for_clean_oq(struct octeon_device *oct)
{
Expand All @@ -1279,6 +1291,7 @@ int lio_wait_for_clean_oq(struct octeon_device *oct)

return pending_pkts;
}
EXPORT_SYMBOL_GPL(lio_wait_for_clean_oq);

static void
octnet_nic_stats_callback(struct octeon_device *oct_dev,
Expand Down Expand Up @@ -1509,6 +1522,7 @@ void lio_fetch_stats(struct work_struct *work)

return;
}
EXPORT_SYMBOL_GPL(lio_fetch_stats);

int liquidio_set_speed(struct lio *lio, int speed)
{
Expand Down Expand Up @@ -1659,6 +1673,7 @@ int liquidio_get_speed(struct lio *lio)

return retval;
}
EXPORT_SYMBOL_GPL(liquidio_get_speed);

int liquidio_set_fec(struct lio *lio, int on_off)
{
Expand Down Expand Up @@ -1812,3 +1827,4 @@ int liquidio_get_fec(struct lio *lio)

return retval;
}
EXPORT_SYMBOL_GPL(liquidio_get_fec);
1 change: 1 addition & 0 deletions drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3180,3 +3180,4 @@ void liquidio_set_ethtool_ops(struct net_device *netdev)
else
netdev->ethtool_ops = &lio_ethtool_ops;
}
EXPORT_SYMBOL_GPL(liquidio_set_ethtool_ops);
Loading

0 comments on commit f71be9d

Please sign in to comment.