Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151612855
D55912.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D55912.diff
View Options
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -3728,6 +3728,8 @@
break;
case SIOCGI2C:
+ /* fallthru */
+ case SIOCGI2CPB:
ifr = (struct ifreq *)data;
/*
@@ -3737,6 +3739,9 @@
error = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (error)
break;
+ /* ensure page and bank are 0 for legacy SIOCGI2C ioctls */
+ if (command == SIOCGI2C)
+ i2c.page = i2c.bank = 0;
if (i2c.len > sizeof(i2c.data)) {
error = EINVAL;
@@ -3778,8 +3783,17 @@
error = EINVAL;
goto err_i2c;
}
+
+ if (i2c.bank != 0) {
+ mlx5_en_err(ifp,
+ "Query eeprom failed, Invalid Bank: %X\n",
+ i2c.bank);
+ error = EINVAL;
+ goto err_i2c;
+ }
+
error = mlx5_query_eeprom(priv->mdev,
- read_addr, MLX5_EEPROM_LOW_PAGE,
+ read_addr, i2c.page,
(uint32_t)i2c.offset, (uint32_t)i2c.len, module_num,
(uint32_t *)i2c.data, &size_read);
if (error) {
@@ -3791,7 +3805,7 @@
if (i2c.len > MLX5_EEPROM_MAX_BYTES) {
error = mlx5_query_eeprom(priv->mdev,
- read_addr, MLX5_EEPROM_LOW_PAGE,
+ read_addr, i2c.page,
(uint32_t)(i2c.offset + size_read),
(uint32_t)(i2c.len - size_read), module_num,
(uint32_t *)(i2c.data + size_read), &size_read);
diff --git a/sys/net/if.h b/sys/net/if.h
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -604,8 +604,9 @@
uint8_t dev_addr; /* i2c address (0xA0, 0xA2) */
uint8_t offset; /* read offset */
uint8_t len; /* read length */
- uint8_t spare0;
- uint32_t spare1;
+ uint8_t page; /* CMIS page number (0 for legacy) */
+ uint8_t bank; /* CMIS bank number (0 for legacy) */
+ uint8_t spare[3]; /* reserved for future use */
uint8_t data[8]; /* read buffer */
};
diff --git a/sys/net/iflib.h b/sys/net/iflib.h
--- a/sys/net/iflib.h
+++ b/sys/net/iflib.h
@@ -348,7 +348,10 @@
* Driver needs frames padded to some minimum length
*/
#define IFLIB_NEED_ETHER_PAD 0x100
-#define IFLIB_SPARE7 0x200
+/*
+ * Driver understands page/bank i2c reads
+ */
+#define IFLIB_I2C_PAGE_BANK 0x200
#define IFLIB_SPARE6 0x400
#define IFLIB_SPARE5 0x800
#define IFLIB_SPARE4 0x1000
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -4468,8 +4468,11 @@
err = ifmedia_ioctl(ifp, ifr, ctx->ifc_mediap, command);
break;
case SIOCGI2C:
+ /* FALLTHROUGH */
+ case SIOCGI2CPB:
{
struct ifi2creq i2c;
+ if_shared_ctx_t sctx = ctx->ifc_sctx;
err = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
if (err != 0)
@@ -4482,6 +4485,12 @@
err = EINVAL;
break;
}
+ if (command == SIOCGI2C) {
+ i2c.page = i2c.bank = 0;
+ } else if ((sctx->isc_flags & IFLIB_I2C_PAGE_BANK) == 0) {
+ err = EINVAL;
+ break;
+ }
if ((err = IFDI_I2C_REQ(ctx, &i2c)) == 0)
err = copyout(&i2c, ifr_data_get_ptr(ifr),
diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h
--- a/sys/sys/sockio.h
+++ b/sys/sys/sockio.h
@@ -150,5 +150,6 @@
#define SIOCGUMBINFO _IOWR('i', 157, struct ifreq) /* get MBIM info */
#define SIOCSUMBPARAM _IOW('i', 158, struct ifreq) /* set MBIM param */
#define SIOCGUMBPARAM _IOWR('i', 159, struct ifreq) /* get MBIM param */
+#define SIOCGI2CPB _IOWR('i', 160, struct ifreq) /* get I2C data */
#endif /* !_SYS_SOCKIO_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 10, 12:20 PM (8 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31226317
Default Alt Text
D55912.diff (3 KB)
Attached To
Mode
D55912: net: Add page/bank fields to ifi2cre; update mce(4) to use them
Attached
Detach File
Event Timeline
Log In to Comment