Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b75c3df authored by Peng Li's avatar Peng Li Committed by David S. Miller
Browse files

net: hns3: Add support for IFF_ALLMULTI flag



This patch adds support for IFF_ALLMULTI flag to HNS3 PF and VF
driver.

Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6c251711
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -316,7 +316,8 @@ struct hnae3_ae_ops {
	int (*set_loopback)(struct hnae3_handle *handle,
			    enum hnae3_loop loop_mode, bool en);

	void (*set_promisc_mode)(struct hnae3_handle *handle, u32 en);
	void (*set_promisc_mode)(struct hnae3_handle *handle, bool en_uc_pmc,
				 bool en_mc_pmc);
	int (*set_mtu)(struct hnae3_handle *handle, int new_mtu);

	void (*get_pauseparam)(struct hnae3_handle *handle,
+4 −2
Original line number Diff line number Diff line
@@ -415,9 +415,11 @@ static void hns3_nic_set_rx_mode(struct net_device *netdev)

	if (h->ae_algo->ops->set_promisc_mode) {
		if (netdev->flags & IFF_PROMISC)
			h->ae_algo->ops->set_promisc_mode(h, 1);
			h->ae_algo->ops->set_promisc_mode(h, true, true);
		else if (netdev->flags & IFF_ALLMULTI)
			h->ae_algo->ops->set_promisc_mode(h, false, true);
		else
			h->ae_algo->ops->set_promisc_mode(h, 0);
			h->ae_algo->ops->set_promisc_mode(h, false, false);
	}
	if (__dev_uc_sync(netdev, hns3_nic_uc_sync, hns3_nic_uc_unsync))
		netdev_err(netdev, "sync uc address fail\n");
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en)
	if (ret)
		return ret;

	h->ae_algo->ops->set_promisc_mode(h, en);
	h->ae_algo->ops->set_promisc_mode(h, en, en);

	return ret;
}
+4 −2
Original line number Diff line number Diff line
@@ -3580,13 +3580,15 @@ void hclge_promisc_param_init(struct hclge_promisc_param *param, bool en_uc,
	param->vf_id = vport_id;
}

static void hclge_set_promisc_mode(struct hnae3_handle *handle, u32 en)
static void hclge_set_promisc_mode(struct hnae3_handle *handle, bool en_uc_pmc,
				   bool en_mc_pmc)
{
	struct hclge_vport *vport = hclge_get_vport(handle);
	struct hclge_dev *hdev = vport->back;
	struct hclge_promisc_param param;

	hclge_promisc_param_init(&param, en, en, true, vport->vport_id);
	hclge_promisc_param_init(&param, en_uc_pmc, en_mc_pmc, true,
				 vport->vport_id);
	hclge_cmd_set_promisc_mode(hdev, &param);
}

+3 −2
Original line number Diff line number Diff line
@@ -190,11 +190,12 @@ static int hclge_map_unmap_ring_to_vf_vector(struct hclge_vport *vport, bool en,
static int hclge_set_vf_promisc_mode(struct hclge_vport *vport,
				     struct hclge_mbx_vf_to_pf_cmd *req)
{
	bool en = req->msg[1] ? true : false;
	bool en_uc = req->msg[1] ? true : false;
	bool en_mc = req->msg[2] ? true : false;
	struct hclge_promisc_param param;

	/* always enable broadcast promisc bit */
	hclge_promisc_param_init(&param, en, en, true, vport->vport_id);
	hclge_promisc_param_init(&param, en_uc, en_mc, true, vport->vport_id);
	return hclge_cmd_set_promisc_mode(vport->back, &param);
}

Loading