* [PATCH net-next v3 3/5] net: aquantia: Implement rx/tx flow control ethtools callback
From: Igor Russkikh @ 2018-07-02 14:03 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
In-Reply-To: <cover.1530537192.git.igor.russkikh@aquantia.com>
Runtime change of pause frame configuration (rx/tx flow control)
via ethtool.
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
.../net/ethernet/aquantia/atlantic/aq_ethtool.c | 42 ++++++++++++++++++++++
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 6 +++-
.../aquantia/atlantic/hw_atl/hw_atl_utils.c | 1 +
.../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 26 ++++++++++++++
4 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
index 0624215..37f8460 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
@@ -285,6 +285,46 @@ static int aq_ethtool_set_coalesce(struct net_device *ndev,
return aq_nic_update_interrupt_moderation_settings(aq_nic);
}
+static void aq_ethtool_get_pauseparam(struct net_device *ndev,
+ struct ethtool_pauseparam *pause)
+{
+ struct aq_nic_s *aq_nic = netdev_priv(ndev);
+
+ pause->autoneg = 0;
+
+ if (aq_nic->aq_hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX)
+ pause->rx_pause = 1;
+ if (aq_nic->aq_hw->aq_nic_cfg->flow_control & AQ_NIC_FC_TX)
+ pause->tx_pause = 1;
+}
+
+static int aq_ethtool_set_pauseparam(struct net_device *ndev,
+ struct ethtool_pauseparam *pause)
+{
+ struct aq_nic_s *aq_nic = netdev_priv(ndev);
+ int err = 0;
+
+ if (!aq_nic->aq_fw_ops->set_flow_control)
+ return -EOPNOTSUPP;
+
+ if (pause->autoneg == AUTONEG_ENABLE)
+ return -EOPNOTSUPP;
+
+ if (pause->rx_pause)
+ aq_nic->aq_hw->aq_nic_cfg->flow_control |= AQ_NIC_FC_RX;
+ else
+ aq_nic->aq_hw->aq_nic_cfg->flow_control &= ~AQ_NIC_FC_RX;
+
+ if (pause->tx_pause)
+ aq_nic->aq_hw->aq_nic_cfg->flow_control |= AQ_NIC_FC_TX;
+ else
+ aq_nic->aq_hw->aq_nic_cfg->flow_control &= ~AQ_NIC_FC_TX;
+
+ err = aq_nic->aq_fw_ops->set_flow_control(aq_nic->aq_hw);
+
+ return err;
+}
+
static void aq_get_ringparam(struct net_device *ndev,
struct ethtool_ringparam *ring)
{
@@ -352,6 +392,8 @@ const struct ethtool_ops aq_ethtool_ops = {
.get_rxfh_indir_size = aq_ethtool_get_rss_indir_size,
.get_ringparam = aq_get_ringparam,
.set_ringparam = aq_set_ringparam,
+ .get_pauseparam = aq_ethtool_get_pauseparam,
+ .set_pauseparam = aq_ethtool_set_pauseparam,
.get_rxfh_key_size = aq_ethtool_get_rss_key_size,
.get_rxfh = aq_ethtool_get_rss,
.get_rxnfc = aq_ethtool_get_rxnfc,
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index e8cf93a..21cfb32 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -761,10 +761,14 @@ void aq_nic_get_link_ksettings(struct aq_nic_s *self,
ethtool_link_ksettings_add_link_mode(cmd, advertising,
100baseT_Full);
- if (self->aq_nic_cfg.flow_control)
+ if (self->aq_nic_cfg.flow_control & AQ_NIC_FC_RX)
ethtool_link_ksettings_add_link_mode(cmd, advertising,
Pause);
+ if (self->aq_nic_cfg.flow_control & AQ_NIC_FC_TX)
+ ethtool_link_ksettings_add_link_mode(cmd, advertising,
+ Asym_Pause);
+
if (self->aq_nic_cfg.aq_hw_caps->media_type == AQ_HW_MEDIA_TYPE_FIBRE)
ethtool_link_ksettings_add_link_mode(cmd, advertising, FIBRE);
else
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index 9d0a96d..e1feba5 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -834,4 +834,5 @@ const struct aq_fw_ops aq_fw_1x_ops = {
.set_state = hw_atl_utils_mpi_set_state,
.update_link_status = hw_atl_utils_mpi_get_link_status,
.update_stats = hw_atl_utils_update_stats,
+ .set_flow_control = NULL,
};
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
index a3e95f0..c1b671e 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -87,6 +87,19 @@ static int aq_fw2x_set_link_speed(struct aq_hw_s *self, u32 speed)
return 0;
}
+static void aq_fw2x_set_mpi_flow_control(struct aq_hw_s *self, u32 *mpi_state)
+{
+ if (self->aq_nic_cfg->flow_control & AQ_NIC_FC_RX)
+ *mpi_state |= BIT(CAPS_HI_PAUSE);
+ else
+ *mpi_state &= ~BIT(CAPS_HI_PAUSE);
+
+ if (self->aq_nic_cfg->flow_control & AQ_NIC_FC_TX)
+ *mpi_state |= BIT(CAPS_HI_ASYMMETRIC_PAUSE);
+ else
+ *mpi_state &= ~BIT(CAPS_HI_ASYMMETRIC_PAUSE);
+}
+
static int aq_fw2x_set_state(struct aq_hw_s *self,
enum hal_atl_utils_fw_state_e state)
{
@@ -95,6 +108,7 @@ static int aq_fw2x_set_state(struct aq_hw_s *self,
switch (state) {
case MPI_INIT:
mpi_state &= ~BIT(CAPS_HI_LINK_DROP);
+ aq_fw2x_set_mpi_flow_control(self, &mpi_state);
break;
case MPI_DEINIT:
mpi_state |= BIT(CAPS_HI_LINK_DROP);
@@ -201,6 +215,17 @@ static int aq_fw2x_update_stats(struct aq_hw_s *self)
return hw_atl_utils_update_stats(self);
}
+static int aq_fw2x_set_flow_control(struct aq_hw_s *self)
+{
+ u32 mpi_state = aq_hw_read_reg(self, HW_ATL_FW2X_MPI_CONTROL2_ADDR);
+
+ aq_fw2x_set_mpi_flow_control(self, &mpi_state);
+
+ aq_hw_write_reg(self, HW_ATL_FW2X_MPI_CONTROL2_ADDR, mpi_state);
+
+ return 0;
+}
+
const struct aq_fw_ops aq_fw_2x_ops = {
.init = aq_fw2x_init,
.deinit = aq_fw2x_deinit,
@@ -210,4 +235,5 @@ const struct aq_fw_ops aq_fw_2x_ops = {
.set_state = aq_fw2x_set_state,
.update_link_status = aq_fw2x_update_link_status,
.update_stats = aq_fw2x_update_stats,
+ .set_flow_control = aq_fw2x_set_flow_control,
};
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 2/5] net: aquantia: Improve adapter init/deinit logic
From: Igor Russkikh @ 2018-07-02 14:03 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
In-Reply-To: <cover.1530537192.git.igor.russkikh@aquantia.com>
We now pass link drop status to FW on init/deinit. This is required
to inform FW that driver took/released a control on link.
FW then will manage its own state and device power profile based
on this information. To improve management we remove mpi_set
function which ambiguously took both state and speed parameters.
Deinit callback is now a part of FW ops, as it actually manages the FW.
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 9 ++--
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 +-
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 1 -
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 1 -
.../aquantia/atlantic/hw_atl/hw_atl_utils.c | 53 ++++++++++++----------
.../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 31 ++++++++++++-
6 files changed, 66 insertions(+), 31 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
index 904cdfd..3aa36d5 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
@@ -202,25 +202,28 @@ struct aq_hw_ops {
int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version);
- int (*hw_deinit)(struct aq_hw_s *self);
-
int (*hw_set_power)(struct aq_hw_s *self, unsigned int power_state);
};
struct aq_fw_ops {
int (*init)(struct aq_hw_s *self);
+ int (*deinit)(struct aq_hw_s *self);
+
int (*reset)(struct aq_hw_s *self);
int (*get_mac_permanent)(struct aq_hw_s *self, u8 *mac);
int (*set_link_speed)(struct aq_hw_s *self, u32 speed);
- int (*set_state)(struct aq_hw_s *self, enum hal_atl_utils_fw_state_e state);
+ int (*set_state)(struct aq_hw_s *self,
+ enum hal_atl_utils_fw_state_e state);
int (*update_link_status)(struct aq_hw_s *self);
int (*update_stats)(struct aq_hw_s *self);
+
+ int (*set_flow_control)(struct aq_hw_s *self);
};
#endif /* AQ_HW_H */
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index ba6bbcf..e8cf93a 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -879,7 +879,7 @@ void aq_nic_deinit(struct aq_nic_s *self)
aq_vec_deinit(aq_vec);
if (self->power_state == AQ_HW_POWER_STATE_D0) {
- (void)self->aq_hw_ops->hw_deinit(self->aq_hw);
+ (void)self->aq_fw_ops->deinit(self->aq_hw);
} else {
(void)self->aq_hw_ops->hw_set_power(self->aq_hw,
self->power_state);
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
index 7fd6a7e..ed7fe6f 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
@@ -877,7 +877,6 @@ static int hw_atl_a0_hw_ring_rx_stop(struct aq_hw_s *self,
const struct aq_hw_ops hw_atl_ops_a0 = {
.hw_set_mac_address = hw_atl_a0_hw_mac_addr_set,
.hw_init = hw_atl_a0_hw_init,
- .hw_deinit = hw_atl_utils_hw_deinit,
.hw_set_power = hw_atl_utils_hw_set_power,
.hw_reset = hw_atl_a0_hw_reset,
.hw_start = hw_atl_a0_hw_start,
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index 4ea15b9..9dd4f49 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -935,7 +935,6 @@ static int hw_atl_b0_hw_ring_rx_stop(struct aq_hw_s *self,
const struct aq_hw_ops hw_atl_ops_b0 = {
.hw_set_mac_address = hw_atl_b0_hw_mac_addr_set,
.hw_init = hw_atl_b0_hw_init,
- .hw_deinit = hw_atl_utils_hw_deinit,
.hw_set_power = hw_atl_utils_hw_set_power,
.hw_reset = hw_atl_b0_hw_reset,
.hw_start = hw_atl_b0_hw_start,
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index e652d86..9d0a96d 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -30,10 +30,11 @@
#define HW_ATL_MPI_CONTROL_ADR 0x0368U
#define HW_ATL_MPI_STATE_ADR 0x036CU
-#define HW_ATL_MPI_STATE_MSK 0x00FFU
-#define HW_ATL_MPI_STATE_SHIFT 0U
-#define HW_ATL_MPI_SPEED_MSK 0xFFFF0000U
-#define HW_ATL_MPI_SPEED_SHIFT 16U
+#define HW_ATL_MPI_STATE_MSK 0x00FFU
+#define HW_ATL_MPI_STATE_SHIFT 0U
+#define HW_ATL_MPI_SPEED_MSK 0x00FF0000U
+#define HW_ATL_MPI_SPEED_SHIFT 16U
+#define HW_ATL_MPI_DIRTY_WAKE_MSK 0x02000000U
#define HW_ATL_MPI_DAISY_CHAIN_STATUS 0x704
#define HW_ATL_MPI_BOOT_EXIT_CODE 0x388
@@ -521,23 +522,24 @@ void hw_atl_utils_mpi_read_stats(struct aq_hw_s *self,
err_exit:;
}
-static int hw_atl_utils_mpi_set_speed(struct aq_hw_s *self, u32 speed)
+int hw_atl_utils_mpi_set_speed(struct aq_hw_s *self, u32 speed)
{
u32 val = aq_hw_read_reg(self, HW_ATL_MPI_CONTROL_ADR);
- val = (val & HW_ATL_MPI_STATE_MSK) | (speed << HW_ATL_MPI_SPEED_SHIFT);
+ val = val & ~HW_ATL_MPI_SPEED_MSK;
+ val |= speed << HW_ATL_MPI_SPEED_SHIFT;
aq_hw_write_reg(self, HW_ATL_MPI_CONTROL_ADR, val);
return 0;
}
-void hw_atl_utils_mpi_set(struct aq_hw_s *self,
- enum hal_atl_utils_fw_state_e state,
- u32 speed)
+int hw_atl_utils_mpi_set_state(struct aq_hw_s *self,
+ enum hal_atl_utils_fw_state_e state)
{
int err = 0;
u32 transaction_id = 0;
struct hw_aq_atl_utils_mbox_header mbox;
+ u32 val = aq_hw_read_reg(self, HW_ATL_MPI_CONTROL_ADR);
if (state == MPI_RESET) {
hw_atl_utils_mpi_read_mbox(self, &mbox);
@@ -551,21 +553,21 @@ void hw_atl_utils_mpi_set(struct aq_hw_s *self,
if (err < 0)
goto err_exit;
}
+ /* On interface DEINIT we disable DW (raise bit)
+ * Otherwise enable DW (clear bit)
+ */
+ if (state == MPI_DEINIT || state == MPI_POWER)
+ val |= HW_ATL_MPI_DIRTY_WAKE_MSK;
+ else
+ val &= ~HW_ATL_MPI_DIRTY_WAKE_MSK;
- aq_hw_write_reg(self, HW_ATL_MPI_CONTROL_ADR,
- (speed << HW_ATL_MPI_SPEED_SHIFT) | state);
+ /* Set new state bits */
+ val = val & ~HW_ATL_MPI_STATE_MSK;
+ val |= state & HW_ATL_MPI_STATE_MSK;
-err_exit:;
-}
-
-static int hw_atl_utils_mpi_set_state(struct aq_hw_s *self,
- enum hal_atl_utils_fw_state_e state)
-{
- u32 val = aq_hw_read_reg(self, HW_ATL_MPI_CONTROL_ADR);
-
- val = state | (val & HW_ATL_MPI_SPEED_MSK);
aq_hw_write_reg(self, HW_ATL_MPI_CONTROL_ADR, val);
- return 0;
+err_exit:
+ return err;
}
int hw_atl_utils_mpi_get_link_status(struct aq_hw_s *self)
@@ -721,16 +723,18 @@ void hw_atl_utils_hw_chip_features_init(struct aq_hw_s *self, u32 *p)
*p = chip_features;
}
-int hw_atl_utils_hw_deinit(struct aq_hw_s *self)
+static int hw_atl_fw1x_deinit(struct aq_hw_s *self)
{
- hw_atl_utils_mpi_set(self, MPI_DEINIT, 0x0U);
+ hw_atl_utils_mpi_set_speed(self, 0);
+ hw_atl_utils_mpi_set_state(self, MPI_DEINIT);
return 0;
}
int hw_atl_utils_hw_set_power(struct aq_hw_s *self,
unsigned int power_state)
{
- hw_atl_utils_mpi_set(self, MPI_POWER, 0x0U);
+ hw_atl_utils_mpi_set_speed(self, 0);
+ hw_atl_utils_mpi_set_state(self, MPI_POWER);
return 0;
}
@@ -823,6 +827,7 @@ int hw_atl_utils_get_fw_version(struct aq_hw_s *self, u32 *fw_version)
const struct aq_fw_ops aq_fw_1x_ops = {
.init = hw_atl_utils_mpi_create,
+ .deinit = hw_atl_fw1x_deinit,
.reset = NULL,
.get_mac_permanent = hw_atl_utils_get_mac_permanent,
.set_link_speed = hw_atl_utils_mpi_set_speed,
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
index 39cd3a2..a3e95f0 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -28,6 +28,10 @@
#define HW_ATL_FW2X_MPI_STATE_ADDR 0x370
#define HW_ATL_FW2X_MPI_STATE2_ADDR 0x374
+static int aq_fw2x_set_link_speed(struct aq_hw_s *self, u32 speed);
+static int aq_fw2x_set_state(struct aq_hw_s *self,
+ enum hal_atl_utils_fw_state_e state);
+
static int aq_fw2x_init(struct aq_hw_s *self)
{
int err = 0;
@@ -39,6 +43,16 @@ static int aq_fw2x_init(struct aq_hw_s *self)
return err;
}
+static int aq_fw2x_deinit(struct aq_hw_s *self)
+{
+ int err = aq_fw2x_set_link_speed(self, 0);
+
+ if (!err)
+ err = aq_fw2x_set_state(self, MPI_DEINIT);
+
+ return err;
+}
+
static enum hw_atl_fw2x_rate link_speed_mask_2fw2x_ratemask(u32 speed)
{
enum hw_atl_fw2x_rate rate = 0;
@@ -76,7 +90,21 @@ static int aq_fw2x_set_link_speed(struct aq_hw_s *self, u32 speed)
static int aq_fw2x_set_state(struct aq_hw_s *self,
enum hal_atl_utils_fw_state_e state)
{
- /* No explicit state in 2x fw */
+ u32 mpi_state = aq_hw_read_reg(self, HW_ATL_FW2X_MPI_CONTROL2_ADDR);
+
+ switch (state) {
+ case MPI_INIT:
+ mpi_state &= ~BIT(CAPS_HI_LINK_DROP);
+ break;
+ case MPI_DEINIT:
+ mpi_state |= BIT(CAPS_HI_LINK_DROP);
+ break;
+ case MPI_RESET:
+ case MPI_POWER:
+ /* No actions */
+ break;
+ }
+ aq_hw_write_reg(self, HW_ATL_FW2X_MPI_CONTROL2_ADDR, mpi_state);
return 0;
}
@@ -175,6 +203,7 @@ static int aq_fw2x_update_stats(struct aq_hw_s *self)
const struct aq_fw_ops aq_fw_2x_ops = {
.init = aq_fw2x_init,
+ .deinit = aq_fw2x_deinit,
.reset = NULL,
.get_mac_permanent = aq_fw2x_get_mac_permanent,
.set_link_speed = aq_fw2x_set_link_speed,
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 1/5] net: aquantia: Ethtool based ring size configuration
From: Igor Russkikh @ 2018-07-02 14:03 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh, Anton Mikaev
In-Reply-To: <cover.1530537192.git.igor.russkikh@aquantia.com>
From: Anton Mikaev <amikaev@aquantia.com>
Implemented ring size setup, min/max validation and reconfiguration in
runtime.
Signed-off-by: Anton Mikaev <amikaev@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
.../net/ethernet/aquantia/atlantic/aq_ethtool.c | 61 ++++++++++++++++++++++
drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 9 +++-
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 +-
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 46 ++++++++--------
.../aquantia/atlantic/hw_atl/hw_atl_a0_internal.h | 8 +++
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 50 +++++++++---------
.../aquantia/atlantic/hw_atl/hw_atl_b0_internal.h | 8 +++
7 files changed, 136 insertions(+), 50 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
index f2d8063..0624215 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
@@ -11,6 +11,7 @@
#include "aq_ethtool.h"
#include "aq_nic.h"
+#include "aq_vec.h"
static void aq_ethtool_get_regs(struct net_device *ndev,
struct ethtool_regs *regs, void *p)
@@ -284,6 +285,64 @@ static int aq_ethtool_set_coalesce(struct net_device *ndev,
return aq_nic_update_interrupt_moderation_settings(aq_nic);
}
+static void aq_get_ringparam(struct net_device *ndev,
+ struct ethtool_ringparam *ring)
+{
+ struct aq_nic_s *aq_nic = netdev_priv(ndev);
+ struct aq_nic_cfg_s *aq_nic_cfg = aq_nic_get_cfg(aq_nic);
+
+ ring->rx_pending = aq_nic_cfg->rxds;
+ ring->tx_pending = aq_nic_cfg->txds;
+
+ ring->rx_max_pending = aq_nic_cfg->aq_hw_caps->rxds_max;
+ ring->tx_max_pending = aq_nic_cfg->aq_hw_caps->txds_max;
+}
+
+static int aq_set_ringparam(struct net_device *ndev,
+ struct ethtool_ringparam *ring)
+{
+ int err = 0;
+ bool ndev_running = false;
+ struct aq_nic_s *aq_nic = netdev_priv(ndev);
+ struct aq_nic_cfg_s *aq_nic_cfg = aq_nic_get_cfg(aq_nic);
+ const struct aq_hw_caps_s *hw_caps = aq_nic_cfg->aq_hw_caps;
+
+ if (ring->rx_mini_pending || ring->rx_jumbo_pending) {
+ err = -EOPNOTSUPP;
+ goto err_exit;
+ }
+
+ if (netif_running(ndev)) {
+ ndev_running = true;
+ dev_close(ndev);
+ }
+
+ aq_nic_free_vectors(aq_nic);
+
+ aq_nic_cfg->rxds = max(ring->rx_pending, hw_caps->rxds_min);
+ aq_nic_cfg->rxds = min(aq_nic_cfg->rxds, hw_caps->rxds_max);
+ aq_nic_cfg->rxds = ALIGN(aq_nic_cfg->rxds, AQ_HW_RXD_MULTIPLE);
+
+ aq_nic_cfg->txds = max(ring->tx_pending, hw_caps->txds_min);
+ aq_nic_cfg->txds = min(aq_nic_cfg->txds, hw_caps->txds_max);
+ aq_nic_cfg->txds = ALIGN(aq_nic_cfg->txds, AQ_HW_TXD_MULTIPLE);
+
+ for (aq_nic->aq_vecs = 0; aq_nic->aq_vecs < aq_nic_cfg->vecs;
+ aq_nic->aq_vecs++) {
+ aq_nic->aq_vec[aq_nic->aq_vecs] =
+ aq_vec_alloc(aq_nic, aq_nic->aq_vecs, aq_nic_cfg);
+ if (unlikely(!aq_nic->aq_vec[aq_nic->aq_vecs])) {
+ err = -ENOMEM;
+ goto err_exit;
+ }
+ }
+ if (ndev_running)
+ err = dev_open(ndev);
+
+err_exit:
+ return err;
+}
+
const struct ethtool_ops aq_ethtool_ops = {
.get_link = aq_ethtool_get_link,
.get_regs_len = aq_ethtool_get_regs_len,
@@ -291,6 +350,8 @@ const struct ethtool_ops aq_ethtool_ops = {
.get_drvinfo = aq_ethtool_get_drvinfo,
.get_strings = aq_ethtool_get_strings,
.get_rxfh_indir_size = aq_ethtool_get_rss_indir_size,
+ .get_ringparam = aq_get_ringparam,
+ .set_ringparam = aq_set_ringparam,
.get_rxfh_key_size = aq_ethtool_get_rss_key_size,
.get_rxfh = aq_ethtool_get_rss,
.get_rxnfc = aq_ethtool_get_rxnfc,
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
index a2d416b..904cdfd 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
@@ -24,8 +24,10 @@ struct aq_hw_caps_s {
u64 link_speed_msk;
unsigned int hw_priv_flags;
u32 media_type;
- u32 rxds;
- u32 txds;
+ u32 rxds_max;
+ u32 txds_max;
+ u32 rxds_min;
+ u32 txds_min;
u32 txhwb_alignment;
u32 irq_mask;
u32 vecs;
@@ -98,6 +100,9 @@ struct aq_stats_s {
#define AQ_HW_MEDIA_TYPE_TP 1U
#define AQ_HW_MEDIA_TYPE_FIBRE 2U
+#define AQ_HW_TXD_MULTIPLE 8U
+#define AQ_HW_RXD_MULTIPLE 8U
+
struct aq_hw_s {
atomic_t flags;
u8 rbl_enabled:1;
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 1a1a638..ba6bbcf 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -89,8 +89,8 @@ void aq_nic_cfg_start(struct aq_nic_s *self)
aq_nic_rss_init(self, cfg->num_rss_queues);
/*descriptors */
- cfg->rxds = min(cfg->aq_hw_caps->rxds, AQ_CFG_RXDS_DEF);
- cfg->txds = min(cfg->aq_hw_caps->txds, AQ_CFG_TXDS_DEF);
+ cfg->rxds = min(cfg->aq_hw_caps->rxds_max, AQ_CFG_RXDS_DEF);
+ cfg->txds = min(cfg->aq_hw_caps->txds_max, AQ_CFG_TXDS_DEF);
/*rss rings */
cfg->vecs = min(cfg->aq_hw_caps->vecs, AQ_CFG_VECS_DEF);
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
index 67e2f9f..7fd6a7e 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
@@ -19,29 +19,31 @@
#include "hw_atl_a0_internal.h"
#define DEFAULT_A0_BOARD_BASIC_CAPABILITIES \
- .is_64_dma = true, \
- .msix_irqs = 4U, \
- .irq_mask = ~0U, \
- .vecs = HW_ATL_A0_RSS_MAX, \
- .tcs = HW_ATL_A0_TC_MAX, \
- .rxd_alignment = 1U, \
- .rxd_size = HW_ATL_A0_RXD_SIZE, \
- .rxds = 248U, \
- .txd_alignment = 1U, \
- .txd_size = HW_ATL_A0_TXD_SIZE, \
- .txds = 8U * 1024U, \
- .txhwb_alignment = 4096U, \
- .tx_rings = HW_ATL_A0_TX_RINGS, \
- .rx_rings = HW_ATL_A0_RX_RINGS, \
- .hw_features = NETIF_F_HW_CSUM | \
- NETIF_F_RXHASH | \
- NETIF_F_RXCSUM | \
- NETIF_F_SG | \
- NETIF_F_TSO, \
+ .is_64_dma = true, \
+ .msix_irqs = 4U, \
+ .irq_mask = ~0U, \
+ .vecs = HW_ATL_A0_RSS_MAX, \
+ .tcs = HW_ATL_A0_TC_MAX, \
+ .rxd_alignment = 1U, \
+ .rxd_size = HW_ATL_A0_RXD_SIZE, \
+ .rxds_max = HW_ATL_A0_MAX_RXD, \
+ .rxds_min = HW_ATL_A0_MIN_RXD, \
+ .txd_alignment = 1U, \
+ .txd_size = HW_ATL_A0_TXD_SIZE, \
+ .txds_max = HW_ATL_A0_MAX_TXD, \
+ .txds_min = HW_ATL_A0_MIN_RXD, \
+ .txhwb_alignment = 4096U, \
+ .tx_rings = HW_ATL_A0_TX_RINGS, \
+ .rx_rings = HW_ATL_A0_RX_RINGS, \
+ .hw_features = NETIF_F_HW_CSUM | \
+ NETIF_F_RXHASH | \
+ NETIF_F_RXCSUM | \
+ NETIF_F_SG | \
+ NETIF_F_TSO, \
.hw_priv_flags = IFF_UNICAST_FLT, \
- .flow_control = true, \
- .mtu = HW_ATL_A0_MTU_JUMBO, \
- .mac_regs_count = 88, \
+ .flow_control = true, \
+ .mtu = HW_ATL_A0_MTU_JUMBO, \
+ .mac_regs_count = 88, \
.hw_alive_check_addr = 0x10U
const struct aq_hw_caps_s hw_atl_a0_caps_aqc100 = {
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h
index 1d88555..3c94cff 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0_internal.h
@@ -88,4 +88,12 @@
#define HW_ATL_A0_FW_VER_EXPECTED 0x01050006U
+#define HW_ATL_A0_MIN_RXD \
+ (ALIGN(AQ_CFG_SKB_FRAGS_MAX + 1U, AQ_HW_RXD_MULTIPLE))
+#define HW_ATL_A0_MIN_TXD \
+ (ALIGN(AQ_CFG_SKB_FRAGS_MAX + 1U, AQ_HW_TXD_MULTIPLE))
+
+#define HW_ATL_A0_MAX_RXD 8184U
+#define HW_ATL_A0_MAX_TXD 8184U
+
#endif /* HW_ATL_A0_INTERNAL_H */
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index 819f6bc..4ea15b9 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -20,30 +20,32 @@
#include "hw_atl_llh_internal.h"
#define DEFAULT_B0_BOARD_BASIC_CAPABILITIES \
- .is_64_dma = true, \
- .msix_irqs = 4U, \
- .irq_mask = ~0U, \
- .vecs = HW_ATL_B0_RSS_MAX, \
- .tcs = HW_ATL_B0_TC_MAX, \
- .rxd_alignment = 1U, \
- .rxd_size = HW_ATL_B0_RXD_SIZE, \
- .rxds = 4U * 1024U, \
- .txd_alignment = 1U, \
- .txd_size = HW_ATL_B0_TXD_SIZE, \
- .txds = 8U * 1024U, \
- .txhwb_alignment = 4096U, \
- .tx_rings = HW_ATL_B0_TX_RINGS, \
- .rx_rings = HW_ATL_B0_RX_RINGS, \
- .hw_features = NETIF_F_HW_CSUM | \
- NETIF_F_RXCSUM | \
- NETIF_F_RXHASH | \
- NETIF_F_SG | \
- NETIF_F_TSO | \
- NETIF_F_LRO, \
- .hw_priv_flags = IFF_UNICAST_FLT, \
- .flow_control = true, \
- .mtu = HW_ATL_B0_MTU_JUMBO, \
- .mac_regs_count = 88, \
+ .is_64_dma = true, \
+ .msix_irqs = 4U, \
+ .irq_mask = ~0U, \
+ .vecs = HW_ATL_B0_RSS_MAX, \
+ .tcs = HW_ATL_B0_TC_MAX, \
+ .rxd_alignment = 1U, \
+ .rxd_size = HW_ATL_B0_RXD_SIZE, \
+ .rxds_max = HW_ATL_B0_MAX_RXD, \
+ .rxds_min = HW_ATL_B0_MIN_RXD, \
+ .txd_alignment = 1U, \
+ .txd_size = HW_ATL_B0_TXD_SIZE, \
+ .txds_max = HW_ATL_B0_MAX_TXD, \
+ .txds_min = HW_ATL_B0_MIN_TXD, \
+ .txhwb_alignment = 4096U, \
+ .tx_rings = HW_ATL_B0_TX_RINGS, \
+ .rx_rings = HW_ATL_B0_RX_RINGS, \
+ .hw_features = NETIF_F_HW_CSUM | \
+ NETIF_F_RXCSUM | \
+ NETIF_F_RXHASH | \
+ NETIF_F_SG | \
+ NETIF_F_TSO | \
+ NETIF_F_LRO, \
+ .hw_priv_flags = IFF_UNICAST_FLT, \
+ .flow_control = true, \
+ .mtu = HW_ATL_B0_MTU_JUMBO, \
+ .mac_regs_count = 88, \
.hw_alive_check_addr = 0x10U
const struct aq_hw_caps_s hw_atl_b0_caps_aqc100 = {
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h
index 405d145..28568f5 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0_internal.h
@@ -142,6 +142,14 @@
#define HW_ATL_INTR_MODER_MAX 0x1FF
#define HW_ATL_INTR_MODER_MIN 0xFF
+#define HW_ATL_B0_MIN_RXD \
+ (ALIGN(AQ_CFG_SKB_FRAGS_MAX + 1U, AQ_HW_RXD_MULTIPLE))
+#define HW_ATL_B0_MIN_TXD \
+ (ALIGN(AQ_CFG_SKB_FRAGS_MAX + 1U, AQ_HW_TXD_MULTIPLE))
+
+#define HW_ATL_B0_MAX_RXD 8184U
+#define HW_ATL_B0_MAX_TXD 8184U
+
/* HW layer capabilities */
#endif /* HW_ATL_B0_INTERNAL_H */
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v3 0/5] net: aquantia: various ethtool ops implementation
From: Igor Russkikh @ 2018-07-02 14:03 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh
In this patchset Anton Mikaev and I added some useful ethtool operations:
- ring size changes
- link renegotioation
- flow control management
The patch also improves init/deinit sequence.
V3 changes:
- After review and analysis it is clear that rtnl lock (which is
captured by default on ethtool ops) is enough to secure possible
overlapping of dev open/close. Thus, just dropping internal mutex.
V2 changes:
- using mutex to secure simultaneous dev close/open
- using state var to store/restore dev state
Igor Russkikh (5):
net: aquantia: Ethtool based ring size configuration
net: aquantia: Improve adapter init/deinit logic
net: aquantia: Implement rx/tx flow control ethtools callback
net: aquantia: Add renegotiate ethtool operation support
net: aquantia: bump driver version
.../net/ethernet/aquantia/atlantic/aq_ethtool.c | 117 +++++++++++++++++++++
drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 20 +++-
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 12 ++-
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c | 47 +++++----
.../aquantia/atlantic/hw_atl/hw_atl_a0_internal.h | 8 ++
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 51 ++++-----
.../aquantia/atlantic/hw_atl/hw_atl_b0_internal.h | 8 ++
.../aquantia/atlantic/hw_atl/hw_atl_utils.c | 54 +++++-----
.../aquantia/atlantic/hw_atl/hw_atl_utils.h | 35 ++++++
.../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 69 +++++++++++-
drivers/net/ethernet/aquantia/atlantic/ver.h | 4 +-
11 files changed, 341 insertions(+), 84 deletions(-)
--
2.7.4
^ permalink raw reply
* Re: [PATCH net-next v2 1/2] net: phy: DP83TC811: Add INT_STAT3
From: Dan Murphy @ 2018-07-02 14:00 UTC (permalink / raw)
To: Andrew Lunn; +Cc: f.fainelli, netdev, linux-kernel
In-Reply-To: <ee9220f3-4e93-0054-d94b-97c3756fb38d@ti.com>
Andrew
On 06/29/2018 11:17 AM, Dan Murphy wrote:
> Andrew
>
> On 06/29/2018 10:45 AM, Andrew Lunn wrote:
>> On Fri, Jun 29, 2018 at 10:35:45AM -0500, Dan Murphy wrote:
>>> Add INT_STAT3 interrupt setting and clearing
>>> support.
>>>
>>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
>>> ---
>>>
>>> v2 - Removed bug fix removal of writing INT_STAT1 twice when disabling interrupts
>>>
>>> drivers/net/phy/dp83tc811.c | 26 ++++++++++++++++++++++++++
>>> 1 file changed, 26 insertions(+)
>>>
>>> diff --git a/drivers/net/phy/dp83tc811.c b/drivers/net/phy/dp83tc811.c
>>> index 49ac678eb2dc..f8653f5d8789 100644
>>> --- a/drivers/net/phy/dp83tc811.c
>>> +++ b/drivers/net/phy/dp83tc811.c
>>> @@ -21,6 +21,7 @@
>>> #define MII_DP83811_SGMII_CTRL 0x09
>>> #define MII_DP83811_INT_STAT1 0x12
>>> #define MII_DP83811_INT_STAT2 0x13
>>> +#define MII_DP83811_INT_STAT3 0x18
>>> #define MII_DP83811_RESET_CTRL 0x1f
>>>
>>> #define DP83811_HW_RESET BIT(15)
>>> @@ -44,6 +45,11 @@
>>> #define DP83811_OVERVOLTAGE_INT_EN BIT(6)
>>> #define DP83811_UNDERVOLTAGE_INT_EN BIT(7)
>>>
>>> +/* INT_STAT3 bits */
>>> +#define DP83811_LPS_INT_EN BIT(0)
>>> +#define DP83811_NO_FRAME_INT_EN BIT(3)
>>> +#define DP83811_POR_DONE_INT_EN BIT(4)
>>> +
>>> #define MII_DP83811_RXSOP1 0x04a5
>>> #define MII_DP83811_RXSOP2 0x04a6
>>> #define MII_DP83811_RXSOP3 0x04a7
>>> @@ -81,6 +87,10 @@ static int dp83811_ack_interrupt(struct phy_device *phydev)
>>> if (err < 0)
>>> return err;
>>>
>>> + err = phy_read(phydev, MII_DP83811_INT_STAT3);
>>> + if (err < 0)
>>> + return err;
>>> +
>>> return 0;
>>> }
>>>
>>> @@ -216,6 +226,18 @@ static int dp83811_config_intr(struct phy_device *phydev)
>>> DP83811_UNDERVOLTAGE_INT_EN);
>>>
>>> err = phy_write(phydev, MII_DP83811_INT_STAT2, misr_status);
>>
>> Hi Dan
>>
>> Isn't this going to fail to apply because net-next says STAT1 here?
>>
>
> Yes but this should not be a pre-requisite for a code review.
>
> Maybe I should have put the RFC in the subject.
>
>> That is why i said you need to wait for David to merge net into
>> net-next. Then you can submit these patches, and not have conflicts.
>>
David has applied the pre-requisite patch so this series can be review and tested.
Dan
>> Andrew
>>
>
>
--
------------------
Dan Murphy
^ permalink raw reply
* Re: [PATCH] ieee802154: add rx LQI from userspace
From: Stefan Schmidt @ 2018-07-02 13:58 UTC (permalink / raw)
To: Clément Péron, Romuald Cari, linux-wpan
Cc: Alexander Aring, Stefan Schmidt, David S . Miller, netdev,
linux-kernel, Clément Peron
In-Reply-To: <CAJiuCcdCE42FvWc0svNpQDD0rczYi7Xz-RW5PbbjAuvZe9dgwg@mail.gmail.com>
Hello.
On 02/07/2018 15:28, Clément Péron wrote:
> Could you review it please ?
>
Yes, I will. Sorry for the delay, I am just back from 4 weeks parental
leave. A few thousand mails top go through in total.
If you could bare with me for a few more days that would be appreciated.
I have all the patches I need to review here marked in my local inbox
already.
regards
Stefan Schmidt
^ permalink raw reply
* Re: [PATCH V2 net-next 0/9] net: hns3: a few code improvements
From: David Miller @ 2018-07-02 13:50 UTC (permalink / raw)
To: lipeng321; +Cc: netdev, linux-kernel, linuxarm, yisen.zhuang, salil.mehta
In-Reply-To: <1530517826-69226-1-git-send-email-lipeng321@huawei.com>
From: Peng Li <lipeng321@huawei.com>
Date: Mon, 2 Jul 2018 15:50:17 +0800
> This patchset removes some redundant code and fixes a few code
> stylistic issues from internal concentrated review,
> no functional changes introduced.
>
> ---
> Change log:
> V1 -> V2:
> 1, remove a patch according to the comment reported by David Miller.
Series applied, thank you.
^ permalink raw reply
* Re: [PATCH] atm: zatm: remove redundant pointer zatm_dev
From: David Miller @ 2018-07-02 13:47 UTC (permalink / raw)
To: colin.king
Cc: 3chas3, linux-atm-general, netdev, kernel-janitors, linux-kernel
In-Reply-To: <20180702073721.10272-1-colin.king@canonical.com>
From: Colin King <colin.king@canonical.com>
Date: Mon, 2 Jul 2018 08:37:21 +0100
> From: Colin Ian King <colin.king@canonical.com>
>
> Pointer zatm_dev is being assigned but is never used hence it is redundant
> and can be removed.
>
> Cleans up clang warning:
> warning: variable 'zatm_dev' set but not used [-Wunused-but-set-variable]
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net: phy: realtek: add support for RTL8211C
From: David Miller @ 2018-07-02 13:46 UTC (permalink / raw)
To: hkallweit1; +Cc: andrew, f.fainelli, nic_swsd, netdev
In-Reply-To: <286436a6-c4ef-7df8-59da-bf74f62c1e0b@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Mon, 2 Jul 2018 08:08:13 +0200
> RTL8211C has an issue when operating in Gigabit slave mode, therefore
> genphy driver can't be used. See also this U-boot change.
> https://lists.denx.de/pipermail/u-boot/2016-March/249712.html
>
> Add a PHY driver for this chip with the quirk to force Gigabit master
> mode. As a note: This will make it impossible to connect two network
> ports directly which both are driven by a RTl8211C.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 1/1] net sched actions: add extack messages in pedit action
From: David Miller @ 2018-07-02 13:44 UTC (permalink / raw)
To: mrv; +Cc: netdev, kernel, jhs, xiyou.wangcong, jiri
In-Reply-To: <1530504122-15283-1-git-send-email-mrv@mojatatu.com>
From: Roman Mashak <mrv@mojatatu.com>
Date: Mon, 2 Jul 2018 00:02:02 -0400
> Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Applied.
^ permalink raw reply
* Re: [PATCH] TTY: isdn: Replace strncpy with memcpy
From: David Miller @ 2018-07-02 13:43 UTC (permalink / raw)
To: linux; +Cc: isdn, keescook, linux-kernel, netdev
In-Reply-To: <1530478658-23070-1-git-send-email-linux@roeck-us.net>
From: Guenter Roeck <linux@roeck-us.net>
Date: Sun, 1 Jul 2018 13:57:38 -0700
> gcc 8.1.0 complains:
>
> drivers/isdn/i4l/isdn_tty.c: In function 'isdn_tty_suspend.isra.1':
> drivers/isdn/i4l/isdn_tty.c:790:3: warning:
> 'strncpy' output truncated before terminating nul copying
> as many bytes from a string as its length
> drivers/isdn/i4l/isdn_tty.c:778:6: note: length computed here
>
> drivers/isdn/i4l/isdn_tty.c: In function 'isdn_tty_resume':
> drivers/isdn/i4l/isdn_tty.c:880:3: warning:
> 'strncpy' output truncated before terminating nul copying
> as many bytes from a string as its length
> drivers/isdn/i4l/isdn_tty.c:817:6: note: length computed here
>
> Using strncpy() is indeed less than perfect since the length of data to
> be copied has already been determined with strlen(). Replace strncpy()
> with memcpy() to address the warning and optimize the code a little.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] net: phy: realtek: add missing entry for RTL8211 to mdio_device_id table
From: David Miller @ 2018-07-02 13:42 UTC (permalink / raw)
To: hkallweit1; +Cc: andrew, f.fainelli, netdev
In-Reply-To: <f7caf788-6dde-6bfd-6f70-cc6231572ea2@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun, 1 Jul 2018 19:14:58 +0200
> When adding support for RTL8211 I forgot to update the mdio_device_id
> table.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> Fixes: d241d4aac93f ("net: phy: realtek: add support for RTL8211")
Applied.
^ permalink raw reply
* Re: [PATCH] net: expose sk wmem in sock_exceed_buf_limit tracepoint
From: David Miller @ 2018-07-02 13:42 UTC (permalink / raw)
To: laoar.shao; +Cc: satoru.moriya, netdev, linux-kernel
In-Reply-To: <1530459090-11037-1-git-send-email-laoar.shao@gmail.com>
From: Yafang Shao <laoar.shao@gmail.com>
Date: Sun, 1 Jul 2018 23:31:30 +0800
> Currently trace_sock_exceed_buf_limit() only show rmem info,
> but wmem limit may also be hit.
> So expose wmem info in this tracepoint as well.
>
> Regarding memcg, I think it is better to introduce a new tracepoint(if
> that is needed), i.e. trace_memcg_limit_hit other than show memcg info in
> trace_sock_exceed_buf_limit.
>
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Applied to net-next.
^ permalink raw reply
* Re: [PATCH net-next] r8169: remove old PHY reset hack
From: David Miller @ 2018-07-02 13:42 UTC (permalink / raw)
To: hkallweit1; +Cc: nic_swsd, netdev
In-Reply-To: <bcb32d0d-3a7d-6514-d73a-5f06c7008bc7@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun, 1 Jul 2018 00:25:19 +0200
> This hack (affecting the non-PCIe models only) was introduced in 2004
> to deal with link negotiation failures in 1GBit mode. Based on a
> comment in the r8169 vendor driver I assume the issue affects RTL8169sb
> in combination with particular 1GBit switch models.
>
> Resetting the PHY every 10s and hoping that one fine day we will make
> it to establish the link seems to be very hacky to me. I'd say:
> If 1GBit doesn't work reliably in a users environment then the user
> should remove 1GBit from the advertised modes, e.g. by using
> ethtool -s <if> advertise <10/100 modes>
>
> If the issue affects one chip version only and that with most link
> partners, then we could also think of removing 1GBit from the
> advertised modes for this chip version in the driver.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH 2/5] net: mac8390: Use standard memcpy_{from,to}io()
From: David Miller @ 2018-07-02 13:39 UTC (permalink / raw)
To: geert
Cc: gerg, dmitry.torokhov, deller, linux-m68k, netdev, linux-input,
linux-kernel
In-Reply-To: <20180702133532.5412-3-geert@linux-m68k.org>
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Mon, 2 Jul 2018 15:35:29 +0200
> The mac8390 driver defines its own variants of memcpy_fromio() and
> memcpy_toio(), using similar implementations, but different function
> signatures.
>
> Remove the custom definitions of memcpy_fromio() and memcpy_toio(), and
> adjust all callers to the standard signatures.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> This is a dependency for "m68k: Move mem*io define guards to
> <asm/kmap.h>".
>
> Untested on real hardware, assembler output compared.
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* [PATCH 5/5] m68k/io: Switch mmu variant to <asm-generic/io.h>
From: Geert Uytterhoeven @ 2018-07-02 13:35 UTC (permalink / raw)
To: Greg Ungerer, David S . Miller, Dmitry Torokhov, Helge Deller
Cc: linux-m68k, netdev, linux-input, linux-kernel, Geert Uytterhoeven
In-Reply-To: <20180702133532.5412-1-geert@linux-m68k.org>
The dummy functions defined in <asm/io_mm.h> can be provided by
<asm-generic/io.h>.
As nommu already uses <asm-generic/io.h>, move its inclusion to
<asm/io.h>, and add/adjust include guards where appropriate.
This gets rid of lots of "statement with no effect" and "unused
variable" warnings when compile-testing.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
arch/m68k/include/asm/io.h | 7 ++++++
arch/m68k/include/asm/io_mm.h | 40 +++--------------------------------
arch/m68k/include/asm/io_no.h | 1 -
3 files changed, 10 insertions(+), 38 deletions(-)
diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h
index ca2849afb0877339..aabe6420ead2a599 100644
--- a/arch/m68k/include/asm/io.h
+++ b/arch/m68k/include/asm/io.h
@@ -1,6 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _M68K_IO_H
+#define _M68K_IO_H
+
#if defined(__uClinux__) || defined(CONFIG_COLDFIRE)
#include <asm/io_no.h>
#else
#include <asm/io_mm.h>
#endif
+
+#include <asm-generic/io.h>
+
+#endif /* _M68K_IO_H */
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index fe485f4f5fac4d92..49ced111e6db0324 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -16,8 +16,8 @@
* isa_readX(),isa_writeX() are for ISA memory
*/
-#ifndef _IO_H
-#define _IO_H
+#ifndef _M68K_IO_MM_H
+#define _M68K_IO_MM_H
#ifdef __KERNEL__
@@ -369,40 +369,6 @@ static inline void isa_delay(void)
#define writew(val, addr) out_le16((addr), (val))
#endif /* CONFIG_ATARI_ROM_ISA */
-#if !defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA)
-/*
- * We need to define dummy functions for GENERIC_IOMAP support.
- */
-#define inb(port) 0xff
-#define inb_p(port) 0xff
-#define outb(val,port) ((void)0)
-#define outb_p(val,port) ((void)0)
-#define inw(port) 0xffff
-#define inw_p(port) 0xffff
-#define outw(val,port) ((void)0)
-#define outw_p(val,port) ((void)0)
-#define inl(port) 0xffffffffUL
-#define inl_p(port) 0xffffffffUL
-#define outl(val,port) ((void)0)
-#define outl_p(val,port) ((void)0)
-
-#define insb(port,buf,nr) ((void)0)
-#define outsb(port,buf,nr) ((void)0)
-#define insw(port,buf,nr) ((void)0)
-#define outsw(port,buf,nr) ((void)0)
-#define insl(port,buf,nr) ((void)0)
-#define outsl(port,buf,nr) ((void)0)
-
-/*
- * These should be valid on any ioremap()ed region
- */
-#define readb(addr) in_8(addr)
-#define writeb(val,addr) out_8((addr),(val))
-#define readw(addr) in_le16(addr)
-#define writew(val,addr) out_le16((addr),(val))
-
-#endif /* !CONFIG_ISA && !CONFIG_ATARI_ROM_ISA */
-
#define readl(addr) in_le32(addr)
#define writel(val,addr) out_le32((addr),(val))
@@ -444,4 +410,4 @@ static inline void isa_delay(void)
#define writew_relaxed(b, addr) writew(b, addr)
#define writel_relaxed(b, addr) writel(b, addr)
-#endif /* _IO_H */
+#endif /* _M68K_IO_MM_H */
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index c207428fae5953e7..0498192e1d983292 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -133,6 +133,5 @@ static inline void writel(u32 value, volatile void __iomem *addr)
#include <asm/kmap.h>
#include <asm/virtconvert.h>
-#include <asm-generic/io.h>
#endif /* _M68KNOMMU_IO_H */
--
2.17.1
^ permalink raw reply related
* Re: [net-next 01/12] net/mlx5e: Add UDP GSO support
From: Willem de Bruijn @ 2018-07-02 13:34 UTC (permalink / raw)
To: borisp
Cc: Alexander Duyck, David Miller, Network Development,
Saeed Mahameed, ogerlitz, yossiku
In-Reply-To: <7f108395-5782-eb4c-1023-5c513bd13079@mellanox.com>
On Mon, Jul 2, 2018 at 1:30 AM Boris Pismenny <borisp@mellanox.com> wrote:
>
>
>
> On 7/2/2018 4:45 AM, Willem de Bruijn wrote:
> >>> I've noticed that we could get cleaner code in our driver if we remove
> >>> these two lines from net/ipv4/udp_offload.c:
> >>> if (skb_is_gso(segs))
> >>> mss *= skb_shinfo(segs)->gso_segs;
> >>>
> >>> I think that this is correct in case of GSO_PARTIAL segmentation for the
> >>> following reasons:
> >>> 1. After this change the UDP payload field is consistent with the IP
> >>> header payload length field. Currently, IPv4 length is 1500 and UDP
> >>> total length is the full unsegmented length.
> >
> > How does this simplify the driver? Does it currently have to
> > change the udph->length field to the mss on the wire, because the
> > device only splits + replicates the headers + computes the csum?
>
> Yes, this is the code I have at the moment.
>
> The device's limitation is more subtle than this. It could adjust the
> length, but then the checksum would be wrong.
I see. We do have to keep in mind other devices. Alexander's ixgbe
RFC patch does not have this logic, so that device must update the
field directly.
https://patchwork.ozlabs.org/patch/908396/
^ permalink raw reply
* [PATCH 4/5] m68k/io: Move mem*io define guards to <asm/kmap.h>
From: Geert Uytterhoeven @ 2018-07-02 13:35 UTC (permalink / raw)
To: Greg Ungerer, David S . Miller, Dmitry Torokhov, Helge Deller
Cc: linux-m68k, netdev, linux-input, linux-kernel, Geert Uytterhoeven
In-Reply-To: <20180702133532.5412-1-geert@linux-m68k.org>
The mem*io define guards are applicable to all users of <asm/kmap.h>.
Hence move them, and drop the #ifdef.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
To avoid redefined warnings, this depends on "net: mac8390: Use standard
memcpy_{from,to}io()".
---
arch/m68k/include/asm/io_no.h | 11 -----------
arch/m68k/include/asm/kmap.h | 3 +++
2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/arch/m68k/include/asm/io_no.h b/arch/m68k/include/asm/io_no.h
index 83a0a6d449f44bdd..c207428fae5953e7 100644
--- a/arch/m68k/include/asm/io_no.h
+++ b/arch/m68k/include/asm/io_no.h
@@ -131,17 +131,6 @@ static inline void writel(u32 value, volatile void __iomem *addr)
#define PCI_SPACE_LIMIT PCI_IO_MASK
#endif /* CONFIG_PCI */
-/*
- * These are defined in kmap.h as static inline functions. To maintain
- * previous behavior we put these define guards here so io_mm.h doesn't
- * see them.
- */
-#ifdef CONFIG_MMU
-#define memset_io memset_io
-#define memcpy_fromio memcpy_fromio
-#define memcpy_toio memcpy_toio
-#endif
-
#include <asm/kmap.h>
#include <asm/virtconvert.h>
#include <asm-generic/io.h>
diff --git a/arch/m68k/include/asm/kmap.h b/arch/m68k/include/asm/kmap.h
index bf1026def698f21f..dd4a365bf463d3cf 100644
--- a/arch/m68k/include/asm/kmap.h
+++ b/arch/m68k/include/asm/kmap.h
@@ -48,18 +48,21 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
}
+#define memset_io memset_io
static inline void memset_io(volatile void __iomem *addr, unsigned char val,
int count)
{
__builtin_memset((void __force *) addr, val, count);
}
+#define memcpy_fromio memcpy_fromio
static inline void memcpy_fromio(void *dst, const volatile void __iomem *src,
int count)
{
__builtin_memcpy(dst, (void __force *) src, count);
}
+#define memcpy_toio memcpy_toio
static inline void memcpy_toio(volatile void __iomem *dst, const void *src,
int count)
{
--
2.17.1
^ permalink raw reply related
* [PATCH 3/5] Input: hilkbd - Add casts to HP9000/300 I/O accessors
From: Geert Uytterhoeven @ 2018-07-02 13:35 UTC (permalink / raw)
To: Greg Ungerer, David S . Miller, Dmitry Torokhov, Helge Deller
Cc: linux-m68k, netdev, linux-input, linux-kernel, Geert Uytterhoeven
In-Reply-To: <20180702133532.5412-1-geert@linux-m68k.org>
Internally, hilkbd uses "unsigned long" I/O addresses everywhere.
This works fine as:
- On PA-RISC, hilkbd uses the gsc_{read,write}b() I/O accessors, which
take "unsigned long" addresses,
- On m68k, hilkbd uses {read,write}b(), which are currently mapped to
{in,out}_8(), and convert the passed addresses to pointers
internally.
However, the asm-generic version of {read,write}b() does not perform
such conversions, and requires passing pointers instead. Hence add
casts to prepare for switching m68k to the asm-generic version.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
This is a dependency for "m68k/io: Switch mmu variant to
<asm-generic/io.h>".
---
drivers/input/keyboard/hilkbd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c
index a4e404aaf64bdb82..5c7afdec192c139b 100644
--- a/drivers/input/keyboard/hilkbd.c
+++ b/drivers/input/keyboard/hilkbd.c
@@ -57,8 +57,8 @@ MODULE_LICENSE("GPL v2");
#define HIL_DATA 0x1
#define HIL_CMD 0x3
#define HIL_IRQ 2
- #define hil_readb(p) readb(p)
- #define hil_writeb(v,p) writeb((v),(p))
+ #define hil_readb(p) readb((const volatile void __iomem *)(p))
+ #define hil_writeb(v, p) writeb((v), (volatile void __iomem *)(p))
#else
#error "HIL is not supported on this platform"
--
2.17.1
^ permalink raw reply related
* [PATCH 2/5] net: mac8390: Use standard memcpy_{from,to}io()
From: Geert Uytterhoeven @ 2018-07-02 13:35 UTC (permalink / raw)
To: Greg Ungerer, David S . Miller, Dmitry Torokhov, Helge Deller
Cc: linux-m68k, netdev, linux-input, linux-kernel, Geert Uytterhoeven
In-Reply-To: <20180702133532.5412-1-geert@linux-m68k.org>
The mac8390 driver defines its own variants of memcpy_fromio() and
memcpy_toio(), using similar implementations, but different function
signatures.
Remove the custom definitions of memcpy_fromio() and memcpy_toio(), and
adjust all callers to the standard signatures.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
This is a dependency for "m68k: Move mem*io define guards to
<asm/kmap.h>".
Untested on real hardware, assembler output compared.
---
drivers/net/ethernet/8390/mac8390.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/8390/mac8390.c b/drivers/net/ethernet/8390/mac8390.c
index b6d735bf80117e27..342ae08ec3c29832 100644
--- a/drivers/net/ethernet/8390/mac8390.c
+++ b/drivers/net/ethernet/8390/mac8390.c
@@ -153,9 +153,6 @@ static void dayna_block_input(struct net_device *dev, int count,
static void dayna_block_output(struct net_device *dev, int count,
const unsigned char *buf, int start_page);
-#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
-#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
-
#define memcmp_withio(a, b, c) memcmp((a), (void *)(b), (c))
/* Slow Sane (16-bit chunk memory read/write) Cabletron uses this */
@@ -239,7 +236,7 @@ static enum mac8390_access mac8390_testio(unsigned long membase)
unsigned long outdata = 0xA5A0B5B0;
unsigned long indata = 0x00000000;
/* Try writing 32 bits */
- memcpy_toio(membase, &outdata, 4);
+ memcpy_toio((void __iomem *)membase, &outdata, 4);
/* Now compare them */
if (memcmp_withio(&outdata, membase, 4) == 0)
return ACCESS_32;
@@ -711,7 +708,7 @@ static void sane_get_8390_hdr(struct net_device *dev,
struct e8390_pkt_hdr *hdr, int ring_page)
{
unsigned long hdr_start = (ring_page - WD_START_PG)<<8;
- memcpy_fromio(hdr, dev->mem_start + hdr_start, 4);
+ memcpy_fromio(hdr, (void __iomem *)dev->mem_start + hdr_start, 4);
/* Fix endianness */
hdr->count = swab16(hdr->count);
}
@@ -725,13 +722,16 @@ static void sane_block_input(struct net_device *dev, int count,
if (xfer_start + count > ei_status.rmem_end) {
/* We must wrap the input move. */
int semi_count = ei_status.rmem_end - xfer_start;
- memcpy_fromio(skb->data, dev->mem_start + xfer_base,
+ memcpy_fromio(skb->data,
+ (void __iomem *)dev->mem_start + xfer_base,
semi_count);
count -= semi_count;
- memcpy_fromio(skb->data + semi_count, ei_status.rmem_start,
- count);
+ memcpy_fromio(skb->data + semi_count,
+ (void __iomem *)ei_status.rmem_start, count);
} else {
- memcpy_fromio(skb->data, dev->mem_start + xfer_base, count);
+ memcpy_fromio(skb->data,
+ (void __iomem *)dev->mem_start + xfer_base,
+ count);
}
}
@@ -740,7 +740,7 @@ static void sane_block_output(struct net_device *dev, int count,
{
long shmem = (start_page - WD_START_PG)<<8;
- memcpy_toio(dev->mem_start + shmem, buf, count);
+ memcpy_toio((void __iomem *)dev->mem_start + shmem, buf, count);
}
/* dayna block input/output */
--
2.17.1
^ permalink raw reply related
* [PATCH 1/5] m68k/io: Add missing ioremap define guards, fix typo
From: Geert Uytterhoeven @ 2018-07-02 13:35 UTC (permalink / raw)
To: Greg Ungerer, David S . Miller, Dmitry Torokhov, Helge Deller
Cc: linux-m68k, netdev, linux-input, linux-kernel, Geert Uytterhoeven
In-Reply-To: <20180702133532.5412-1-geert@linux-m68k.org>
- Add missing define guard for ioremap_wt(),
- Fix typo s/ioremap_fillcache/ioremap_fullcache/,
- Add define guard for iounmap() for consistency with other
architectures.
Fixes: 9746882f547d2f00 ("m68k: group io mapping definitions and functions")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
arch/m68k/include/asm/kmap.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/m68k/include/asm/kmap.h b/arch/m68k/include/asm/kmap.h
index 84b8333db8ad1987..bf1026def698f21f 100644
--- a/arch/m68k/include/asm/kmap.h
+++ b/arch/m68k/include/asm/kmap.h
@@ -16,6 +16,7 @@
*/
extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
int cacheflag);
+#define iounmap iounmap
extern void iounmap(void __iomem *addr);
extern void __iounmap(void *addr, unsigned long size);
@@ -33,13 +34,14 @@ static inline void __iomem *ioremap_nocache(unsigned long physaddr,
}
#define ioremap_uc ioremap_nocache
+#define ioremap_wt ioremap_wt
static inline void __iomem *ioremap_wt(unsigned long physaddr,
unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
}
-#define ioremap_fillcache ioremap_fullcache
+#define ioremap_fullcache ioremap_fullcache
static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
unsigned long size)
{
--
2.17.1
^ permalink raw reply related
* [PATCH 0/5] m68k: IO Fixes and Cleanups
From: Geert Uytterhoeven @ 2018-07-02 13:35 UTC (permalink / raw)
To: Greg Ungerer, David S . Miller, Dmitry Torokhov, Helge Deller
Cc: linux-m68k, netdev, linux-input, linux-kernel, Geert Uytterhoeven
Hi all,
This patch series contains fixes and cleanups for I/O accessors on m68k
platforms (with MMU).
The first patch contains small fixes without any dependencies.
Patches 2 and 3 make small adjustments to drivers that are dependencies
for further cleanup.
Patch 4 and 5 complete the cleanup.
Given the dependencies, I think it's easiest if the respective
maintainers would provide their Acked-by, so all patches can go in
through the m68k tree.
Thanks for your comments!
Geert Uytterhoeven (5):
m68k/io: Add missing ioremap define guards, fix typo
net: mac8390: Use standard memcpy_{from,to}io()
Input: hilkbd - Add casts to HP9000/300 I/O accessors
m68k/io: Move mem*io define guards to <asm/kmap.h>
m68k/io: Switch mmu variant to <asm-generic/io.h>
arch/m68k/include/asm/io.h | 7 +++++
arch/m68k/include/asm/io_mm.h | 40 +++--------------------------
arch/m68k/include/asm/io_no.h | 12 ---------
arch/m68k/include/asm/kmap.h | 7 ++++-
drivers/input/keyboard/hilkbd.c | 4 +--
drivers/net/ethernet/8390/mac8390.c | 20 +++++++--------
6 files changed, 28 insertions(+), 62 deletions(-)
--
2.17.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH] ieee802154: add rx LQI from userspace
From: Clément Péron @ 2018-07-02 13:28 UTC (permalink / raw)
To: Romuald Cari, linux-wpan
Cc: Alexander Aring, Stefan Schmidt, David S . Miller, netdev,
linux-kernel, Clément Peron
In-Reply-To: <20180607140802.22666-1-peron.clem@gmail.com>
Could you review it please ?
Thanks,
Clement
On Thu, 7 Jun 2018 at 16:08, Clément Péron <peron.clem@gmail.com> wrote:
>
> From: Romuald CARI <romuald.cari@devialet.com>
>
> The Link Quality Indication data exposed by drivers could not be accessed from
> userspace. Since this data is per-datagram received, it makes sense to make it
> available to userspace application through the ancillary data mechanism in
> recvmsg rather than through ioctls. This can be activated using the socket
> option WPAN_WANTLQI under SOL_IEEE802154 protocol.
>
> This LQI data is available in the ancillary data buffer under the SOL_IEEE802154
> level as the type WPAN_LQI. The value is an unsigned byte indicating the link
> quality with values ranging 0-255.
>
> Signed-off-by: Romuald Cari <romuald.cari@devialet.com>
> Signed-off-by: Clément Peron <clement.peron@devialet.com>
> ---
> include/net/af_ieee802154.h | 1 +
> net/ieee802154/socket.c | 17 +++++++++++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/include/net/af_ieee802154.h b/include/net/af_ieee802154.h
> index a5563d27a3eb..8003a9f6eb43 100644
> --- a/include/net/af_ieee802154.h
> +++ b/include/net/af_ieee802154.h
> @@ -56,6 +56,7 @@ struct sockaddr_ieee802154 {
> #define WPAN_WANTACK 0
> #define WPAN_SECURITY 1
> #define WPAN_SECURITY_LEVEL 2
> +#define WPAN_WANTLQI 3
>
> #define WPAN_SECURITY_DEFAULT 0
> #define WPAN_SECURITY_OFF 1
> diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
> index a60658c85a9a..bc6b912603f1 100644
> --- a/net/ieee802154/socket.c
> +++ b/net/ieee802154/socket.c
> @@ -25,6 +25,7 @@
> #include <linux/termios.h> /* For TIOCOUTQ/INQ */
> #include <linux/list.h>
> #include <linux/slab.h>
> +#include <linux/socket.h>
> #include <net/datalink.h>
> #include <net/psnap.h>
> #include <net/sock.h>
> @@ -452,6 +453,7 @@ struct dgram_sock {
> unsigned int bound:1;
> unsigned int connected:1;
> unsigned int want_ack:1;
> + unsigned int want_lqi:1;
> unsigned int secen:1;
> unsigned int secen_override:1;
> unsigned int seclevel:3;
> @@ -486,6 +488,7 @@ static int dgram_init(struct sock *sk)
> struct dgram_sock *ro = dgram_sk(sk);
>
> ro->want_ack = 1;
> + ro->want_lqi = 0;
> return 0;
> }
>
> @@ -713,6 +716,7 @@ static int dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
> size_t copied = 0;
> int err = -EOPNOTSUPP;
> struct sk_buff *skb;
> + struct dgram_sock *ro = dgram_sk(sk);
> DECLARE_SOCKADDR(struct sockaddr_ieee802154 *, saddr, msg->msg_name);
>
> skb = skb_recv_datagram(sk, flags, noblock, &err);
> @@ -744,6 +748,13 @@ static int dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
> *addr_len = sizeof(*saddr);
> }
>
> + if (ro->want_lqi) {
> + err = put_cmsg(msg, SOL_IEEE802154, WPAN_WANTLQI,
> + sizeof(uint8_t), &(mac_cb(skb)->lqi));
> + if (err)
> + goto done;
> + }
> +
> if (flags & MSG_TRUNC)
> copied = skb->len;
> done:
> @@ -847,6 +858,9 @@ static int dgram_getsockopt(struct sock *sk, int level, int optname,
> case WPAN_WANTACK:
> val = ro->want_ack;
> break;
> + case WPAN_WANTLQI:
> + val = ro->want_lqi;
> + break;
> case WPAN_SECURITY:
> if (!ro->secen_override)
> val = WPAN_SECURITY_DEFAULT;
> @@ -892,6 +906,9 @@ static int dgram_setsockopt(struct sock *sk, int level, int optname,
> case WPAN_WANTACK:
> ro->want_ack = !!val;
> break;
> + case WPAN_WANTLQI:
> + ro->want_lqi = !!val;
> + break;
> case WPAN_SECURITY:
> if (!ns_capable(net->user_ns, CAP_NET_ADMIN) &&
> !ns_capable(net->user_ns, CAP_NET_RAW)) {
> --
> 2.17.1
>
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2018-07-02 13:03 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) Verify netlink attributes properly in nf_queue, from Eric Dumazet.
2) Need to bump memory lock rlimit for test_sockmap bpf test, from
Yonghong Song.
3) Fix VLAN handling in lan78xx driver, from Dave Stevenson.
4) Fix uninitialized read in nf_log, from Jann Horn.
5) Fix raw command length parsing in mlx5, from Alex Vesker.
6) Cleanup loopback RDS connections upon netns deletion, from Sowmini
Varadhan.
7) Fix regressions in FIB rule matching during create, from Jason
A. Donenfeld and Roopa Prabhu.
8) Fix mpls ether type detection in nfp, from Pieter Jansen van
Vuuren.
9) More bpfilter build fixes/adjustments from Masahiro Yamada.
10) Fix XDP_{TX,REDIRECT} flushing in various drivers, from Jesper
Dangaard Brouer.
11) fib_tests.sh file permissions were broken, from Shuah Khan.
12) Make sure BH/preemption is disabled in data path of mac80211,
from Denis Kenzior.
13) Don't ignore nla_parse_nested() return values in nl80211,
from Johannes berg.
14) Properly account sock objects ot kmemcg, from Shakeel Butt.
15) Adjustments to setting bpf program permissions to read-only,
from Daniel Borkmann.
16) TCP Fast Open key endianness was broken, it always took on
the host endiannness. Whoops. Explicitly make it little
endian. From Yuching Cheng.
17) Fix prefix route setting for link local addresses in ipv6,
from David Ahern.
18) Potential Spectre v1 in zatm driver, from Gustavo A. R. Silva.
19) Various bpf sockmap fixes, from John Fastabend.
20) Use after free for GRO with ESP, from Sabrina Dubroca.
21) Passing bogus flags to crypto_alloc_shash() in ipv6 SR code,
from Eric Biggers.
Please pull, thanks a lot!
The following changes since commit 6f0d349d922ba44e4348a17a78ea51b7135965b1:
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2018-06-25 15:58:17 +0800)
are available in the Git repository at:
gitolite@ra.kernel.org:/pub/scm/linux/kernel/git/davem/net.git
for you to fetch changes up to e48e097996439cd73f36c89b98ba4175d84c9be6:
Merge branch 'qed-fixes' (2018-07-02 20:41:31 +0900)
----------------------------------------------------------------
Alex Vesker (2):
net/mlx5: Fix incorrect raw command length parsing
net/mlx5: Fix command interface race in polling mode
Alexandre Belloni (1):
net: macb: initialize bp->queues[0].bp for at91rm9200
Alexei Starovoitov (1):
Merge branch 'bpf-fixes'
Anders Roxell (1):
selftests: bpf: add missing NET_SCHED to config
Bert Kenward (1):
sfc: correctly initialise filter rwsem for farch
Bob Copeland (1):
nl80211: relax ht operation checks for mesh
Chengguang Xu (1):
nfp: cast sizeof() to int when comparing with error code
Cong Wang (1):
net: use dev_change_tx_queue_len() for SIOCSIFTXQLEN
Dan Carpenter (2):
atm: iphase: fix a 64 bit bug
cnic: tidy up a size calculation
Dan Murphy (1):
net: phy: DP83TC811: Fix disabling interrupts
Daniel Borkmann (5):
Merge branch 'bpf-bpftool-fixes'
bpf, arm32: fix to use bpf_jit_binary_lock_ro api
bpf, s390: fix potential memleak when later bpf_jit_prog fails
bpf: undo prog rejection on read-only lock failure
Merge branch 'bpf-sockmap-fixes'
Dave Stevenson (4):
net: lan78xx: Allow for VLAN headers in timeout calcs
net: lan78xx: Add support for VLAN filtering.
net: lan78xx: Add support for VLAN tag stripping.
net: lan78xx: Use s/w csum check on VLANs without tag stripping
David Ahern (2):
bpf: Change bpf_fib_lookup to return lookup status
net/ipv6: Fix updates to prefix route
David S. Miller (10):
Merge branch 'lan78xx-minor-fixes'
Merge branch 'nfp-MPLS-and-shared-blocks-TC-offload-fixes'
Merge git://git.kernel.org/.../pablo/nf
Merge branch 'xdp-flush'
Merge tag 'mlx5-fixes-2018-06-26' of git://git.kernel.org/.../saeed/linux
Merge tag 'mac80211-for-davem-2018-06-29' of git://git.kernel.org/.../jberg/mac80211
Merge branch 'DPAA-fixes'
Merge branch 's390-qeth-fixes'
Merge git://git.kernel.org/.../bpf/bpf
Merge branch 'qed-fixes'
Denis Kenzior (1):
mac80211: disable BHs/preemption in ieee80211_tx_control_port()
Doron Roberts-Kedes (1):
strparser: Remove early eaten to fix full tcp receive buffer stall
Eli Cohen (2):
net/mlx5: E-Switch, Disallow vlan/spoofcheck setup if not being esw manager
net/mlx5: Fix required capability for manipulating MPFS
Eric Biggers (1):
ipv6: sr: fix passing wrong flags to crypto_alloc_shash()
Eric Dumazet (3):
netfilter: nf_queue: augment nfqa_cfg_policy
netfilter: ipv6: nf_defrag: reduce struct net memory waste
tcp: add one more quick ack after after ECN events
Florian Westphal (1):
netfilter: nf_conncount: fix garbage collection confirm race
Gao Feng (1):
netfilter: nf_ct_helper: Fix possible panic after nf_conntrack_helper_unregister
Gustavo A. R. Silva (1):
atm: zatm: Fix potential Spectre v1
Hangbin Liu (1):
ipvlan: call dev_change_flags when ipvlan mode is reset
Ilpo Järvinen (1):
tcp: prevent bogus FRTO undos with non-SACK flows
Jakub Kicinski (3):
tools: bpftool: remove duplicated error message on prog load
tools: bpftool: remember to close the libbpf object after prog load
nfp: bpf: don't stop offload if replace failed
Jann Horn (2):
netfilter: nf_log: fix uninit read in nf_log_proc_dostring
netfilter: nf_log: don't hold nf_log_mutex during user access
Jason A. Donenfeld (1):
fib_rules: match rules based on suppress_* properties too
Jeffrin Jose T (3):
selftests: bpf: notification about privilege required to run test_kmod.sh testing script
selftests: bpf: notification about privilege required to run test_lirc_mode2.sh testing script
selftests: bpf: notification about privilege required to run test_lwt_seg6local.sh testing script
Jesper Dangaard Brouer (3):
ixgbe: split XDP_TX tail and XDP_REDIRECT map flushing
i40e: split XDP_TX tail and XDP_REDIRECT map flushing
virtio_net: split XDP_TX kick and XDP_REDIRECT map flushing
Jiri Slaby (1):
r8152: napi hangup fix after disconnect
Johannes Berg (1):
nl80211: check nla_parse_nested() return values
John Fastabend (4):
bpf: sockmap, fix crash when ipv6 sock is added
bpf: sockmap, fix smap_list_map_remove when psock is in many maps
bpf: sockhash fix omitted bucket lock in sock_close
bpf: sockhash, add release routine
John Hurley (1):
nfp: reject binding to shared blocks
Jose Abreu (1):
net: stmmac: Set DMA buffer size in HW
Julian Wiedmann (4):
Revert "s390/qeth: use Read device to query hypervisor for MAC"
s390/qeth: fix race when setting MAC address
s390/qeth: don't clobber buffer on async TX completion
s390/qeth: consistently re-enable device features
Kleber Sacilotto de Souza (1):
test_bpf: flag tests that cannot be jited on s390
Madalin Bucur (2):
fsl/fman: fix parser reporting bad checksum on short frames
dpaa_eth: DPAA SGT needs to be 256B
Masahiro Yamada (2):
bpfilter: check compiler capability in Kconfig
bpfilter: include bpfilter_umh in assembly instead of using objcopy
Michal Hocko (1):
net: cleanup gfp mask in alloc_skb_with_frags
Or Gerlitz (4):
net/mlx5e: Don't attempt to dereference the ppriv struct if not being eswitch manager
net/mlx5: E-Switch, Avoid setup attempt if not being e-switch manager
net/mlx5e: Avoid dealing with vport representors if not being e-switch manager
IB/mlx5: Avoid dealing with vport representors if not being e-switch manager
Pieter Jansen van Vuuren (1):
nfp: flower: fix mpls ether type detection
Roopa Prabhu (1):
net: fib_rules: bring back rule_exists to match rule during add
Sabrina Dubroca (2):
alx: take rtnl before calling __alx_open from resume
net: fix use-after-free in GRO with ESP
Sean Young (1):
bpf: fix attach type BPF_LIRC_MODE2 dependency wrt CONFIG_CGROUP_BPF
Shakeel Butt (1):
net, mm: account sock objects to kmemcg
Shay Agroskin (1):
net/mlx5: Fix wrong size allocation for QoS ETC TC regitster
Shuah Khan (1):
selftests/net: Fix permissions for fib_tests.sh
Sowmini Varadhan (1):
rds: clean up loopback rds_connections on netns deletion
Stephen Hemminger (1):
hv_netvsc: split sub-channel setup into async and sync
Sudarsana Reddy Kalluru (5):
bnx2x: Fix receiving tx-timeout in error or recovery state.
qed: Limit msix vectors in kdump kernel to the minimum required count.
qed: Fix setting of incorrect eswitch mode.
qed: Fix use of incorrect size in memcpy call.
qede: Adverstise software timestamp caps when PHC is not available.
Ursula Braun (1):
net/smc: rebuild nonblocking connect
Vasily Gorbik (1):
s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6]
Wei Yongjun (1):
hinic: reset irq affinity before freeing irq
Yonghong Song (1):
tools/bpf: fix test_sockmap failure
Yuchung Cheng (1):
tcp: fix Fast Open key endianness
Makefile | 5 --
arch/arm/net/bpf_jit_32.c | 2 +-
arch/s390/net/bpf_jit_comp.c | 1 +
drivers/atm/iphase.c | 2 +-
drivers/atm/zatm.c | 2 +
drivers/infiniband/hw/mlx5/main.c | 2 +-
drivers/media/rc/bpf-lirc.c | 14 +----
drivers/net/ethernet/atheros/alx/main.c | 8 ++-
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 1 +
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 6 +++
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 6 +++
drivers/net/ethernet/broadcom/cnic.c | 2 +-
drivers/net/ethernet/cadence/macb_main.c | 2 +
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 15 +++---
drivers/net/ethernet/freescale/fman/fman_port.c | 8 +++
drivers/net/ethernet/huawei/hinic/hinic_rx.c | 1 +
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 24 +++++----
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 24 +++++----
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 8 +--
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 ++---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 8 ++-
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 12 ++---
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 4 +-
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 3 +-
drivers/net/ethernet/mellanox/mlx5/core/fw.c | 5 +-
drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c | 9 ++--
drivers/net/ethernet/mellanox/mlx5/core/port.c | 4 +-
drivers/net/ethernet/mellanox/mlx5/core/sriov.c | 7 ++-
drivers/net/ethernet/mellanox/mlx5/core/vport.c | 2 -
drivers/net/ethernet/netronome/nfp/bpf/main.c | 9 ++--
drivers/net/ethernet/netronome/nfp/flower/match.c | 14 +++++
drivers/net/ethernet/netronome/nfp/flower/offload.c | 11 ++++
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nffw.c | 2 +-
drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 8 +--
drivers/net/ethernet/qlogic/qed/qed_dev.c | 2 +-
drivers/net/ethernet/qlogic/qed/qed_main.c | 8 +++
drivers/net/ethernet/qlogic/qed/qed_sriov.c | 19 ++++++-
drivers/net/ethernet/qlogic/qede/qede_ptp.c | 10 +++-
drivers/net/ethernet/sfc/farch.c | 1 +
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 12 +++++
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 2 +
drivers/net/ethernet/stmicro/stmmac/hwif.h | 3 ++
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +
drivers/net/geneve.c | 2 +-
drivers/net/hyperv/hyperv_net.h | 2 +-
drivers/net/hyperv/netvsc.c | 37 ++++++++++++-
drivers/net/hyperv/netvsc_drv.c | 17 +++++-
drivers/net/hyperv/rndis_filter.c | 61 +++++----------------
drivers/net/ipvlan/ipvlan_main.c | 36 ++++++++++---
drivers/net/phy/dp83tc811.c | 2 +-
drivers/net/usb/lan78xx.c | 37 +++++++++++--
drivers/net/usb/r8152.c | 3 +-
drivers/net/virtio_net.c | 30 +++++++----
drivers/net/vxlan.c | 4 +-
drivers/s390/net/qeth_core.h | 13 ++++-
drivers/s390/net/qeth_core_main.c | 47 +++++++++-------
drivers/s390/net/qeth_l2_main.c | 24 +++++----
drivers/s390/net/qeth_l3_main.c | 3 +-
include/linux/bpf-cgroup.h | 26 +++++++++
include/linux/bpf.h | 8 +++
include/linux/bpf_lirc.h | 5 +-
include/linux/filter.h | 56 +++----------------
include/linux/mlx5/eswitch.h | 2 +
include/linux/mlx5/mlx5_ifc.h | 2 +-
include/linux/netdevice.h | 20 +++++++
include/net/net_namespace.h | 1 +
include/net/netns/ipv6.h | 1 -
include/net/pkt_cls.h | 5 ++
include/uapi/linux/bpf.h | 28 ++++++++--
kernel/bpf/cgroup.c | 54 +++++++++++++++++++
kernel/bpf/core.c | 30 +----------
kernel/bpf/sockmap.c | 254 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
kernel/bpf/syscall.c | 99 ++++++++--------------------------
lib/test_bpf.c | 20 +++++++
net/8021q/vlan.c | 2 +-
net/Makefile | 4 --
net/bpfilter/Kconfig | 2 +-
net/bpfilter/Makefile | 17 +-----
net/bpfilter/bpfilter_kern.c | 11 ++--
net/bpfilter/bpfilter_umh_blob.S | 7 +++
net/core/dev_ioctl.c | 11 +---
net/core/fib_rules.c | 80 +++++++++++++++++++++++++++-
net/core/filter.c | 86 +++++++++++++++++++-----------
net/core/skbuff.c | 3 +-
net/core/sock.c | 7 ++-
net/ipv4/fou.c | 4 +-
net/ipv4/gre_offload.c | 2 +-
net/ipv4/sysctl_net_ipv4.c | 18 +++++--
net/ipv4/tcp_input.c | 13 ++++-
net/ipv4/udp_offload.c | 2 +-
net/ipv6/addrconf.c | 9 ++--
net/ipv6/netfilter/nf_conntrack_reasm.c | 6 +--
net/ipv6/seg6_hmac.c | 2 +-
net/mac80211/tx.c | 2 +
net/netfilter/nf_conncount.c | 52 ++++++++++++++++--
net/netfilter/nf_conntrack_helper.c | 5 ++
net/netfilter/nf_log.c | 13 +++--
net/netfilter/nfnetlink_queue.c | 3 ++
net/rds/connection.c | 11 +++-
net/rds/loop.c | 56 +++++++++++++++++++
net/rds/loop.h | 2 +
net/smc/af_smc.c | 91 +++++++++++++++++++++----------
net/smc/smc.h | 8 +++
net/strparser/strparser.c | 17 +-----
net/wireless/nl80211.c | 35 +++++-------
samples/bpf/xdp_fwd_kern.c | 8 +--
scripts/cc-can-link.sh | 2 +-
tools/bpf/bpftool/prog.c | 12 +++--
tools/testing/selftests/bpf/config | 1 +
tools/testing/selftests/bpf/test_kmod.sh | 9 ++++
tools/testing/selftests/bpf/test_lirc_mode2.sh | 9 ++++
tools/testing/selftests/bpf/test_lwt_seg6local.sh | 9 ++++
tools/testing/selftests/bpf/test_sockmap.c | 6 ---
tools/testing/selftests/net/fib_tests.sh | 0
114 files changed, 1249 insertions(+), 619 deletions(-)
create mode 100644 net/bpfilter/bpfilter_umh_blob.S
mode change 100644 => 100755 tools/testing/selftests/net/fib_tests.sh
^ permalink raw reply
* Re: [PATCH] wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout
From: Gustavo A. R. Silva @ 2018-07-02 13:01 UTC (permalink / raw)
To: Tony Lindgren
Cc: Kalle Valo, David S. Miller, linux-wireless, netdev, linux-kernel
In-Reply-To: <20180702113008.GV112168@atomide.com>
On 07/02/2018 06:30 AM, Tony Lindgren wrote:
> * Gustavo A. R. Silva <gustavo@embeddedor.com> [180628 13:11]:
>> In case memory resources for *events_vector* were allocated, release
>> them before return.
>>
>> Addresses-Coverity-ID: 1470194 ("Resource leak")
>> Fixes: 4ec7cece87b3 ("wlcore: Add missing PM call for wlcore_cmd_wait_for_event_or_timeout()")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>
> Thanks for catching this one:
>
> Acked-by: Tony Lindgren <tony@atomide.com>
>
Glad to help. :)
Thanks
--
Gustavo
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox