Thread (63 messages) 63 messages, 6 authors, 2019-06-27

Re: [PATCH net-next 09/18] ionic: Add the basic NDO callbacks for netdev support

From: Shannon Nelson <hidden>
Date: 2019-06-26 15:41:23

On 6/25/19 4:27 PM, Jakub Kicinski wrote:
On Thu, 20 Jun 2019 13:24:15 -0700, Shannon Nelson wrote:
quoted
+static int ionic_set_features(struct net_device *netdev,
+			      netdev_features_t features)
+{
+	struct lif *lif = netdev_priv(netdev);
+	int err;
+
+	netdev_dbg(netdev, "%s: lif->features=0x%08llx new_features=0x%08llx\n",
+		   __func__, (u64)lif->netdev->features, (u64)features);
+
+	err = ionic_set_nic_features(lif, features);
Presumably something gets added here in later patch?
This is a pass-through to the lif-specific function which does most of 
the work.
quoted
+	return err;
+}
+
+static int ionic_set_mac_address(struct net_device *netdev, void *sa)
+{
+	netdev_info(netdev, "%s: stubbed\n", __func__);
+	return 0;
+}
+
+static int ionic_change_mtu(struct net_device *netdev, int new_mtu)
+{
+	struct lif *lif = netdev_priv(netdev);
+	struct ionic_admin_ctx ctx = {
+		.work = COMPLETION_INITIALIZER_ONSTACK(ctx.work),
+		.cmd.lif_setattr = {
+			.opcode = CMD_OPCODE_LIF_SETATTR,
+			.index = cpu_to_le16(lif->index),
+			.attr = IONIC_LIF_ATTR_MTU,
+			.mtu = cpu_to_le32(new_mtu),
+		},
+	};
+	int err;
+
+	if (new_mtu < IONIC_MIN_MTU || new_mtu > IONIC_MAX_MTU) {
+		netdev_err(netdev, "Invalid MTU %d\n", new_mtu);
+		return -EINVAL;
+	}
We do the min/max checks in the core now (netdev->min_mtu,
netdev->max_mtu).  You'll have to keep this if out of tree,
unfortunately.
Got it.
quoted
+	err = ionic_adminq_post_wait(lif, &ctx);
+	if (err)
+		return err;
+
+	netdev->mtu = new_mtu;
+	err = ionic_reset_queues(lif);
+
+	return err;
+}
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help