Skip to content

Commit c90d160

Browse files
arjunvynipadathdavem330
authored andcommitted
cxgb4: Support ethtool private flags
This is used to change TX workrequests, which helps in host->vf communication. Signed-off-by: Arjun Vynipadath <[email protected]> Signed-off-by: Casey Leedom <[email protected]> Signed-off-by: Ganesh Goudar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d5fbda6 commit c90d160

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ static char loopback_stats_strings[][ETH_GSTRING_LEN] = {
177177
"bg3_frames_trunc ",
178178
};
179179

180+
static const char cxgb4_priv_flags_strings[][ETH_GSTRING_LEN] = {
181+
[PRIV_FLAG_PORT_TX_VM_BIT] = "port_tx_vm_wr",
182+
};
183+
180184
static int get_sset_count(struct net_device *dev, int sset)
181185
{
182186
switch (sset) {
@@ -185,6 +189,8 @@ static int get_sset_count(struct net_device *dev, int sset)
185189
ARRAY_SIZE(adapter_stats_strings) +
186190
ARRAY_SIZE(channel_stats_strings) +
187191
ARRAY_SIZE(loopback_stats_strings);
192+
case ETH_SS_PRIV_FLAGS:
193+
return ARRAY_SIZE(cxgb4_priv_flags_strings);
188194
default:
189195
return -EOPNOTSUPP;
190196
}
@@ -235,6 +241,7 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
235241
FW_HDR_FW_VER_MINOR_G(exprom_vers),
236242
FW_HDR_FW_VER_MICRO_G(exprom_vers),
237243
FW_HDR_FW_VER_BUILD_G(exprom_vers));
244+
info->n_priv_flags = ARRAY_SIZE(cxgb4_priv_flags_strings);
238245
}
239246

240247
static void get_strings(struct net_device *dev, u32 stringset, u8 *data)
@@ -250,6 +257,9 @@ static void get_strings(struct net_device *dev, u32 stringset, u8 *data)
250257
data += sizeof(channel_stats_strings);
251258
memcpy(data, loopback_stats_strings,
252259
sizeof(loopback_stats_strings));
260+
} else if (stringset == ETH_SS_PRIV_FLAGS) {
261+
memcpy(data, cxgb4_priv_flags_strings,
262+
sizeof(cxgb4_priv_flags_strings));
253263
}
254264
}
255265

@@ -1499,6 +1509,36 @@ static int cxgb4_get_module_eeprom(struct net_device *dev,
14991509
offset, len, &data[eprom->len - len]);
15001510
}
15011511

1512+
static u32 cxgb4_get_priv_flags(struct net_device *netdev)
1513+
{
1514+
struct port_info *pi = netdev_priv(netdev);
1515+
struct adapter *adapter = pi->adapter;
1516+
1517+
return (adapter->eth_flags | pi->eth_flags);
1518+
}
1519+
1520+
/**
1521+
* set_flags - set/unset specified flags if passed in new_flags
1522+
* @cur_flags: pointer to current flags
1523+
* @new_flags: new incoming flags
1524+
* @flags: set of flags to set/unset
1525+
*/
1526+
static inline void set_flags(u32 *cur_flags, u32 new_flags, u32 flags)
1527+
{
1528+
*cur_flags = (*cur_flags & ~flags) | (new_flags & flags);
1529+
}
1530+
1531+
static int cxgb4_set_priv_flags(struct net_device *netdev, u32 flags)
1532+
{
1533+
struct port_info *pi = netdev_priv(netdev);
1534+
struct adapter *adapter = pi->adapter;
1535+
1536+
set_flags(&adapter->eth_flags, flags, PRIV_FLAGS_ADAP);
1537+
set_flags(&pi->eth_flags, flags, PRIV_FLAGS_PORT);
1538+
1539+
return 0;
1540+
}
1541+
15021542
static const struct ethtool_ops cxgb_ethtool_ops = {
15031543
.get_link_ksettings = get_link_ksettings,
15041544
.set_link_ksettings = set_link_ksettings,
@@ -1535,6 +1575,8 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
15351575
.get_dump_data = get_dump_data,
15361576
.get_module_info = cxgb4_get_module_info,
15371577
.get_module_eeprom = cxgb4_get_module_eeprom,
1578+
.get_priv_flags = cxgb4_get_priv_flags,
1579+
.set_priv_flags = cxgb4_set_priv_flags,
15381580
};
15391581

15401582
void cxgb4_set_ethtool_ops(struct net_device *netdev)

0 commit comments

Comments
 (0)