Skip to content

Commit bb9f80f

Browse files
emuslndavem330
authored andcommitted
ionic: use lif ident for filter count
Use the lif's ident information for the uc and mc filter counts rather than the ionic's version, to be sure we're getting the info that is specific to this lif. While we're thinking about it, add some missing error checking where we get the lif's identity information. Signed-off-by: Shannon Nelson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a21b5d4 commit bb9f80f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

drivers/net/ethernet/pensando/ionic/ionic_lif.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,6 @@ static int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr)
10221022
static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add,
10231023
bool can_sleep)
10241024
{
1025-
struct ionic *ionic = lif->ionic;
10261025
struct ionic_deferred_work *work;
10271026
unsigned int nmfilters;
10281027
unsigned int nufilters;
@@ -1032,8 +1031,8 @@ static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add,
10321031
* here before checking the need for deferral so that we
10331032
* can return an overflow error to the stack.
10341033
*/
1035-
nmfilters = le32_to_cpu(ionic->ident.lif.eth.max_mcast_filters);
1036-
nufilters = le32_to_cpu(ionic->ident.lif.eth.max_ucast_filters);
1034+
nmfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters);
1035+
nufilters = le32_to_cpu(lif->identity->eth.max_ucast_filters);
10371036

10381037
if ((is_multicast_ether_addr(addr) && lif->nmcast < nmfilters))
10391038
lif->nmcast++;
@@ -1162,12 +1161,9 @@ static void ionic_dev_uc_sync(struct net_device *netdev, bool from_ndo)
11621161
static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo)
11631162
{
11641163
struct ionic_lif *lif = netdev_priv(netdev);
1165-
struct ionic_identity *ident;
11661164
unsigned int nfilters;
11671165
unsigned int rx_mode;
11681166

1169-
ident = &lif->ionic->ident;
1170-
11711167
rx_mode = IONIC_RX_MODE_F_UNICAST;
11721168
rx_mode |= (netdev->flags & IFF_MULTICAST) ? IONIC_RX_MODE_F_MULTICAST : 0;
11731169
rx_mode |= (netdev->flags & IFF_BROADCAST) ? IONIC_RX_MODE_F_BROADCAST : 0;
@@ -1182,7 +1178,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo)
11821178
* to see if we can disable NIC PROMISC
11831179
*/
11841180
ionic_dev_uc_sync(netdev, from_ndo);
1185-
nfilters = le32_to_cpu(ident->lif.eth.max_ucast_filters);
1181+
nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters);
11861182
if (netdev_uc_count(netdev) + 1 > nfilters) {
11871183
rx_mode |= IONIC_RX_MODE_F_PROMISC;
11881184
lif->uc_overflow = true;
@@ -1194,7 +1190,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo)
11941190

11951191
/* same for multicast */
11961192
ionic_dev_uc_sync(netdev, from_ndo);
1197-
nfilters = le32_to_cpu(ident->lif.eth.max_mcast_filters);
1193+
nfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters);
11981194
if (netdev_mc_count(netdev) > nfilters) {
11991195
rx_mode |= IONIC_RX_MODE_F_ALLMULTI;
12001196
lif->mc_overflow = true;
@@ -2425,7 +2421,12 @@ int ionic_lif_alloc(struct ionic *ionic)
24252421

24262422
lif->identity = lid;
24272423
lif->lif_type = IONIC_LIF_TYPE_CLASSIC;
2428-
ionic_lif_identify(ionic, lif->lif_type, lif->identity);
2424+
err = ionic_lif_identify(ionic, lif->lif_type, lif->identity);
2425+
if (err) {
2426+
dev_err(ionic->dev, "Cannot identify type %d: %d\n",
2427+
lif->lif_type, err);
2428+
goto err_out_free_netdev;
2429+
}
24292430
lif->netdev->min_mtu = max_t(unsigned int, ETH_MIN_MTU,
24302431
le32_to_cpu(lif->identity->eth.min_frame_size));
24312432
lif->netdev->max_mtu =

0 commit comments

Comments
 (0)