Commit bb9f80f3 authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller

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: default avatarShannon Nelson <snelson@pensando.io>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a21b5d49
...@@ -1022,7 +1022,6 @@ static int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) ...@@ -1022,7 +1022,6 @@ static int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr)
static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add, static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add,
bool can_sleep) bool can_sleep)
{ {
struct ionic *ionic = lif->ionic;
struct ionic_deferred_work *work; struct ionic_deferred_work *work;
unsigned int nmfilters; unsigned int nmfilters;
unsigned int nufilters; unsigned int nufilters;
...@@ -1032,8 +1031,8 @@ static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add, ...@@ -1032,8 +1031,8 @@ static int ionic_lif_addr(struct ionic_lif *lif, const u8 *addr, bool add,
* here before checking the need for deferral so that we * here before checking the need for deferral so that we
* can return an overflow error to the stack. * can return an overflow error to the stack.
*/ */
nmfilters = le32_to_cpu(ionic->ident.lif.eth.max_mcast_filters); nmfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters);
nufilters = le32_to_cpu(ionic->ident.lif.eth.max_ucast_filters); nufilters = le32_to_cpu(lif->identity->eth.max_ucast_filters);
if ((is_multicast_ether_addr(addr) && lif->nmcast < nmfilters)) if ((is_multicast_ether_addr(addr) && lif->nmcast < nmfilters))
lif->nmcast++; lif->nmcast++;
...@@ -1162,12 +1161,9 @@ static void ionic_dev_uc_sync(struct net_device *netdev, bool from_ndo) ...@@ -1162,12 +1161,9 @@ static void ionic_dev_uc_sync(struct net_device *netdev, bool from_ndo)
static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo)
{ {
struct ionic_lif *lif = netdev_priv(netdev); struct ionic_lif *lif = netdev_priv(netdev);
struct ionic_identity *ident;
unsigned int nfilters; unsigned int nfilters;
unsigned int rx_mode; unsigned int rx_mode;
ident = &lif->ionic->ident;
rx_mode = IONIC_RX_MODE_F_UNICAST; rx_mode = IONIC_RX_MODE_F_UNICAST;
rx_mode |= (netdev->flags & IFF_MULTICAST) ? IONIC_RX_MODE_F_MULTICAST : 0; rx_mode |= (netdev->flags & IFF_MULTICAST) ? IONIC_RX_MODE_F_MULTICAST : 0;
rx_mode |= (netdev->flags & IFF_BROADCAST) ? IONIC_RX_MODE_F_BROADCAST : 0; 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) ...@@ -1182,7 +1178,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo)
* to see if we can disable NIC PROMISC * to see if we can disable NIC PROMISC
*/ */
ionic_dev_uc_sync(netdev, from_ndo); ionic_dev_uc_sync(netdev, from_ndo);
nfilters = le32_to_cpu(ident->lif.eth.max_ucast_filters); nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters);
if (netdev_uc_count(netdev) + 1 > nfilters) { if (netdev_uc_count(netdev) + 1 > nfilters) {
rx_mode |= IONIC_RX_MODE_F_PROMISC; rx_mode |= IONIC_RX_MODE_F_PROMISC;
lif->uc_overflow = true; lif->uc_overflow = true;
...@@ -1194,7 +1190,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo) ...@@ -1194,7 +1190,7 @@ static void ionic_set_rx_mode(struct net_device *netdev, bool from_ndo)
/* same for multicast */ /* same for multicast */
ionic_dev_uc_sync(netdev, from_ndo); ionic_dev_uc_sync(netdev, from_ndo);
nfilters = le32_to_cpu(ident->lif.eth.max_mcast_filters); nfilters = le32_to_cpu(lif->identity->eth.max_mcast_filters);
if (netdev_mc_count(netdev) > nfilters) { if (netdev_mc_count(netdev) > nfilters) {
rx_mode |= IONIC_RX_MODE_F_ALLMULTI; rx_mode |= IONIC_RX_MODE_F_ALLMULTI;
lif->mc_overflow = true; lif->mc_overflow = true;
...@@ -2425,7 +2421,12 @@ int ionic_lif_alloc(struct ionic *ionic) ...@@ -2425,7 +2421,12 @@ int ionic_lif_alloc(struct ionic *ionic)
lif->identity = lid; lif->identity = lid;
lif->lif_type = IONIC_LIF_TYPE_CLASSIC; lif->lif_type = IONIC_LIF_TYPE_CLASSIC;
ionic_lif_identify(ionic, lif->lif_type, lif->identity); err = ionic_lif_identify(ionic, lif->lif_type, lif->identity);
if (err) {
dev_err(ionic->dev, "Cannot identify type %d: %d\n",
lif->lif_type, err);
goto err_out_free_netdev;
}
lif->netdev->min_mtu = max_t(unsigned int, ETH_MIN_MTU, lif->netdev->min_mtu = max_t(unsigned int, ETH_MIN_MTU,
le32_to_cpu(lif->identity->eth.min_frame_size)); le32_to_cpu(lif->identity->eth.min_frame_size));
lif->netdev->max_mtu = lif->netdev->max_mtu =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment